https://youtu.be/41rLAXnlVq4?si=9q28_TbmZ1Vpbdi4

analyse_media
Searching the Web

youtube 41rLAXnlVq4

That's the Ninja Nerd "Lung Cancer | Clinical Medicine" lecture by Professor Zach Murphy. What would you like to do with it?
Here are some things I can help you with based on that video:
  • Summarize the key concepts covered (types of lung cancer, staging, diagnosis, treatment)
  • Create study notes or a structured outline
  • Make flashcards for exam prep
  • Answer specific questions about lung cancer topics from the lecture
  • Find supporting medical literature or textbook references on any topic from the video
What are you looking for?

Create a study guide document from this lecture

Asking for Preferences
Reading File
Reading File
Finding Sources
Searching the Web

Ninja Nerd lung cancer lecture topics outline NSCLC SCLC staging treatment

Finding Sources
Finding Sources
Reading Web Page

https://www.classcentral.com/course/youtube-lung-cancer-clin…

Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/lung-cancer-study-guide && ls /home/daytona/workspace/lung-cancer-study-guide/

Writing File

~/lung-cancer-study-guide/generate_study_guide.py

from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch
from reportlab.lib.colors import HexColor, white, black
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.lib import colors

OUTPUT_PATH = "/home/daytona/workspace/lung-cancer-study-guide/Lung_Cancer_Study_Guide.pdf"

# Colors
DARK_BLUE = HexColor("#1a3a5c")
MID_BLUE  = HexColor("#2c6fad")
LIGHT_BLUE = HexColor("#dce8f5")
ACCENT_RED = HexColor("#c0392b")
ACCENT_GREEN = HexColor("#1e8449")
ACCENT_ORANGE = HexColor("#d35400")
LIGHT_GRAY = HexColor("#f2f4f6")
MED_GRAY  = HexColor("#7f8c8d")
YELLOW_HL = HexColor("#fff9c4")

doc = SimpleDocTemplate(
    OUTPUT_PATH,
    pagesize=letter,
    rightMargin=0.75*inch,
    leftMargin=0.75*inch,
    topMargin=0.75*inch,
    bottomMargin=0.75*inch,
    title="Lung Cancer Study Guide – Ninja Nerd Clinical Medicine",
    author="Orris AI"
)

styles = getSampleStyleSheet()

# Custom styles
def s(name, **kwargs):
    return ParagraphStyle(name, **kwargs)

title_style = s("Title2", fontSize=26, textColor=white, fontName="Helvetica-Bold",
                alignment=TA_CENTER, spaceAfter=4, leading=30)
subtitle_style = s("Subtitle2", fontSize=12, textColor=HexColor("#cde4f7"),
                   fontName="Helvetica", alignment=TA_CENTER, spaceAfter=0)

h1 = s("H1", fontSize=15, textColor=white, fontName="Helvetica-Bold",
        backColor=DARK_BLUE, borderPadding=(6, 10, 6, 10),
        spaceAfter=10, spaceBefore=16, leading=18)
h2 = s("H2", fontSize=12, textColor=DARK_BLUE, fontName="Helvetica-Bold",
        spaceAfter=6, spaceBefore=10, leading=15, borderPadding=(0,0,2,0))
h3 = s("H3", fontSize=10.5, textColor=MID_BLUE, fontName="Helvetica-Bold",
        spaceAfter=4, spaceBefore=8, leading=13)

body = s("Body2", fontSize=9.5, fontName="Helvetica", leading=14,
          spaceAfter=4, textColor=HexColor("#1c1c1c"), alignment=TA_JUSTIFY)
bullet = s("Bullet2", fontSize=9.5, fontName="Helvetica", leading=14,
            spaceAfter=3, leftIndent=14, bulletIndent=4, textColor=HexColor("#1c1c1c"))
subbullet = s("SubBullet2", fontSize=9, fontName="Helvetica", leading=13,
               spaceAfter=2, leftIndent=28, bulletIndent=14, textColor=HexColor("#333"))
bold_bullet = s("BoldBullet", fontSize=9.5, fontName="Helvetica-Bold", leading=14,
                 spaceAfter=3, leftIndent=14, bulletIndent=4, textColor=DARK_BLUE)
callout = s("Callout", fontSize=9, fontName="Helvetica-Oblique", leading=13,
             spaceAfter=4, textColor=HexColor("#333"), backColor=LIGHT_BLUE,
             borderPadding=(6,8,6,8), borderRadius=4)
warn = s("Warn", fontSize=9, fontName="Helvetica-Oblique", leading=13,
          spaceAfter=4, textColor=HexColor("#5d2000"), backColor=HexColor("#fce8d4"),
          borderPadding=(6,8,6,8))
key_fact = s("KeyFact", fontSize=9, fontName="Helvetica-Bold", leading=13,
              spaceAfter=3, textColor=ACCENT_RED, leftIndent=14)

story = []

# ─────────────────────────────────────────────
# TITLE BANNER (drawn as a colored table)
# ─────────────────────────────────────────────
banner_data = [[
    Paragraph("LUNG CANCER", title_style),
],[
    Paragraph("Clinical Medicine Study Guide  |  Based on Ninja Nerd Lecture by Prof. Zach Murphy", subtitle_style),
]]
banner = Table(banner_data, colWidths=[7*inch])
banner.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
    ("TOPPADDING",    (0,0), (-1,-1), 18),
    ("BOTTOMPADDING", (0,0), (-1,-1), 14),
    ("LEFTPADDING",   (0,0), (-1,-1), 12),
    ("RIGHTPADDING",  (0,0), (-1,-1), 12),
    ("ROWBACKGROUNDS",(0,0),(-1,-1),[DARK_BLUE]),
]))
story.append(banner)
story.append(Spacer(1, 10))

# Quick-reference info bar
qr_data = [[
    Paragraph("<b>Source:</b> Ninja Nerd – Lung Cancer (Clinical Medicine)", body),
    Paragraph("<b>Duration:</b> ~2h 24min", body),
    Paragraph("<b>Topic:</b> Oncology / Pulmonology", body),
]]
qr = Table(qr_data, colWidths=[2.5*inch, 2*inch, 2.5*inch])
qr.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), LIGHT_BLUE),
    ("TOPPADDING",    (0,0),(-1,-1), 6),
    ("BOTTOMPADDING", (0,0),(-1,-1), 6),
    ("LEFTPADDING",   (0,0),(-1,-1), 8),
    ("RIGHTPADDING",  (0,0),(-1,-1), 8),
    ("GRID", (0,0), (-1,-1), 0.5, MID_BLUE),
]))
story.append(qr)
story.append(Spacer(1, 14))

