TNM method

Reading File
Finding Sources
Searching the Web

TNM staging system cancer classification 2024

Reading File
Reading File
Finding Sources
Reading File
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Here is a thorough breakdown of the TNM staging system based on authoritative medical textbook sources:

TNM Staging System

What Is It?

The TNM system is the internationally accepted standard for classifying the anatomic extent of malignant tumors. It was originally devised by Pierre Denoix in the 1940s and has been refined over subsequent decades. It is currently maintained jointly by:
  • AJCC - American Joint Committee on Cancer
  • UICC - Union Internationale Contre le Cancer (Union for International Cancer Control)
The most recent edition is the 8th edition (2017). - Grainger & Allison's Diagnostic Radiology, p. 739

The Three Components

T - Primary Tumor

Evaluates the local extent of the primary tumor.
CategoryMeaning
TxPrimary tumor cannot be assessed
T0No evidence of primary tumor
TisCarcinoma in situ (no invasion)
T1Smallest/most superficial extent
T2Intermediate local extent
T3More advanced local extent
T4Most advanced local invasion
Subdivisions like T1a, T1b may be added for greater precision, and the specific criteria for each level differ by tumor type. - Grainger & Allison's Diagnostic Radiology, p. 743

N - Regional Lymph Nodes

Evaluates nodal involvement by the cancer.
CategoryMeaning
NxRegional lymph nodes cannot be assessed
N0No regional lymph node metastasis
N1Limited/minimal lymph node involvement
N2Moderate lymph node involvement
N3Extensive lymph node involvement
Letter suffixes (a, b) may further subdivide categories. - Grainger & Allison's Diagnostic Radiology, p. 746

M - Distant Metastasis

Evaluates distant spread of the cancer beyond regional nodes.
CategoryMeaning
M0No distant metastasis
M1Distant metastasis present
M1 can be further specified by organ involved:
  • PUL = pulmonary
  • OSS = osseous
  • HEP = hepatic
  • BRA = brain, and so on
  • Grainger & Allison's Diagnostic Radiology, p. 748

Stage Grouping

Once T, N, and M are assigned, they are combined into an overall Stage Group (I-IV):
StageGeneral Meaning
Stage ILocalized, small tumor, no nodal/distant spread
Stage IILarger or locally advancing tumor, still no distant spread
Stage IIIRegional lymph node involvement
Stage IVDistant metastasis (M1) or very advanced local disease
For example, in lung cancer: T0, N2, M0 = Stage IIIA; any T, any N, M1 = Stage IV. - Swanson's Family Medicine Review, p. 965

Types of TNM Classification

PrefixTypeDescription
cTNMClinicalBased on physical exam + imaging, assigned before definitive treatment
pTNMPathologicalcTNM refined by surgical and histopathological findings
aTNMAutopsyCancer only classified at post-mortem
ycTNM / ypTNMPost-treatmentUsed after neoadjuvant (pre-surgery) multimodality therapy
pT(m)NMMultiple primaries'm' suffix when multiple primaries exist at one site
  • Scott-Brown's Otorhinolaryngology Head & Neck Surgery, p. 648
Key rule: If there is any doubt about staging assignment, the lower category is used. Once assigned, pre-treatment TNM stage should not be changed. - Grainger & Allison's Diagnostic Radiology, p. 750

Grading (G) - Often Reported Alongside TNM

GradeMeaning
GxGrade cannot be assessed
G1Well-differentiated (least aggressive)
G2Moderately differentiated
G3Poorly differentiated (most aggressive)

Residual Tumor (R Classification)

R CategoryMeaning
RxPresence of residual tumor cannot be assessed
R0No residual tumor (complete resection)
R1Microscopic residual disease
R2Macroscopic (visible) residual tumor
  • Scott-Brown's Otorhinolaryngology Head & Neck Surgery, p. 672

Purposes / Aims of TNM Staging

  1. Aid clinicians in treatment planning
  2. Give an indication of prognosis
  3. Allow comparing results across institutions and studies
  4. Facilitate communication about patients without ambiguity
  5. Enable research and clinical trial stratification
  • Scott-Brown's Otorhinolaryngology Head & Neck Surgery, p. 3174

Strengths and Limitations

Strengths:
  • Simple, low-cost, objective
  • Universally accepted
  • No special technology required
  • Relatively accurate anatomic description
Limitations:
  • Observer variability
  • Inconsistencies between centers
  • Does not incorporate host factors (e.g., comorbidities, performance status)
  • Pure anatomic staging may not reflect true prognosis for all cancers (e.g., breast cancer now uses "prognostic staging" that adds biomarkers like ER, PR, HER2, and grade)
The AJCC 8th edition (2017) for breast cancer introduced prognostic staging, which incorporates tumor grade + ER/PR/HER2 status alongside anatomic T/N/M. This reassigned ~25% of cases to lower stages and ~25% to higher stages compared to purely anatomic staging. - Fischer's Mastery of Surgery, 8th ed., p. 1785

Practical Note

The TNM system applies primarily to solid tumors. Some cancers use alternative or parallel systems:
  • FIGO - gynecologic cancers (cervical, uterine, vulvar, ovarian)
  • Ann Arbor - lymphomas
  • Dukes'/Astler-Coller - historically used for colorectal cancer (now replaced by TNM)