# ─────────────────────────────────────────────
# TABLE OF CONTENTS
# ─────────────────────────────────────────────
def section_banner(text):
    t = Table([[Paragraph(text, h1)]], colWidths=[7*inch])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0),(-1,-1), DARK_BLUE),
        ("TOPPADDING",    (0,0),(-1,-1), 4),
        ("BOTTOMPADDING", (0,0),(-1,-1), 4),
        ("LEFTPADDING",   (0,0),(-1,-1), 10),
        ("RIGHTPADDING",  (0,0),(-1,-1), 10),
    ]))
    return t

def subsection_banner(text, color=MID_BLUE):
    style = s("SubBanner", fontSize=11, textColor=white, fontName="Helvetica-Bold",
               leading=14)
    t = Table([[Paragraph(text, style)]], colWidths=[7*inch])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0),(-1,-1), color),
        ("TOPPADDING",    (0,0),(-1,-1), 4),
        ("BOTTOMPADDING", (0,0),(-1,-1), 4),
        ("LEFTPADDING",   (0,0),(-1,-1), 10),
    ]))
    return t

def p(text, style=body):
    return Paragraph(text, style)

def b(text):
    return Paragraph(f"• {text}", bullet)

def bb(text):
    return Paragraph(f"– {text}", subbullet)

def hr():
    return HRFlowable(width="100%", thickness=0.5, color=LIGHT_BLUE, spaceAfter=4, spaceBefore=4)

def callout_box(text):
    t = Table([[Paragraph(f"<b>Key Point:</b> {text}", callout)]], colWidths=[7*inch])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0),(-1,-1), LIGHT_BLUE),
        ("TOPPADDING",    (0,0),(-1,-1), 6),
        ("BOTTOMPADDING", (0,0),(-1,-1), 6),
        ("LEFTPADDING",   (0,0),(-1,-1), 8),
        ("RIGHTPADDING",  (0,0),(-1,-1), 8),
        ("BOX", (0,0),(-1,-1), 1, MID_BLUE),
    ]))
    return t

def warn_box(text):
    t = Table([[Paragraph(f"⚠ {text}", warn)]], colWidths=[7*inch])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0),(-1,-1), HexColor("#fce8d4")),
        ("TOPPADDING",    (0,0),(-1,-1), 6),
        ("BOTTOMPADDING", (0,0),(-1,-1), 6),
        ("LEFTPADDING",   (0,0),(-1,-1), 8),
        ("RIGHTPADDING",  (0,0),(-1,-1), 8),
        ("BOX", (0,0),(-1,-1), 1, ACCENT_ORANGE),
    ]))
    return t

# ──────────────────────────────────────────────────────────
# SECTION 1: EPIDEMIOLOGY & RISK FACTORS
# ──────────────────────────────────────────────────────────
story.append(section_banner("1.  EPIDEMIOLOGY & RISK FACTORS"))
story.append(Spacer(1,6))

story.append(p(
    "Lung cancer is the <b>leading cause of cancer death</b> in the United States (estimated 135,720 deaths in 2020) "
    "and worldwide. It accounts for more cancer deaths annually than colon, breast, and prostate cancers combined."
))
story.append(Spacer(1,4))

story.append(p("<b>Risk Factors", h2))

epi_data = [
    ["Risk Factor", "Details / Notes"],
    ["Cigarette smoking", "Strongest risk factor; responsible for >85–90% of cases. Risk correlates with pack-year history. Quitting reduces risk over time."],
    ["Passive smoke exposure", "Second-hand smoke is an established risk factor."],
    ["Asbestos exposure", "Synergistic effect with smoking; also causes mesothelioma."],
    ["Radon gas", "Radioactive gas from soil/rocks; #2 cause in non-smokers."],
    ["Other carcinogens", "Arsenic, chromium, nickel, polycyclic aromatic hydrocarbons, diesel exhaust."],
    ["Prior radiation therapy", "e.g., chest XRT for lymphoma increases risk."],
    ["Genetic predisposition", "Family history, inherited mutations (e.g., EGFR germline). Adenocarcinoma more common in never-smokers, women, young adults."],
    ["COPD / pulmonary fibrosis", "Independent risk factor beyond smoking alone."],
]
t_epi = Table(epi_data, colWidths=[1.8*inch, 5.2*inch])
t_epi.setStyle(TableStyle([
    ("BACKGROUND",    (0,0),(-1,0), DARK_BLUE),
    ("TEXTCOLOR",     (0,0),(-1,0), white),
    ("FONTNAME",      (0,0),(-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0),(-1,-1), 9),
    ("ROWBACKGROUNDS",(0,1),(-1,-1),[white, LIGHT_GRAY]),
    ("GRID",          (0,0),(-1,-1), 0.4, MED_GRAY),
    ("VALIGN",        (0,0),(-1,-1), "TOP"),
    ("TOPPADDING",    (0,0),(-1,-1), 5),
    ("BOTTOMPADDING", (0,0),(-1,-1), 5),
    ("LEFTPADDING",   (0,0),(-1,-1), 6),
    ("RIGHTPADDING",  (0,0),(-1,-1), 6),
]))
story.append(t_epi)
story.append(Spacer(1, 8))

story.append(callout_box(
    "Screening: USPSTF recommends annual low-dose CT (LDCT) for adults aged 50–80 with ≥20 pack-year history "
    "who currently smoke or quit within the past 15 years."
))
story.append(Spacer(1, 14))

# ──────────────────────────────────────────────────────────
# SECTION 2: PATHOPHYSIOLOGY & CELL TYPES
# ──────────────────────────────────────────────────────────
story.append(section_banner("2.  PATHOPHYSIOLOGY & HISTOLOGIC TYPES"))
story.append(Spacer(1,6))

story.append(p(
    "Lung cancers arise from the bronchial epithelium or alveolar cells through accumulation of genetic mutations "
    "(oncogene activation, tumor-suppressor loss). The two major categories are <b>Non-Small-Cell Lung Cancer (NSCLC)</b> "
    "(~85%) and <b>Small-Cell Lung Cancer (SCLC)</b> (~15%). These differ fundamentally in behavior, staging, and treatment."
))
story.append(Spacer(1, 8))

# NSCLC subtypes table
story.append(subsection_banner("2A.  Non-Small-Cell Lung Cancer (NSCLC) – 85% of Cases"))
story.append(Spacer(1,6))

nsclc_data = [
    ["Subtype", "Frequency", "Location", "Key Features", "Associations"],
    ["Adenocarcinoma",
     "Most common (~40%)",
     "Peripheral lung; often subpleural",
     "Glandular differentiation; acinar, papillary, lepidic, solid patterns; mucin production. TTF-1(+), Napsin-A(+).",
     "Most common in never-smokers, women, young adults. Contains driver mutations (EGFR, ALK, ROS1, KRAS)."],
    ["Squamous Cell\nCarcinoma",
     "~25–30%",
     "Central (hilar/peribronchial); arises from bronchial epithelium",
     "Keratinization and/or intercellular bridges; sheets of cells. p40(+), p63(+). CK5/6(+).",
     "Strongly linked to smoking. Can cause hypercalcemia via PTHrP. May cavitate."],
    ["Large Cell\nCarcinoma",
     "<10%",
     "Any location, often peripheral",
     "Lacks features of SCC, adeno, or SCLC. Diagnosis of exclusion. Poor prognosis.",
     "Associated with smoking. Aggressive course."],
]
t_nsclc = Table(nsclc_data, colWidths=[1.3*inch, 1*inch, 1.3*inch, 2*inch, 1.4*inch])
t_nsclc.setStyle(TableStyle([
    ("BACKGROUND",    (0,0),(-1,0), MID_BLUE),
    ("TEXTCOLOR",     (0,0),(-1,0), white),
    ("FONTNAME",      (0,0),(-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0),(-1,-1), 8.5),
    ("ROWBACKGROUNDS",(0,1),(-1,-1),[white, LIGHT_GRAY]),
    ("GRID",          (0,0),(-1,-1), 0.4, MED_GRAY),
    ("VALIGN",        (0,0),(-1,-1), "TOP"),
    ("TOPPADDING",    (0,0),(-1,-1), 5),
    ("BOTTOMPADDING", (0,0),(-1,-1), 5),
    ("LEFTPADDING",   (0,0),(-1,-1), 5),
    ("RIGHTPADDING",  (0,0),(-1,-1), 5),
]))
story.append(t_nsclc)
story.append(Spacer(1, 10))

story.append(subsection_banner("2B.  Small-Cell Lung Cancer (SCLC) – 15% of Cases", color=ACCENT_RED))
story.append(Spacer(1,6))

story.append(p(
    "SCLC is a <b>high-grade neuroendocrine carcinoma</b> with neuroendocrine differentiation. It shows "
    "small cells with scant cytoplasm, finely granular ('salt-and-pepper') chromatin, absent or "
    "inconspicuous nucleoli, and a high mitotic count. Neuroendocrine markers: "
    "<b>CD56, synaptophysin, chromogranin, INSM1, NSE</b>."
))
story.append(Spacer(1,4))

sclc_data = [
    ["Feature", "SCLC"],
    ["Location", "Central (hilar), arises near large bronchi"],
    ["Growth rate", "Rapid; early mediastinal spread"],
    ["Metastasis", "Early and widespread – brain, liver, adrenal, bone"],
    ["Smoking association", "Very strongly associated with heavy smoking"],
    ["Staging system", "Limited (one hemithorax + ipsilateral nodes, can be in one RT port)\nvs. Extensive (beyond limited)"],
    ["Paraneoplastic syndromes", "SIADH (hyponatremia), Cushing syndrome (ectopic ACTH), Lambert-Eaton myasthenic syndrome (anti-VGCC)"],
    ["Treatment", "Chemotherapy (platinum + etoposide) ± immunotherapy (atezolizumab/durvalumab). Surgery rarely indicated."],
    ["Prognosis", "Very poor; median survival even with treatment is 15–20 months (limited) or 8–13 months (extensive)"],
]
t_sclc = Table(sclc_data, colWidths=[2*inch, 5*inch])
t_sclc.setStyle(TableStyle([
    ("BACKGROUND",    (0,0),(-1,0), ACCENT_RED),
    ("TEXTCOLOR",     (0,0),(-1,0), white),
    ("FONTNAME",      (0,0),(-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0),(-1,-1), 9),
    ("ROWBACKGROUNDS",(0,1),(-1,-1),[white, HexColor("#fef0ef")]),
    ("GRID",          (0,0),(-1,-1), 0.4, MED_GRAY),
    ("VALIGN",        (0,0),(-1,-1), "TOP"),
    ("TOPPADDING",    (0,0),(-1,-1), 5),
    ("BOTTOMPADDING", (0,0),(-1,-1), 5),
    ("LEFTPADDING",   (0,0),(-1,-1), 6),
]))
story.append(t_sclc)
story.append(Spacer(1, 10))

# IHC summary
story.append(p("<b>Immunohistochemistry Summary</b>", h2))
ihc_data = [
    ["Marker", "Adeno", "SCC", "SCLC", "Notes"],
    ["TTF-1", "+", "–", "+", "Adenocarcinoma and SCLC; excludes primary SCC"],
    ["Napsin-A", "+", "–", "–", ">90% of primary lung adenocarcinomas"],
    ["p40 / p63", "–", "+", "–", "Squamous differentiation marker"],
    ["CD56 / Synaptophysin / Chromogranin", "–", "–", "+", "Neuroendocrine markers for SCLC"],
    ["CK7", "+", "+/–", "+", "Broad; non-specific alone"],
    ["CK20", "–", "–", "–", "Positive in GI primaries; helps exclude metastasis"],
]
t_ihc = Table(ihc_data, colWidths=[2.4*inch, 0.7*inch, 0.7*inch, 0.7*inch, 2.5*inch])
t_ihc.setStyle(TableStyle([
    ("BACKGROUND",    (0,0),(-1,0), DARK_BLUE),
    ("TEXTCOLOR",     (0,0),(-1,0), white),
    ("FONTNAME",      (0,0),(-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0),(-1,-1), 8.5),
    ("ROWBACKGROUNDS",(0,1),(-1,-1),[white, LIGHT_GRAY]),
    ("GRID",          (0,0),(-1,-1), 0.4, MED_GRAY),
    ("TOPPADDING",    (0,0),(-1,-1), 5),
    ("BOTTOMPADDING", (0,0),(-1,-1), 5),
    ("LEFTPADDING",   (0,0),(-1,-1), 5),
]))
story.append(t_ihc)
story.append(Spacer(1, 14))

# ──────────────────────────────────────────────────────────
# SECTION 3: COMPRESSIVE EFFECTS
# ──────────────────────────────────────────────────────────
story.append(PageBreak())
story.append(section_banner("3.  COMPRESSIVE / LOCAL EFFECTS OF LUNG TUMORS"))
story.append(Spacer(1,6))

story.append(p(
    "Lung tumors cause symptoms either by direct local invasion/compression of adjacent structures "
    "or by obstruction of bronchi. Recognizing these patterns helps localize tumor type and location."
))
story.append(Spacer(1,6))