What is metastatis

Finding Sources
Searching the Web

metastasis cancer mechanism steps definition

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Here is a thorough explanation of metastasis based on authoritative medical sources:

Metastasis

Definition

Metastasis is the spread of cancer cells from the primary (original) tumor to distant, non-adjacent sites in the body, where they form secondary tumors. It is the defining feature that distinguishes malignant tumors from benign ones, and is the leading cause of cancer-related death.
"Distant metastases cause 90% of cancer deaths." - Scott-Brown's Otorhinolaryngology Head & Neck Surgery
An important point: a secondary tumor retains the identity of its origin. If breast cancer spreads to the lungs, the lung tumor is still made of breast cancer cells - it is called metastatic breast cancer, not lung cancer.

The Metastatic Cascade - Step by Step

Metastasis is not a single event but a complex, multi-step biological process:
StepWhat Happens
1. DisengagementCancer cells break free from cellular and stromal attachments at the primary site
2. ECM Degradation & MotilityCancer cells degrade the surrounding extracellular matrix (ECM) and migrate directionally
3. Invasion of vesselsCancer cells invade blood or lymphatic vessels - called intravasation
4. Survival in circulationCancer cells (circulating tumor cells/CTCs) survive in the bloodstream or lymphatics until they reach a distant site
5. ExtravasationCancer cells adhere to the vessel endothelium at the new site and exit the vessel
6. ColonizationCancer cells proliferate at the new location and recruit a new blood supply (angiogenesis) to establish a colony
  • Scott-Brown's Otorhinolaryngology Head & Neck Surgery, p. 5441

Routes of Spread

Cancer can metastasize via three main pathways:

1. Lymphatic Spread

  • Most common route for carcinomas (epithelial cancers)
  • Cancer cells enter lymphatic vessels and spread to regional lymph nodes first, then further
  • This is why lymph node status (N stage) is so important in TNM staging

2. Hematogenous (Blood) Spread

  • Common in sarcomas (bone/soft tissue tumors) and some carcinomas (renal, thyroid, hepatocellular)
  • Cancer cells enter blood vessels and travel to distant organs
  • The lung receives the entire cardiac output - making it one of the most common sites of blood-borne metastasis
  • However, most circulating cancer cells never form a clinically detectable metastasis - "anatomic access to the pulmonary circulation alone is insufficient to result in clinically evident metastasis" - Murray & Nadel's Respiratory Medicine, p. 2415

3. Direct/Contiguous Spread

  • Cancer invades and grows directly into adjacent tissues and organs
  • Distinct from true metastasis (which involves transport to a distant, non-adjacent site)

4. Transcoelomic Spread

  • Cancer spreads across body cavities (peritoneal, pleural)
  • Example: ovarian cancer seeding across the peritoneum

Organ Tropism - Why Cancer Spreads Where It Does

Metastatic patterns are not random. Certain cancers preferentially spread to specific organs:
Primary CancerCommon Metastatic Sites
BreastLung, bone, brain, liver, lymph nodes
LungBrain, bone, liver, adrenals
ProstateBone (especially osteoblastic)
ColonLiver, lung
MelanomaBrain, skin, lung, liver
This organ specificity is driven by chemokine receptors on tumor cells that allow them to "seek" a suitable microenvironment. For example, breast cancer cells highly express CXCR4 and CCR7 receptors; their ligands (CXCL12 and CCL21) are constitutively expressed in the lung, brain, bone, and lymph nodes - exactly where breast cancer tends to spread. - Murray & Nadel's Respiratory Medicine, p. 2417

Key Molecular Events Enabling Metastasis

  1. Loss of cell adhesion - Downregulation of E-cadherin breaks cell-cell contacts
  2. Epithelial-to-Mesenchymal Transition (EMT) - Cancer cells acquire migratory properties resembling mesenchymal cells
  3. Matrix metalloproteinases (MMPs) - Enzymes that degrade the ECM, clearing a path for invasion
  4. Angiogenesis - Tumors produce VEGF to grow their own blood supply (also needed to sustain metastatic colonies)
  5. Immune evasion - Cancer cells evade immune surveillance to survive in circulation
  6. Pre-metastatic niche formation - Bone marrow-derived cells arrive at the future metastatic site before tumor cells, preparing a "permissive environment" - Murray & Nadel's Respiratory Medicine, p. 2423

Metastasis vs. Invasion

FeatureLocal InvasionMetastasis
MovementInto adjacent tissueTo distant, non-adjacent sites
RouteDirect extensionLymphatics, blood, cavities
SignificanceT stageM stage (M1 = distant metastasis)

Clinical Significance

  • Prognosis: The presence of metastasis (M1 in TNM) typically places a cancer in Stage IV - the most advanced stage
  • Treatment: Metastatic cancers are generally treated systemically (chemotherapy, targeted therapy, immunotherapy) rather than locally (surgery, radiation)
  • Timing: 60-70% of patients have already initiated the metastatic process by the time of initial cancer diagnosis, even if metastases are not yet clinically visible
  • Dormancy: Cancer cells can remain dormant at distant sites for years or even decades before forming a detectable metastasis