comp_data = [
    ["Structure Compressed / Invaded", "Clinical Effect", "Typical Tumor"],
    ["Recurrent laryngeal nerve (left)", "Hoarseness; vocal cord paralysis", "Left-sided central tumors, SCLC"],
    ["Superior vena cava (SVC)", "SVC syndrome: facial/arm swelling, plethora, JVD, headache", "SCLC or right-sided central NSCLC"],
    ["Brachial plexus (C8–T1) + sympathetic chain", "Pancoast (superior sulcus) tumor: shoulder/arm pain, Horner syndrome (ptosis, miosis, anhidrosis)", "Apical NSCLC (usually squamous/adeno)"],
    ["Phrenic nerve", "Hemidiaphragm elevation; dyspnea", "Mediastinal extension"],
    ["Esophagus", "Dysphagia", "Posterior mediastinal extension"],
    ["Pericardium / heart", "Arrhythmias, pericardial effusion/tamponade", "Direct invasion or metastasis"],
    ["Bronchus (obstruction)", "Post-obstructive pneumonia, atelectasis, wheezing, hemoptysis", "Central tumors (SCC, SCLC)"],
    ["Pleura", "Pleural effusion (exudate), pleuritic chest pain", "Any type with pleural involvement"],
]
t_comp = Table(comp_data, colWidths=[2.1*inch, 2.7*inch, 2.2*inch])
t_comp.setStyle(TableStyle([
    ("BACKGROUND",    (0,0),(-1,0), MID_BLUE),
    ("TEXTCOLOR",     (0,0),(-1,0), white),
    ("FONTNAME",      (0,0),(-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0),(-1,-1), 8.5),
    ("ROWBACKGROUNDS",(0,1),(-1,-1),[white, LIGHT_GRAY]),
    ("GRID",          (0,0),(-1,-1), 0.4, MED_GRAY),
    ("VALIGN",        (0,0),(-1,-1), "TOP"),
    ("TOPPADDING",    (0,0),(-1,-1), 5),
    ("BOTTOMPADDING", (0,0),(-1,-1), 5),
    ("LEFTPADDING",   (0,0),(-1,-1), 5),
]))
story.append(t_comp)
story.append(Spacer(1, 8))

story.append(callout_box(
    "Pancoast tumor mnemonic – HORNER from apex: Horner syndrome, cOmpression of brachial plexus "
    "(C8–T1), Rib destruction, Neck/shoulder pain, Elevated first rib pain, Radiculopathy."
))
story.append(Spacer(1, 14))

# ──────────────────────────────────────────────────────────
# SECTION 4: PARANEOPLASTIC SYNDROMES
# ──────────────────────────────────────────────────────────
story.append(section_banner("4.  PARANEOPLASTIC SYNDROMES"))
story.append(Spacer(1,6))

story.append(p(
    "Paraneoplastic syndromes are effects of the tumor that are <b>not due to direct invasion or metastasis</b> "
    "but are mediated by hormones, peptides, or immune mechanisms. They may precede the cancer diagnosis."
))
story.append(Spacer(1,6))

para_data = [
    ["Syndrome", "Mediator / Mechanism", "Associated Cancer Type", "Key Features"],
    ["SIADH\n(Hyponatremia)", "Ectopic ADH secretion", "SCLC (most common)", "↓Na+, hypo-osmolar serum, inappropriately concentrated urine. Confusion, seizures."],
    ["Cushing Syndrome\n(Ectopic ACTH)", "Ectopic ACTH secretion", "SCLC", "↑cortisol, ↑ACTH. Hypokalemia, hypertension, hyperglycemia, weight gain. Often lacks classic features (rapid onset)."],
    ["Lambert-Eaton\nMyasthenic Syndrome", "Anti-VGCC (voltage-gated Ca²⁺ channel) antibodies", "SCLC", "Proximal muscle weakness (improves with repeated use – reverse of MG). ↓DTRs. Autonomic dysfunction."],
    ["Hypercalcemia\n(Humoral)", "PTHrP (parathyroid hormone-related protein)", "Squamous cell carcinoma (NSCLC)", "↑Ca²⁺, ↓PTH, ↑PTHrP. N/V, polyuria, constipation, confusion. Most common metabolic complication of cancer."],
    ["Hypercalcemia\n(Osteolytic)", "Bone metastases → local cytokines", "Any with bone mets (NSCLC, SCLC)", "Similar symptoms; PTHrP may also be elevated."],
    ["Hypertrophic\nPulmonary\nOsteoarthropathy", "Unknown; possible periosteal vascular changes", "NSCLC (especially large cell)", "Periostitis of long bones, clubbing, joint pain (periosteal new bone formation on imaging)."],
    ["Eaton-Lambert vs.\nMyasthenia Gravis", "—", "SCLC vs. thymoma", "Lambert-Eaton: proximal, improves with repetition, ↓reflexes. MG: ocular, worsens with use, reflexes normal."],
    ["Dermatomyositis /\nPolymyositis", "Immune-mediated", "Lung, GI, GU cancers", "Proximal muscle weakness, elevated CK, Gottron papules (dermatomyositis)."],
]
t_para = Table(para_data, colWidths=[1.4*inch, 1.7*inch, 1.5*inch, 2.4*inch])
t_para.setStyle(TableStyle([
    ("BACKGROUND",    (0,0),(-1,0), DARK_BLUE),
    ("TEXTCOLOR",     (0,0),(-1,0), white),
    ("FONTNAME",      (0,0),(-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0),(-1,-1), 8.5),
    ("ROWBACKGROUNDS",(0,1),(-1,-1),[white, HexColor("#fef0ef")]),
    ("GRID",          (0,0),(-1,-1), 0.4, MED_GRAY),
    ("VALIGN",        (0,0),(-1,-1), "TOP"),
    ("TOPPADDING",    (0,0),(-1,-1), 5),
    ("BOTTOMPADDING", (0,0),(-1,-1), 5),
    ("LEFTPADDING",   (0,0),(-1,-1), 5),
]))
story.append(t_para)
story.append(Spacer(1, 8))

story.append(warn_box(
    "High-yield exam tip: SCLC = SIADH + ectopic ACTH + Lambert-Eaton. "
    "Squamous cell = PTHrP hypercalcemia. Adenocarcinoma = EGFR/ALK/ROS1 driver mutations."
))
story.append(Spacer(1, 14))

# ──────────────────────────────────────────────────────────
# SECTION 5: METASTASIS
# ──────────────────────────────────────────────────────────
story.append(section_banner("5.  METASTASIS PATTERNS"))
story.append(Spacer(1,6))

story.append(p(
    "Lung cancer metastasizes both hematogenously and via lymphatics. "
    "Knowing common metastatic sites aids diagnosis and staging."
))
story.append(Spacer(1,6))

met_data = [
    ["Metastatic Site", "Clinical Features", "Most Common Tumor Type"],
    ["Brain", "Headache, seizures, focal neurologic deficits, altered mental status", "NSCLC (adeno) and SCLC – brain mets occur in ~30–40% of advanced NSCLC, up to 50%+ of SCLC"],
    ["Bone", "Bone pain, pathologic fractures, hypercalcemia (osteolytic)", "Any type; especially NSCLC"],
    ["Liver", "RUQ pain, jaundice, hepatomegaly, ↑LFTs, weight loss", "SCLC (early), NSCLC (advanced)"],
    ["Adrenal glands", "Often silent; bilateral adrenal mets → adrenal insufficiency (rare)", "Any type; adrenals are a common site"],
    ["Lymph nodes", "Mediastinal widening, lymphadenopathy, SVC syndrome", "Central tumors; guides N staging"],
    ["Lung (contralateral)", "New pulmonary nodule(s); may mimic second primary", "NSCLC or SCLC"],
    ["Pericardium / heart", "Pericardial effusion, tamponade, arrhythmias", "Advanced disease"],
]
t_met = Table(met_data, colWidths=[1.6*inch, 2.7*inch, 2.7*inch])
t_met.setStyle(TableStyle([
    ("BACKGROUND",    (0,0),(-1,0), MID_BLUE),
    ("TEXTCOLOR",     (0,0),(-1,0), white),
    ("FONTNAME",      (0,0),(-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0),(-1,-1), 8.5),
    ("ROWBACKGROUNDS",(0,1),(-1,-1),[white, LIGHT_GRAY]),
    ("GRID",          (0,0),(-1,-1), 0.4, MED_GRAY),
    ("VALIGN",        (0,0),(-1,-1), "TOP"),
    ("TOPPADDING",    (0,0),(-1,-1), 5),
    ("BOTTOMPADDING", (0,0),(-1,-1), 5),
    ("LEFTPADDING",   (0,0),(-1,-1), 5),
]))
story.append(t_met)
story.append(Spacer(1, 14))

# ──────────────────────────────────────────────────────────
# SECTION 6: DIAGNOSTIC APPROACH
# ──────────────────────────────────────────────────────────
story.append(PageBreak())
story.append(section_banner("6.  DIAGNOSTIC APPROACH"))
story.append(Spacer(1,6))

story.append(p(
    "Diagnosis involves imaging to detect the lesion, biopsy to confirm histology, and molecular "
    "testing to guide therapy. A systematic approach is required."
))
story.append(Spacer(1,6))

story.append(p("<b>Step 1 – Imaging</b>", h2))
story.append(b("<b>Chest X-ray (CXR):</b> Initial test; may show mass, effusion, atelectasis, mediastinal widening. "
               "A normal CXR does <u>not</u> exclude lung cancer."))
story.append(b("<b>CT scan of chest and abdomen (with contrast):</b> Required in any patient with smoking history and pulmonary symptoms. "
               "Best characterizes tumor size, location, lymph node involvement, and distant disease."))
story.append(b("<b>PET-CT scan:</b> Evaluates metabolic activity; detects mediastinal and distant metastases. Key for staging."))
story.append(b("<b>Brain MRI:</b> Recommended in all patients with stage III/IV NSCLC and all SCLC patients to rule out brain metastases."))
story.append(b("<b>Bone scan:</b> If bone mets suspected clinically or on PET."))
story.append(Spacer(1,6))

story.append(p("<b>Step 2 – Tissue Diagnosis (Biopsy)</b>", h2))
story.append(b("<b>Bronchoscopy with biopsy/brushings/BAL:</b> Best for central (hilar/endobronchial) lesions."))
story.append(b("<b>Endobronchial ultrasound (EBUS):</b> Samples mediastinal lymph nodes; preferred over mediastinoscopy."))
story.append(b("<b>CT-guided needle biopsy:</b> For peripheral lesions. Core-needle biopsy preferred over FNA for adequate tissue for molecular testing."))
story.append(b("<b>Thoracoscopy (VATS) or thoracotomy:</b> When other methods are non-diagnostic."))
story.append(b("<b>Pleural fluid cytology:</b> If pleural effusion is present (malignant effusion = M1a staging)."))
story.append(b("<b>Sputum cytology:</b> Limited sensitivity; rarely used alone."))
story.append(Spacer(1,6))

story.append(p("<b>Step 3 – Molecular / Biomarker Testing (critical for treatment selection)</b>", h2))

mol_data = [
    ["Biomarker", "Method", "Significance", "Targeted Agent(s)"],
    ["EGFR mutation\n(exon 19 del, exon 21 L858R)", "NGS / PCR", "Present in ~15% NSCLC (more common in adeno, Asian, never-smoker)", "Osimertinib (1st line), Erlotinib, Gefitinib, Afatinib"],
    ["ALK rearrangement", "FISH / IHC / NGS", "~5% NSCLC (adeno type, young, never-smoker)", "Alectinib (preferred), Crizotinib, Brigatinib, Lorlatinib"],
    ["ROS1 rearrangement", "FISH / NGS", "~1–2% NSCLC", "Crizotinib, Entrectinib"],
    ["KRAS G12C mutation", "NGS", "~13% NSCLC (adeno, smokers)", "Sotorasib, Adagrasib"],
    ["BRAF V600E", "NGS", "~2–4% NSCLC", "Dabrafenib + Trametinib"],
    ["MET exon 14 skipping", "NGS", "~3–4% NSCLC", "Capmatinib, Tepotinib"],
    ["RET rearrangement", "NGS", "~1–2% NSCLC", "Selpercatinib, Pralsetinib"],
    ["NTRK fusion", "NGS / IHC", "Rare (<1%)", "Larotrectinib, Entrectinib"],
    ["PD-L1 (by IHC)", "IHC (tumor proportion score)", "Guides immunotherapy; ≥50% = likely benefit from pembrolizumab mono", "Pembrolizumab, Atezolizumab (if TPS high)"],
    ["ERBB2 (HER2)", "NGS", "~3% NSCLC", "Trastuzumab deruxtecan (T-DXd)"],
]
t_mol = Table(mol_data, colWidths=[1.6*inch, 1*inch, 2.2*inch, 2.2*inch])
t_mol.setStyle(TableStyle([
    ("BACKGROUND",    (0,0),(-1,0), DARK_BLUE),
    ("TEXTCOLOR",     (0,0),(-1,0), white),
    ("FONTNAME",      (0,0),(-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0),(-1,-1), 8),
    ("ROWBACKGROUNDS",(0,1),(-1,-1),[white, LIGHT_GRAY]),
    ("GRID",          (0,0),(-1,-1), 0.4, MED_GRAY),
    ("VALIGN",        (0,0),(-1,-1), "TOP"),
    ("TOPPADDING",    (0,0),(-1,-1), 4),
    ("BOTTOMPADDING", (0,0),(-1,-1), 4),
    ("LEFTPADDING",   (0,0),(-1,-1), 5),
]))
story.append(t_mol)
story.append(Spacer(1, 14))