In summary, metastasis is the multi-step process by which cancer escapes its site of origin, travels through the body, and establishes new tumor colonies at distant locations - making it the most dangerous and life-threatening behavior of malignant tumors.

Different cancer which we seee in daily opd cases for example breast cancer

Finding Sources
Finding Sources
Finding Sources
Searching the Web

most common cancers seen in outpatient OPD clinic daily practice

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Finding Sources
Here is a practical OPD-oriented guide to the most commonly encountered cancers in clinical practice:

Common Cancers Seen in Daily OPD Practice


1. BREAST CANCER

Most common cancer in women worldwide.

Key OPD Presentation

  • Painless breast lump (most common complaint)
  • Nipple discharge (bloody or serous)
  • Skin changes: peau d'orange, dimpling, nipple retraction
  • Axillary lymphadenopathy
  • In pregnancy: milk rejection sign (infant refuses one breast)

Risk Factors

  • Female sex, age >40
  • Family history (BRCA1/BRCA2 mutations)
  • Early menarche, late menopause, nulliparity
  • Hormone replacement therapy, oral contraceptives
  • Prior breast biopsy showing atypical hyperplasia

Types

TypeDetails
Invasive ductal carcinoma (IDC)Most common (~70-80%)
Invasive lobular carcinoma (ILC)~10%, often bilateral
DCIS (Ductal carcinoma in situ)Pre-invasive, detected on mammogram
Inflammatory breast cancerRare but aggressive; presents as red, warm, swollen breast

Work-up in OPD

  • Mammography + USG breast
  • FNAC or core needle biopsy
  • ER/PR/HER2 receptor status
  • Staging CT scan, bone scan if indicated

Biomarker subtypes (for treatment planning)

  • Luminal A (ER+/PR+, HER2-) - best prognosis
  • HER2-enriched (HER2+) - targeted therapy with trastuzumab
  • Triple Negative (ER-/PR-/HER2-) - worst prognosis, chemotherapy only
  • Robbins, Cotran & Kumar Pathologic Basis of Disease, p. 954

2. LUNG CANCER

Leading cause of cancer death in both men and women.

Key OPD Presentation

  • Persistent cough, hemoptysis
  • Weight loss, fatigue, anorexia
  • Chest pain, breathlessness
  • Neurological symptoms (headache, weakness) if brain metastasis
  • Supraclavicular lymphadenopathy