# ──────────────────────────────────────────────────────────
# SECTION 7: STAGING
# ──────────────────────────────────────────────────────────
story.append(section_banner("7.  STAGING"))
story.append(Spacer(1,6))

story.append(subsection_banner("7A.  NSCLC – TNM Staging (8th Edition IASLC)"))
story.append(Spacer(1,6))

tnm_t = [
    ["T Category", "Definition"],
    ["T1", "Tumor ≤3 cm, surrounded by lung/visceral pleura, no bronchoscopic involvement proximal to lobar bronchus\n(T1a ≤1 cm, T1b >1–2 cm, T1c >2–3 cm)"],
    ["T2", "T2a: >3–4 cm  |  T2b: >4–5 cm\nOR: involves main bronchus (not carina), invades visceral pleura, atelectasis/pneumonitis"],
    ["T3", ">5–7 cm OR separate nodule same lobe OR invasion of: chest wall, pericardium, phrenic nerve"],
    ["T4", ">7 cm OR nodule(s) in ipsilateral different lobe OR invasion of: mediastinum, heart, great vessels, trachea, esophagus, spine, recurrent laryngeal nerve, carina"],
]
tnm_n = [
    ["N Category", "Definition"],
    ["N0", "No regional lymph node involvement"],
    ["N1", "Ipsilateral peribronchial and/or ipsilateral hilar nodes"],
    ["N2", "Ipsilateral mediastinal and/or subcarinal nodes"],
    ["N3", "Contralateral mediastinal/hilar, ipsilateral or contralateral supraclavicular/scalene nodes"],
]
tnm_m = [
    ["M Category", "Definition"],
    ["M0", "No distant metastasis"],
    ["M1a", "Separate tumor nodule(s) in contralateral lobe; pleural/pericardial nodules or effusion"],
    ["M1b", "Single extrathoracic metastasis (single organ)"],
    ["M1c", "Multiple extrathoracic metastases (one or more organs)"],
]
stage = [
    ["Stage", "TNM", "General Approach"],
    ["IA (1a/1b/1c)", "T1a-cN0M0", "Surgery (lobectomy preferred); no adjuvant chemo usually"],
    ["IIA", "T2bN0M0", "Surgery; consider adjuvant chemo"],
    ["IIB", "T3N0M0 or T1-2N1M0", "Surgery + adjuvant platinum chemo; osimertinib if EGFR+"],
    ["IIIA", "T1-2N2M0, T3N1M0, T4N0-1M0", "Concurrent chemoradiation ± surgery in select cases"],
    ["IIIB", "T1-2N3M0, T3-4N2M0", "Concurrent chemoradiation; no surgery"],
    ["IIIC", "T3-4N3M0", "Concurrent chemoradiation; no surgery"],
    ["IVA", "Any T, any N, M1a or M1b", "Systemic therapy (targeted / immunotherapy / chemo); palliative intent"],
    ["IVB", "Any T, any N, M1c", "Systemic therapy; palliative intent"],
]

def make_tnm_table(data, col_widths):
    t = Table(data, colWidths=col_widths)
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0),(-1,0), DARK_BLUE),
        ("TEXTCOLOR",     (0,0),(-1,0), white),
        ("FONTNAME",      (0,0),(-1,0), "Helvetica-Bold"),
        ("FONTSIZE",      (0,0),(-1,-1), 8.5),
        ("ROWBACKGROUNDS",(0,1),(-1,-1),[white, LIGHT_GRAY]),
        ("GRID",          (0,0),(-1,-1), 0.4, MED_GRAY),
        ("VALIGN",        (0,0),(-1,-1), "TOP"),
        ("TOPPADDING",    (0,0),(-1,-1), 4),
        ("BOTTOMPADDING", (0,0),(-1,-1), 4),
        ("LEFTPADDING",   (0,0),(-1,-1), 5),
    ]))
    return t

story.append(p("<b>T – Primary Tumor</b>", h3))
story.append(make_tnm_table(tnm_t, [0.8*inch, 6.2*inch]))
story.append(Spacer(1,6))

story.append(p("<b>N – Lymph Nodes</b>", h3))
story.append(make_tnm_table(tnm_n, [0.8*inch, 6.2*inch]))
story.append(Spacer(1,6))

story.append(p("<b>M – Metastasis</b>", h3))
story.append(make_tnm_table(tnm_m, [0.8*inch, 6.2*inch]))
story.append(Spacer(1,8))

story.append(p("<b>Overall Stage Grouping & Treatment Approach</b>", h3))
story.append(make_tnm_table(stage, [0.7*inch, 1.9*inch, 4.4*inch]))
story.append(Spacer(1, 10))

story.append(subsection_banner("7B.  SCLC Staging – Veterans Affairs (2-Stage) System", color=ACCENT_RED))
story.append(Spacer(1,6))

sclc_stage_data = [
    ["Stage", "Definition", "Treatment"],
    ["Limited Disease\n(LD-SCLC)", "Tumor confined to one hemithorax including ipsilateral mediastinal and supraclavicular nodes; can be encompassed in a single radiation field (about 30% of patients at diagnosis)", "Concurrent chemoradiation (platinum + etoposide + RT); prophylactic cranial irradiation (PCI) in responders"],
    ["Extensive Disease\n(ED-SCLC)", "Tumor beyond one hemithorax; includes contralateral lymph nodes, distant metastases, malignant pleural/pericardial effusion (about 70% of patients at diagnosis)", "Chemotherapy (carboplatin/cisplatin + etoposide) + atezolizumab or durvalumab; consolidative thoracic RT in select cases; PCI may be considered"],
]
t_sclc_s = Table(sclc_stage_data, colWidths=[1.2*inch, 3*inch, 2.8*inch])
t_sclc_s.setStyle(TableStyle([
    ("BACKGROUND",    (0,0),(-1,0), ACCENT_RED),
    ("TEXTCOLOR",     (0,0),(-1,0), white),
    ("FONTNAME",      (0,0),(-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0),(-1,-1), 8.5),
    ("ROWBACKGROUNDS",(0,1),(-1,-1),[white, HexColor("#fef0ef")]),
    ("GRID",          (0,0),(-1,-1), 0.4, MED_GRAY),
    ("VALIGN",        (0,0),(-1,-1), "TOP"),
    ("TOPPADDING",    (0,0),(-1,-1), 5),
    ("BOTTOMPADDING", (0,0),(-1,-1), 5),
    ("LEFTPADDING",   (0,0),(-1,-1), 5),
]))
story.append(t_sclc_s)
story.append(Spacer(1, 14))

# ──────────────────────────────────────────────────────────
# SECTION 8: TREATMENT
# ──────────────────────────────────────────────────────────
story.append(PageBreak())
story.append(section_banner("8.  TREATMENT"))
story.append(Spacer(1,6))

story.append(subsection_banner("8A.  NSCLC Treatment Algorithm"))
story.append(Spacer(1,6))

story.append(p("<b>Stages I and II (Early-Stage NSCLC)</b>", h2))
story.append(b("Surgical resection (lobectomy) is the preferred treatment for fit patients."))
story.append(b("Segmentectomy or wedge resection if poor pulmonary reserve."))
story.append(b("Adjuvant platinum-based chemotherapy for resected Stage II and III disease (improves OS)."))
story.append(b("Adjuvant osimertinib (3 years) for resected Stage IB–IIIA with EGFR mutation."))
story.append(b("Stereotactic body radiation therapy (SBRT) for patients who cannot tolerate surgery."))
story.append(Spacer(1,6))

story.append(p("<b>Stage III (Locally Advanced NSCLC)</b>", h2))
story.append(b("Standard: Concurrent chemoradiation (platinum doublet + RT ≥60 Gy)."))
story.append(b("Followed by 12 months of consolidation <b>durvalumab</b> (anti-PD-L1) in patients who have not progressed."))
story.append(b("Select IIIA patients may be candidates for surgery after induction therapy."))
story.append(Spacer(1,6))

story.append(p("<b>Stage IV (Metastatic NSCLC) – Treatment by Mutation Status</b>", h2))

stage4_data = [
    ["Profile", "First-Line Therapy"],
    ["EGFR mutation (exon 19 del or L858R)", "Osimertinib (preferred); alternatives: erlotinib, gefitinib, afatinib"],
    ["ALK rearrangement", "Alectinib (preferred); lorlatinib, brigatinib, crizotinib"],
    ["ROS1 rearrangement", "Crizotinib or entrectinib"],
    ["KRAS G12C", "Sotorasib or adagrasib (often 2nd line)"],
    ["BRAF V600E", "Dabrafenib + trametinib"],
    ["MET exon 14 skip", "Capmatinib or tepotinib"],
    ["PD-L1 ≥50%, no driver mutation (non-squamous)", "Pembrolizumab monotherapy (KEYNOTE-024)"],
    ["PD-L1 1–49% or <1%, no driver mutation (non-squamous)", "Pembrolizumab + carboplatin + pemetrexed (KEYNOTE-189)"],
    ["Squamous, no driver mutation", "Pembrolizumab + carboplatin + paclitaxel/nab-paclitaxel (KEYNOTE-407)"],
    ["High tumor mutational burden (TMB-H)", "Nivolumab + ipilimumab (CheckMate-227)"],
    ["No actionable mutation, PD-L1 <1%", "Platinum doublet chemotherapy ± bevacizumab (non-squamous)"],
]
t_s4 = Table(stage4_data, colWidths=[3.2*inch, 3.8*inch])
t_s4.setStyle(TableStyle([
    ("BACKGROUND",    (0,0),(-1,0), DARK_BLUE),
    ("TEXTCOLOR",     (0,0),(-1,0), white),
    ("FONTNAME",      (0,0),(-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0),(-1,-1), 8.5),
    ("ROWBACKGROUNDS",(0,1),(-1,-1),[white, LIGHT_GRAY]),
    ("GRID",          (0,0),(-1,-1), 0.4, MED_GRAY),
    ("VALIGN",        (0,0),(-1,-1), "TOP"),
    ("TOPPADDING",    (0,0),(-1,-1), 5),
    ("BOTTOMPADDING", (0,0),(-1,-1), 5),
    ("LEFTPADDING",   (0,0),(-1,-1), 5),
]))
story.append(t_s4)
story.append(Spacer(1, 10))

story.append(subsection_banner("8B.  SCLC Treatment", color=ACCENT_RED))
story.append(Spacer(1,6))

story.append(b("<b>Limited disease:</b> Concurrent chemoradiation – cisplatin/carboplatin + etoposide with thoracic RT. PCI in complete responders."))
story.append(b("<b>Extensive disease:</b> Carboplatin + etoposide + atezolizumab (or durvalumab). Consolidative thoracic RT may be added. PCI optional (benefit debated)."))
story.append(b("<b>Relapse:</b> Topotecan (standard); lurbinectedin (FDA approved 2020 for platinum-refractory SCLC)."))
story.append(b("Surgery is rarely used (limited LD patients who are T1-2N0); most present with unresectable disease."))
story.append(Spacer(1, 6))

story.append(callout_box(
    "PCI (prophylactic cranial irradiation) reduces brain metastases in SCLC patients who achieve a complete response "
    "to initial therapy, but its survival benefit is debated in the era of MRI surveillance."
))
story.append(Spacer(1, 14))

# ──────────────────────────────────────────────────────────
# SECTION 9: HIGH-YIELD SUMMARY & MNEMONICS
# ──────────────────────────────────────────────────────────
story.append(section_banner("9.  HIGH-YIELD SUMMARY & MNEMONICS"))
story.append(Spacer(1,6))

story.append(p("<b>Quick-Reference: Lung Cancer Associations</b>", h2))