Risk Factors

  • Cigarette smoking (#1 cause - ~85% of cases)
  • Asbestos, radon gas, arsenic exposure
  • Family history

Types

TypeFrequencyFeatures
AdenocarcinomaMost common overallPeripheral, non-smokers, EGFR/ALK mutations
Squamous cell carcinoma~25%Central, smoker, cavitating
Small cell carcinoma (SCLC)~15%Highly aggressive, paraneoplastic syndromes
Large cell carcinoma~10%Peripheral, poor differentiation

OPD Work-up

  • Chest X-ray, followed by CT chest
  • PET scan for staging
  • Bronchoscopy with biopsy, or CT-guided FNA for peripheral lesions
  • Sputum cytology (specificity 99% but low sensitivity)
  • Molecular testing: EGFR, ALK, ROS1, KRAS, PD-L1 (guides targeted therapy)
  • Mulholland and Greenfield's Surgery, p. 3910

3. COLORECTAL CANCER (CRC)

#2 cancer cause of death; often preventable with screening.

Key OPD Presentation

  • Rectal bleeding (bright red or dark), melena
  • Change in bowel habits (new onset constipation or diarrhea)
  • Lower abdominal pain or cramping
  • Iron deficiency anemia (unexplained)
  • Palpable abdominal or rectal mass
  • Weight loss, fatigue
Important: Many patients are asymptomatic in early stages - detected on routine screening. Symptoms arise when tumor grows into bowel lumen or invades adjacent structures. CRC is often misdiagnosed as hemorrhoids, IBS, or diverticular disease in the OPD. - Goldman-Cecil Medicine

Risk Factors

  • Age >50, family history of CRC or polyps
  • Inflammatory bowel disease (ulcerative colitis, Crohn's)
  • High-fat, low-fiber diet, red/processed meat
  • Obesity, smoking, alcohol
  • Hereditary syndromes: FAP (familial adenomatous polyposis), Lynch syndrome (HNPCC)

OPD Work-up

  • Digital rectal exam (DRE) - mandatory
  • Colonoscopy - gold standard
  • CEA (carcinoembryonic antigen) - tumor marker for monitoring
  • CT scan abdomen/pelvis for staging

4. CERVICAL CANCER

Most preventable gynecologic cancer - caused by HPV.

Key OPD Presentation

  • Postcoital bleeding (most common early symptom)
  • Intermenstrual or postmenopausal bleeding
  • Foul-smelling vaginal discharge
  • Pelvic pain (late stage)
  • Bladder/rectal symptoms if locally advanced

Risk Factors

  • HPV infection (types 16 and 18 cause ~70% of cases)
  • Multiple sexual partners, early sexual debut
  • Smoking, immunosuppression (HIV)
  • Non-compliance with Pap smear screening

Prevention

  • HPV vaccination (before sexual debut - most effective)
  • Pap smear (every 3 years from age 21, or every 5 years with HPV co-test from age 30)

Work-up

  • Pap smear / LBC (liquid-based cytology)
  • Colposcopy + biopsy if abnormal
  • FIGO staging (clinical exam + imaging)

5. ORAL / HEAD & NECK CANCER

Extremely common in South Asia due to tobacco and betel nut use.

Key OPD Presentation

  • Non-healing ulcer in mouth (>2 weeks)
  • Red (erythroplakia) or white (leukoplakia) patch - pre-malignant
  • Lump or swelling in mouth, jaw, or neck
  • Difficulty swallowing or chewing
  • Hoarseness, change in voice (larynx involvement)
  • Trismus (difficulty opening mouth)

Risk Factors

  • Tobacco (smoking + chewing) - #1 risk factor
  • Alcohol - synergistic with tobacco (multiplicative effect)
  • Betel nut / pan masala - major risk in South/Southeast Asia
  • HPV (especially oropharyngeal cancer - rising incidence)
"The two most important factors in the aetiology of head and neck cancer are tobacco and alcohol. There is a synergistic interaction between these two agents that is multiplicative." - Scott-Brown's Otorhinolaryngology, p. 1172
Over 90% of oral cancers are squamous cell carcinomas. - Tintinalli's Emergency Medicine

6. THYROID CANCER

Most common endocrine malignancy; usually presents as a neck lump.

Key OPD Presentation

  • Painless thyroid nodule (most common)
  • Rapidly enlarging neck mass
  • Hoarseness (recurrent laryngeal nerve invasion)
  • Dysphagia, dyspnea (tracheal or esophageal compression)
  • Hard, fixed mass suggests malignancy

Types

TypeFrequencyPrognosis
Papillary~80%Excellent (>95% 10-yr survival)
Follicular~10-15%Good (hematogenous spread to bone/lung)
Medullary~3-5%Moderate; secretes calcitonin
Anaplastic<5%Very poor (months survival)

OPD Work-up

  • TSH + Free T4
  • Neck USG (assess nodule characteristics)
  • FNAC of nodule
  • Serum calcitonin (if medullary suspected)
  • Bethesda system guides management of FNAC results

7. PROSTATE CANCER

Most common cancer in men in the West.

Key OPD Presentation

  • Often asymptomatic in early stage (incidental PSA elevation)
  • Lower urinary tract symptoms (LUTS): hesitancy, weak stream, nocturia
  • Bone pain, pathological fracture (if metastatic to bone)
  • Elevated PSA on screening

Work-up

  • PSA (Prostate-Specific Antigen)
  • Digital rectal exam (DRE) - hard, nodular, asymmetric prostate
  • Transrectal USG (TRUS) + biopsy
  • Gleason score (histological grading)

Quick Reference OPD Summary Table

CancerClassic OPD Complaint#1 Risk FactorKey Investigation
BreastPainless lumpAge + geneticsMammography + biopsy
LungCough + hemoptysis + weight lossSmokingCT chest + bronchoscopy
ColorectalRectal bleed + bowel change + anemiaDiet + age >50Colonoscopy
CervicalPost-coital bleedHPVPap smear + colposcopy
OralNon-healing ulcerTobacco + alcoholBiopsy
ThyroidNeck swellingRadiation exposureUSG + FNAC
ProstateLUTS + bone painAge + family historyPSA + biopsy

Red flag symptoms for ANY cancer in OPD:
  • Unexplained weight loss (>10% body weight in 6 months)
  • Unexplained iron deficiency anemia
  • Persistent fatigue without obvious cause
  • Non-healing ulcer or wound
  • Painless lump anywhere
  • Any bleeding from orifice without clear cause
These warrant urgent investigation rather than empirical treatment.

Make a diagnostic algorithm flowchart for common cancer presentations

Running Command

ls /tmp/workspace/ 2>/dev/null || mkdir -p /tmp/workspace/cancer-flowchart

Running Command

mkdir -p /tmp/workspace/cancer-flowchart

Writing File

~/cancer-flowchart/flowchart.py

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import FancyBboxPatch, FancyArrowPatch

fig, ax = plt.subplots(figsize=(28, 38))
ax.set_xlim(0, 28)
ax.set_ylim(0, 38)
ax.axis('off')
fig.patch.set_facecolor('#F8F9FA')

# ─── COLOUR PALETTE ───────────────────────────────────────────────
C_TITLE   = '#1A237E'   # deep navy
C_START   = '#1565C0'   # blue  – entry node
C_SYMPTOM = '#0277BD'   # mid-blue – symptom boxes
C_INVEST  = '#00838F'   # teal – investigation
C_CANCER  = '#BF360C'   # brick-red – cancer type boxes
C_STAGE   = '#6A1B9A'   # purple – staging
C_TREAT   = '#2E7D32'   # green – treatment
C_REFER   = '#F57F17'   # amber – referral / flags
C_WHITE   = '#FFFFFF'
C_LTGRAY  = '#ECEFF1'

def box(ax, x, y, w, h, text, fc, tc='white', fs=9, bold=False,
        radius=0.35, ec=None, lw=1.5, va='center', wrap=False):
    ec = ec or fc
    fancy = FancyBboxPatch((x - w/2, y - h/2), w, h,
                            boxstyle=f"round,pad=0.05,rounding_size={radius}",
                            facecolor=fc, edgecolor=ec, linewidth=lw, zorder=3)
    ax.add_patch(fancy)
    weight = 'bold' if bold else 'normal'
    ax.text(x, y, text, ha='center', va=va, fontsize=fs, color=tc,
            fontweight=weight, zorder=4,
            wrap=wrap,
            multialignment='center')

def diamond(ax, x, y, w, h, text, fc, tc='white', fs=8.5):
    dx, dy = w/2, h/2
    coords = [(x, y+dy), (x+dx, y), (x, y-dy), (x-dx, y)]
    poly = plt.Polygon(coords, closed=True, facecolor=fc, edgecolor=fc, linewidth=1.5, zorder=3)
    ax.add_patch(poly)
    ax.text(x, y, text, ha='center', va='center', fontsize=fs, color=tc,
            fontweight='bold', zorder=4, multialignment='center')

def arrow(ax, x1, y1, x2, y2, color='#455A64', lw=1.5, style='->', label=''):
    ax.annotate('', xy=(x2, y2), xytext=(x1, y1),
                arrowprops=dict(arrowstyle=style, color=color, lw=lw),
                zorder=2)
    if label:
        mx, my = (x1+x2)/2, (y1+y2)/2
        ax.text(mx+0.15, my, label, fontsize=7.5, color=color, fontstyle='italic')

# ══════════════════════════════════════════════════════
# TITLE
# ══════════════════════════════════════════════════════
ax.add_patch(FancyBboxPatch((0.3, 36.5), 27.4, 1.3,
             boxstyle="round,pad=0.1", facecolor=C_TITLE, edgecolor=C_TITLE, zorder=3))
ax.text(14, 37.15, 'DIAGNOSTIC ALGORITHM FOR COMMON CANCER PRESENTATIONS',
        ha='center', va='center', fontsize=15, color='white', fontweight='bold', zorder=4)
ax.text(14, 36.7, 'OPD / Primary Care Setting  |  Orris Medical Reference',
        ha='center', va='center', fontsize=9, color='#B3C5EF', zorder=4)

# ══════════════════════════════════════════════════════
# ENTRY  (top-centre)
# ══════════════════════════════════════════════════════
box(ax, 14, 35.6, 7, 0.7,
    'PATIENT PRESENTS TO OPD WITH SYMPTOMS / COMPLAINT',
    C_START, fs=10, bold=True)

arrow(ax, 14, 35.25, 14, 34.65)

# RED FLAG SCREEN
box(ax, 14, 34.3, 9, 0.65,
    'RED FLAG SYMPTOM SCREEN  (weight loss · unexplained anaemia · non-healing ulcer · painless lump · unexplained bleeding)',
    C_REFER, fs=8, bold=True, tc='white')

# YES / NO branches
arrow(ax, 9.5, 34.3,  5, 34.3, color=C_REFER, label='NO red flags')
arrow(ax, 18.5, 34.3, 23, 34.3, color=C_CANCER, label='RED FLAGS present')

box(ax,  3.5, 34.3, 2.8, 0.6, 'Routine management\n& reassess in 4 wks', C_LTGRAY, tc='#37474F', fs=8)
box(ax, 24.5, 34.3, 2.8, 0.6, 'URGENT REFERRAL\nto oncology / specialist', C_CANCER, fs=8, bold=True)

arrow(ax, 14, 33.97, 14, 33.2)

# ══════════════════════════════════════════════════════
# PRESENTING SYMPTOM TRIAGE  (wide row)
# ══════════════════════════════════════════════════════
box(ax, 14, 32.85, 9, 0.65,
    'IDENTIFY PRESENTING SYMPTOM CLUSTER  →  Route to cancer-specific pathway',
    C_SYMPTOM, fs=9, bold=True)

# 6 symptom branches  x-positions
SX = [2.2, 6.4, 10.6, 14.8, 19.0, 23.2]
SY_TOP = 32.0
SY_BOX = 31.5

symptom_labels = [
    'Breast lump /\nnipple discharge',
    'Cough · haemo-\nptysis · wt loss',
    'Rectal bleed ·\nbowel change',
    'Post-coital /\nvaginal bleed',
    'Neck / thyroid\nswelling',
    'Oral ulcer >\n2 weeks / LUTS'
]
sym_colors = [C_SYMPTOM]*6

for sx, sl in zip(SX, symptom_labels):
    arrow(ax, 14, 32.52, sx, SY_TOP+0.03)
    box(ax, sx, SY_BOX, 3.6, 0.8, sl, C_SYMPTOM, fs=8, bold=True)

# ══════════════════════════════════════════════════════
# COLUMN HEADERS (cancer labels)
# ══════════════════════════════════════════════════════
cancer_names = ['BREAST\nCANCER', 'LUNG\nCANCER', 'COLORECTAL\nCANCER',
                'CERVICAL\nCANCER', 'THYROID\nCANCER', 'ORAL / PROSTATE\nCANCER']

CY_LABEL = 30.6
for sx, cn in zip(SX, cancer_names):
    arrow(ax, sx, SY_BOX - 0.4, sx, CY_LABEL + 0.35)
    box(ax, sx, CY_LABEL, 3.6, 0.65, cn, C_CANCER, fs=8.5, bold=True)

# ══════════════════════════════════════════════════════
# HISTORY & EXAMINATION  row
# ══════════════════════════════════════════════════════
hx_data = [
    'Age, family hx\nBRCA1/2\nHRT use',
    'Smoking hx\nOccupational\nexposure',
    'Family hx, IBD\nDiet, age >50\nFAP / Lynch',
    'Sexual hx, HPV\nvaccine status\nPap smear hx',
    'Radiation hx\nFamily hx MEN\nRapid growth',
    'Tobacco/alcohol\nBetel nut\nPSA if male'
]

HY = 29.3
for sx, hd in zip(SX, hx_data):
    arrow(ax, sx, CY_LABEL-0.33, sx, HY+0.42)
    box(ax, sx, HY, 3.6, 0.78, 'HISTORY\n' + hd, C_LTGRAY, tc='#1A237E', fs=7.5, bold=False, ec='#90A4AE')

# ══════════════════════════════════════════════════════
# PHYSICAL EXAMINATION
# ══════════════════════════════════════════════════════
pe_data = [
    'Lump: size/\nfixity/skin\nAxilla nodes',
    'Chest auscult.\nSupraclav.\nnodes',
    'PR exam\nAbdominal\nmass, ascites',
    'Speculum +\nBimanual exam\nCervix inspect.',
    'Thyroid size\nfixity, LN\nVoice change',
    'Oral inspection\nDRE (prostate)\nNeck nodes'
]

PE_Y = 28.05
for sx, pd in zip(SX, pe_data):
    arrow(ax, sx, HY-0.39, sx, PE_Y+0.42)
    box(ax, sx, PE_Y, 3.6, 0.78, 'EXAMINATION\n' + pd, C_LTGRAY, tc='#1A237E', fs=7.5, ec='#90A4AE')

# ══════════════════════════════════════════════════════
# FIRST-LINE INVESTIGATIONS
# ══════════════════════════════════════════════════════
inv1_data = [
    'Mammogram\n+ USG breast\nFNAC / CNB',
    'CXR\nCT chest\nSputum cytol.',
    'Colonoscopy\n(gold std)\nCEA level',
    'Pap smear\nColposcopy\n+ biopsy',
    'TSH + fT4\nNeck USG\nFNAC nodule',
    'OPG / biopsy\nPSA (prostate)\nNeck USG'
]

INV1_Y = 26.75
for sx, iv in zip(SX, inv1_data):
    arrow(ax, sx, PE_Y-0.39, sx, INV1_Y+0.45)
    box(ax, sx, INV1_Y, 3.6, 0.84, '1st LINE TESTS\n' + iv, C_INVEST, fs=7.5)

# ══════════════════════════════════════════════════════
# BIOPSY / HISTOLOGY CONFIRMATION
# ══════════════════════════════════════════════════════
bx_data = [
    'Core needle bx\nER/PR/HER2\nGrade',
    'Bronchoscopy bx\nCT-guided FNA\nMol: EGFR/ALK',
    'Colonoscopic bx\nMSI/KRAS/BRAF\nstatus',
    'Cervical punch\nbiopsy\nHPV typing',
    'FNAC (Bethesda)\nCore bx if\nindeterminate',
    'Incisional bx\nGleason score\n(prostate)'
]

BX_Y = 25.35
for sx, bx in zip(SX, bx_data):
    arrow(ax, sx, INV1_Y-0.42, sx, BX_Y+0.45)
    box(ax, sx, BX_Y, 3.6, 0.84, 'BIOPSY / HISTOLOGY\n' + bx, C_INVEST, fs=7.5)

# ══════════════════════════════════════════════════════
# STAGING INVESTIGATIONS
# ══════════════════════════════════════════════════════
stg_data = [
    'CT CAP\nBone scan\nPET (if HER2+)',
    'PET-CT\nBrain MRI\nLFTs/LDH',
    'CT abd/pelvis\nCXR\nLFTs',
    'MRI pelvis\nCystoscopy\nIVU (FIGO)',
    'CT neck/chest\nCalcitonin\n(medullary)',
    'PET/CT\nPSA + bone\nscan if PSA>20'
]

STG_Y = 23.95
for sx, sg in zip(SX, stg_data):
    arrow(ax, sx, BX_Y-0.42, sx, STG_Y+0.45)
    box(ax, sx, STG_Y, 3.6, 0.84, 'STAGING\n' + sg, C_STAGE, fs=7.5)

# ══════════════════════════════════════════════════════
# TNM STAGE GROUP  (merges all 6 columns)
# ══════════════════════════════════════════════════════
TNM_Y = 22.7
for sx in SX:
    arrow(ax, sx, STG_Y-0.42, sx, TNM_Y+0.38)

box(ax, 14, TNM_Y, 25.5, 0.7,
    'ASSIGN TNM STAGE GROUP   |   Stage I  •  Stage II  •  Stage III  •  Stage IV',
    C_STAGE, fs=10, bold=True)

arrow(ax, 14, TNM_Y-0.35, 14, 21.9)

# ══════════════════════════════════════════════════════
# STAGE DECISION DIAMOND
# ══════════════════════════════════════════════════════
diamond(ax, 14, 21.45, 5, 0.85, 'Stage?', C_STAGE, fs=9)

# branches
arrow(ax, 11.5, 21.45,  5.2, 21.45, color=C_TREAT, label='Stage I–II')
arrow(ax, 16.5, 21.45, 23.2, 21.45, color=C_CANCER, label='Stage III–IV')
arrow(ax, 14, 21.02, 14, 20.3,  color='#546E7A', label='')

# ══════════════════════════════════════════════════════
# TREATMENT BLOCKS  (3 columns)
# ══════════════════════════════════════════════════════
# Early stage (left)
box(ax, 3.8, 21.45, 5.5, 0.72,
    'EARLY STAGE  (I – II)\nSurgery ± Adjuvant chemo/RT\nCurative intent',
    C_TREAT, fs=8.5, bold=True)

# Advanced stage (right)
box(ax, 24.2, 21.45, 5.5, 0.72,
    'ADVANCED STAGE  (III – IV)\nNeoadjuvant / Palliative\nMultidisciplinary approach',
    C_CANCER, fs=8.5, bold=True)

# Tumour board (centre-below diamond)
box(ax, 14, 20.0, 12, 0.62,
    'MULTIDISCIPLINARY TUMOUR BOARD  (Surgery · Oncology · Radiology · Pathology · Palliative Care)',
    '#37474F', fs=8.5, bold=True)

arrow(ax, 14, 19.69, 14, 18.95)

# ══════════════════════════════════════════════════════
# TREATMENT MODALITIES  (5 boxes in a row)
# ══════════════════════════════════════════════════════
tx_labels = [
    'SURGERY\n• Wide excision\n• Lymph node dissection\n• Reconstructive options',
    'RADIOTHERAPY\n• External beam (EBRT)\n• Brachytherapy\n• Stereotactic (SBRT)',
    'CHEMOTHERAPY\n• Neoadjuvant / Adjuvant\n• Palliative intent\n• Regimen by cancer type',
    'TARGETED /\nIMMUNOTHERAPY\n• Anti-HER2 (trastuzumab)\n• EGFR / ALK inhibitors\n• Checkpoint inhibitors',
    'HORMONAL\nTHERAPY\n• ER+ breast (tamoxifen)\n• Prostate (LHRH agonist)\n• Thyroid (TSH suppression)'
]
TX_X = [3.5, 8.2, 14.0, 19.8, 24.5]
TX_Y = 18.3
for tx, tl in zip(TX_X, tx_labels):
    arrow(ax, 14, 18.95, tx, TX_Y+0.55)
    box(ax, tx, TX_Y, 4.4, 1.0, tl, C_TREAT, fs=7.5)

arrow(ax, 14, TX_Y-0.5, 14, 17.15)

# ══════════════════════════════════════════════════════
# RESPONSE ASSESSMENT
# ══════════════════════════════════════════════════════
box(ax, 14, 16.85, 14, 0.55,
    'RESPONSE ASSESSMENT  (repeat imaging · tumour markers · clinical exam)  after 2–3 cycles / post-surgery',
    '#455A64', fs=8.5, bold=True)

# 3 outcomes
RES_X = [5.5, 14, 22.5]
RES_LABELS = ['COMPLETE\nRESPONSE', 'PARTIAL / STABLE\nDISEASE', 'PROGRESSIVE\nDISEASE']
RES_COLORS = [C_TREAT, C_INVEST, C_CANCER]
RES_Y = 15.85

for rx, rl, rc in zip(RES_X, RES_LABELS, RES_COLORS):
    arrow(ax, 14, 16.58, rx, RES_Y+0.3)
    box(ax, rx, RES_Y, 4.2, 0.56, rl, rc, fs=8, bold=True)

# sub-actions
sub_actions = [
    'Surveillance\nprogram\n(scheduled follow-up)',
    'Continue ±\nmodify regimen\n(dose / add agent)',
    'Switch to 2nd line\nPalliative / BSC\nClinical trial'
]
SUB_Y = 14.75
for rx, sa, rc in zip(RES_X, sub_actions, RES_COLORS):
    arrow(ax, rx, RES_Y-0.28, rx, SUB_Y+0.38)
    box(ax, rx, SUB_Y, 4.2, 0.72, sa, rc, fs=8, ec=rc)

arrow(ax, 14, SUB_Y-0.36, 14, 13.8)

# ══════════════════════════════════════════════════════
# FOLLOW-UP / SURVEILLANCE
# ══════════════════════════════════════════════════════
box(ax, 14, 13.55, 25, 0.48,
    'FOLLOW-UP & SURVEILLANCE  –  Tumour markers · Imaging · Clinical exam · Toxicity monitoring · Psychosocial support',
    '#37474F', fs=8.5, bold=True)

# ══════════════════════════════════════════════════════
# CANCER-SPECIFIC QUICK-REF TABLE  (bottom section)
# ══════════════════════════════════════════════════════
box(ax, 14, 12.85, 27, 0.45,
    'CANCER-SPECIFIC QUICK REFERENCE',
    C_TITLE, fs=9, bold=True)

# Table header row
cols = ['CANCER', 'KEY SYMPTOM', 'RISK FACTOR #1', '1st LINE TEST', 'TUMOUR MARKER', '5-YR SURVIVAL (Stage I)']
col_x = [1.5, 5.5, 9.8, 13.8, 18.0, 22.5]
COL_W = [2.6, 3.5, 3.8, 3.6, 3.6, 4.5]
HDR_Y = 12.25
for cx, cw, cl in zip(col_x, COL_W, cols):
    box(ax, cx, HDR_Y, cw, 0.45, cl, '#37474F', fs=8, bold=True, radius=0.1)

# Table rows
rows = [
    ['Breast',       'Painless lump',         'Age / BRCA mutation',  'Mammogram + CNB',  'CA 15-3',   '~99%'],
    ['Lung',         'Cough + haemoptysis',   'Cigarette smoking',    'CT chest',         'CEA / NSE', '~60%'],
    ['Colorectal',   'Rectal bleed / anaemia','Diet + age >50',       'Colonoscopy',      'CEA',       '~90%'],
    ['Cervical',     'Post-coital bleed',     'HPV 16 / 18',         'Pap smear',        'SCC Ag',    '~92%'],
    ['Thyroid',      'Neck nodule',           'Radiation exposure',   'USG + FNAC',       'Thyroglobulin','~99%'],
    ['Oral',         'Non-healing ulcer',     'Tobacco + alcohol',   'Biopsy',           'SCC Ag',    '~83%'],
    ['Prostate',     'LUTS / bone pain',      'Age + family history', 'PSA + DRE + bx',  'PSA',       '~99%'],
]

ROW_COLORS = ['#E3F2FD','#E8F5E9','#FFF3E0','#FCE4EC','#EDE7F6','#E0F7FA','#F9FBE7']
ROW_H = 0.44
row_y = HDR_Y - ROW_H * 0.6
for i, (row, rc) in enumerate(zip(rows, ROW_COLORS)):
    row_y -= ROW_H
    for cx, cw, cell in zip(col_x, COL_W, row):
        box(ax, cx, row_y, cw, ROW_H-0.03, cell, rc, tc='#1A237E', fs=8, radius=0.08, ec='#CFD8DC', lw=0.8)

# ══════════════════════════════════════════════════════
# LEGEND  (bottom)
# ══════════════════════════════════════════════════════
legend_items = [
    (C_SYMPTOM, 'Symptom / Clinical step'),
    (C_INVEST,  'Investigation'),
    (C_CANCER,  'Cancer diagnosis / Advanced'),
    (C_STAGE,   'Staging'),
    (C_TREAT,   'Treatment / Good outcome'),
    (C_REFER,   'Red flags / Urgent action'),
]
LX, LY = 1.0, 0.55
for i, (lc, lt) in enumerate(legend_items):
    bx = LX + i * 4.5
    ax.add_patch(FancyBboxPatch((bx, LY), 0.55, 0.35, boxstyle="round,pad=0.05",
                                facecolor=lc, edgecolor=lc, zorder=4))
    ax.text(bx + 0.7, LY + 0.175, lt, fontsize=8, va='center', color='#37474F', zorder=4)

ax.text(14, 0.2, 'Orris Medical Reference  |  Based on AJCC 8th Edition, Harrison\'s 22e, Robbins Pathology, Schwartz Surgery',
        ha='center', va='center', fontsize=7.5, color='#90A4AE')

plt.tight_layout(pad=0.2)
plt.savefig('/tmp/workspace/cancer-flowchart/cancer_diagnostic_algorithm.png',
            dpi=180, bbox_inches='tight', facecolor='#F8F9FA')
print("Saved successfully")
Running Command

cd /tmp/workspace/cancer-flowchart && python flowchart.py

Here is your diagnostic algorithm flowchart:

cancer diagnostic algorithm

Image · PNG


What the flowchart covers (top to bottom):
  1. Entry point - Patient walks into OPD with a complaint
  2. Red flag screen - Immediate triage: weight loss, unexplained anaemia, non-healing ulcer, painless lump, unexplained bleeding
    • No red flags → routine management
    • Red flags present → urgent referral
  3. Symptom cluster triage - Routes patient into one of 6 cancer-specific pathways:
    • Breast | Lung | Colorectal | Cervical | Thyroid | Oral/Prostate
  4. Parallel columns for each cancer - History → Examination → 1st-line Tests → Biopsy/Histology → Staging
  5. TNM Stage assignment - All paths merge into stage grouping (I-IV)
  6. Treatment decision - Stage I-II (surgery ± adjuvant, curative intent) vs Stage III-IV (neoadjuvant/palliative)
  7. Multidisciplinary tumour board
  8. Treatment modalities - Surgery, Radiotherapy, Chemotherapy, Targeted/Immunotherapy, Hormonal therapy
  9. Response assessment - Complete response / Partial-stable / Progressive disease
  10. Follow-up & surveillance
  11. Quick reference table at the bottom with key symptom, risk factor, test, marker, and 5-year survival for each cancer type
This is a shared conversation. Sign in to Orris to start your own chat.