quick_data = [
    ["Finding / Association", "Think..."],
    ["Peripheral coin lesion, never-smoker, female, young", "Adenocarcinoma (check EGFR, ALK, ROS1)"],
    ["Central mass, hemoptysis, hypercalcemia (↑PTHrP)", "Squamous cell carcinoma"],
    ["Central mass, SIADH (hyponatremia), ectopic ACTH, Lambert-Eaton", "Small cell lung cancer (SCLC)"],
    ["Pancoast tumor: shoulder pain + Horner syndrome", "Apical lung cancer (NSCLC – usually squamous)"],
    ["SVC syndrome: facial swelling, JVD, arm edema", "SCLC or right-sided NSCLC"],
    ["Proximal muscle weakness improving with activity, ↓reflexes", "Lambert-Eaton (SCLC)"],
    ["Ptosis, miosis, anhidrosis (ipsilateral)", "Horner syndrome – Pancoast tumor"],
    ["Hyponatremia in lung cancer patient", "SIADH (SCLC) → restrict fluids, treat underlying"],
    ["Hypercalcemia in lung cancer patient", "PTHrP from SCC → ↓PTH, ↑PTHrP"],
    ["Hoarseness in left lung cancer", "Recurrent laryngeal nerve compression"],
    ["Clubbing + periostitis + joint pain", "Hypertrophic pulmonary osteoarthropathy (NSCLC)"],
    ["Lung nodule ≤3 cm, pure lepidic growth, 100% survival", "Adenocarcinoma in situ (AIS) – resect completely"],
    [">50% PD-L1, no driver mutation", "Pembrolizumab monotherapy"],
    ["EGFR-mutated NSCLC", "Osimertinib (best 1st-line; also adjuvant after resection)"],
    ["ALK-rearranged NSCLC", "Alectinib (preferred 1st-line over crizotinib)"],
]
t_quick = Table(quick_data, colWidths=[3.2*inch, 3.8*inch])
t_quick.setStyle(TableStyle([
    ("BACKGROUND",    (0,0),(-1,0), DARK_BLUE),
    ("TEXTCOLOR",     (0,0),(-1,0), white),
    ("FONTNAME",      (0,0),(-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0),(-1,-1), 8.5),
    ("ROWBACKGROUNDS",(0,1),(-1,-1),[white, LIGHT_GRAY]),
    ("GRID",          (0,0),(-1,-1), 0.4, MED_GRAY),
    ("VALIGN",        (0,0),(-1,-1), "TOP"),
    ("TOPPADDING",    (0,0),(-1,-1), 4),
    ("BOTTOMPADDING", (0,0),(-1,-1), 4),
    ("LEFTPADDING",   (0,0),(-1,-1), 5),
]))
story.append(t_quick)
story.append(Spacer(1, 10))

story.append(p("<b>Mnemonics</b>", h2))
story.append(b("<b>SCLC paraneoplastic triad:</b> \"SACLumab\" – <b>S</b>IADH, <b>A</b>CTH (ectopic), <b>L</b>ambert-Eaton"))
story.append(b("<b>Horner syndrome:</b> PAM – <b>P</b>tosis, <b>A</b>nhidrosis, <b>M</b>iosis (+ enophthalmos)"))
story.append(b("<b>SVC syndrome:</b> PERLA – <b>P</b>lethora, <b>E</b>dema (face/arm), <b>R</b>edness, <b>L</b>arge neck veins, <b>A</b>rms elevated = relief"))
story.append(b("<b>Lambert-Eaton vs. MG:</b> Lambert = Gets <b>L</b>oose (improves with repetition). MG = Gets <b>M</b>ore tired."))
story.append(b("<b>Adenocarcinoma driver mutations:</b> EGFR, ALK, ROS1, KRAS, BRAF, MET, RET, NTRK – remember \"EAR KBMeN Rx\""))
story.append(Spacer(1, 10))

story.append(p("<b>Lecture Timestamp Reference</b>", h2))
ts_data = [
    ["Timestamp", "Topic"],
    ["0:00", "Intro / Lab"],
    ["0:45", "Pathophysiology and Causes of Lung Cancer"],
    ["42:17", "Compressive Effects of Lung Tumors"],
    ["1:02:32", "Paraneoplastic Syndromes"],
    ["1:30:10", "Metastasis"],
    ["1:39:02", "Diagnostic Approach to Lung Cancer"],
    ["2:10:18", "Treatment of Lung Cancer"],
]
t_ts = Table(ts_data, colWidths=[1*inch, 6*inch])
t_ts.setStyle(TableStyle([
    ("BACKGROUND",    (0,0),(-1,0), DARK_BLUE),
    ("TEXTCOLOR",     (0,0),(-1,0), white),
    ("FONTNAME",      (0,0),(-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0),(-1,-1), 9),
    ("ROWBACKGROUNDS",(0,1),(-1,-1),[white, LIGHT_BLUE]),
    ("GRID",          (0,0),(-1,-1), 0.4, MED_GRAY),
    ("TOPPADDING",    (0,0),(-1,-1), 4),
    ("BOTTOMPADDING", (0,0),(-1,-1), 4),
    ("LEFTPADDING",   (0,0),(-1,-1), 8),
]))
story.append(t_ts)
story.append(Spacer(1, 10))

# Footer note
story.append(HRFlowable(width="100%", thickness=1, color=DARK_BLUE))
story.append(Spacer(1,4))
footer_s = s("Footer", fontSize=8, fontName="Helvetica-Oblique", textColor=MED_GRAY, alignment=TA_CENTER)
story.append(p(
    "Study guide prepared from Ninja Nerd Clinical Medicine – Lung Cancer (youtube.com/watch?v=41rLAXnlVq4) "
    "with reference to Harrison's Principles of Internal Medicine 22e, Washington Manual of Medical Therapeutics, "
    "Murray & Nadel's Respiratory Medicine, and Robbins Basic Pathology. For educational use only.",
    footer_s
))

doc.build(story)
print("PDF generated:", OUTPUT_PATH)
Running Command

cd /home/daytona/workspace/lung-cancer-study-guide && python generate_study_guide.py 2>&1

Editing File

~/lung-cancer-study-guide/generate_study_guide.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/lung-cancer-study-guide/generate_study_guide.py'
Running Command

cd /home/daytona/workspace/lung-cancer-study-guide && python generate_study_guide.py 2>&1

Running Command

ls -lh /home/daytona/workspace/lung-cancer-study-guide/Lung_Cancer_Study_Guide.pdf

Your study guide is ready!

Lung Cancer Study Guide

PDF Document · PDF


Here's what's covered across 9 sections, following the exact lecture structure:
SectionContent
1. Epidemiology & Risk FactorsIncidence stats, full risk factor table, USPSTF screening criteria
2. Histologic TypesNSCLC vs SCLC comparison tables, IHC marker summary (TTF-1, Napsin-A, p40, CD56, etc.)
3. Compressive EffectsStructure-by-structure table: SVC, RLN, phrenic nerve, brachial plexus, esophagus
4. Paraneoplastic SyndromesSIADH, ectopic ACTH, Lambert-Eaton, PTHrP hypercalcemia, HPO, dermatomyositis
5. Metastasis PatternsBrain, bone, liver, adrenal, lymph nodes - with clinical features per site
6. Diagnostic ApproachImaging (CXR → CT → PET → MRI), biopsy methods, molecular testing table (EGFR/ALK/ROS1/KRAS/PD-L1 etc.)
7. StagingFull NSCLC TNM (8th ed.) T/N/M tables + stage groupings, SCLC limited vs. extensive
8. TreatmentStage-by-stage NSCLC algorithm, targeted agents by mutation, SCLC chemo ± immunotherapy
9. High-Yield SummaryQuick-association table, mnemonics, lecture timestamp reference
This is a shared conversation. Sign in to Orris to start your own chat.