Take me a presentation on different types of lung cancer. Find the images for all of them and compile that into handwritten notes in a PDF format.
adenocarcinoma lung histology pathology

Comprehensive description of pulmonary micropapillary adenocarcinoma histology depicted in a hematoxylin and eosin stained lung tissue micrograph. The primary subject is malignant gland-forming epithelium of the lung with micropapillary tufts lacking true fibrovascular cores, often shed into alveolar spaces, producing small, floating clusters within airspaces. Tumor cells are cuboidal to columnar, with variable nuclear atypia and high nuclear-to-cytoplasmic ratio; mitotic activity may be present but not always prominent. In addition to micropapillary structures, there may be ring-like glandular configurations within the airways and alveolar lumina; occasional psammoma bodies can be observed. The architectural pattern shows tight, disconnected clusters within desmoplastic stroma, increasing invasiveness. This variant is associated with aggressive clinical behavior, including a propensity for intralobar satellite nodules, early dissemination, and frequent metastases to contralateral lung, mediastinal lymph nodes, bone, and adrenal glands. Molecular profiling in micropapillary adenocarcinoma of the lung frequently reveals mutations in KRAS, EGFR, and BRAF, informing prognosis and potential targeted therapy. Clinically, recognition of this pattern influences staging, surveillance, and treatment planning, and underscores the need for comprehensive sampling to detect multifocal disease. This image exemplifies diagnostic features useful for surgical pathology, tumor stratification, and educational reference in thoracic oncology. This pattern warrants comprehensive molecular testing.

This histopathology image demonstrates solid-predominant adenocarcinoma of the lung. Acquired from lung parenchyma, formalin-fixed paraffin-embedded tissue stained with Hematoxylin and Eosin, the tumor shows solid sheets of neoplastic cells with high cellularity, minimal glandular differentiation, and no distinct lepidic, acinar, papillary, or micropapillary growth patterns in the observed fields. Intracellular mucin can be demonstrated with histochemical stains in at least 5% of cells across two high-power fields, though mucin expression may be absent in tumors that express pneumocyte markers such as TTF-1 or Napsin A. The morphology here suggests an aggressive phenotype, often correlating with larger tumor size, lymph node involvement, and invasion of lymphovascular and pleural spaces. The typical genomic profile for solid-predominant adenocarcinoma includes a lower frequency of EGFR mutations, higher rates of KRAS mutations and RET fusions, and a sizable pan-negative subset for common drivers. Clinically, this subtype informs prognosis and therapy planning, warranting comprehensive molecular testing and thorough radiologic-pathologic correlation to guide management and surveillance. This image is a representative teaching exemplar for histology and pathology education in pulmonary oncology. It is suitable for teaching lung cancer histology, differential diagnosis including mucinous subtypes, and the integration of morphologic findings with molecular testing for personalized therapy planning.

Histopathology: Light microscopy of hematoxylin and eosin stained lung tissue demonstrates an adenocarcinoma with an acinar (gland-forming) growth pattern. Tumor cells are cuboidal to columnar with moderate cytoplasm, nuclear atypia, hyperchromasia, and conspicuous nucleoli arranged in small to medium sized glands that produce mucin. Signet ring cell appearance may be present in some glands, and cribriform and occasional solid areas can be observed within the neoplasm. The surrounding lung parenchyma shows desmoplastic stroma and invasion consistent with invasive adenocarcinoma. Although ALK translocations are characteristic of a subset of lung adenocarcinomas, correlate immunohistochemical and molecular studies because ALK protein expression may be low and yield false negative results on IHC; confirmatory testing by fluorescence in situ hybridization or next generation sequencing for ALK rearrangement is recommended. Clinically, ALK rearranged tumors commonly arise in never smokers or light smokers and tend to occur in younger patients, with a tendency toward mucin production and mucinous histology. Therapeutic relevance is high because ALK inhibitors (crizotinib, ceritinib, alectinib) offer targeted treatment options. This image best illustrates acinar predominant lung adenocarcinoma, a histologic subtype that informs prognosis, molecular profiling, and treatment planning including consideration of targeted therapy. This image serves as a reference for pathology education.
squamous cell carcinoma lung histology

Digital whole-slide histopathology image of a peripherally located lung squamous cell carcinoma captured on a hematoxylin and eosin stained section. The specimen represents peripheral parenchyma with a bronchogenic carcinoma infiltrating the lung periphery. On low- and high-power inspection, nests and irregular clusters of polygonal tumor cells extend from the capsule into adjacent stroma. Tumor cells exhibit eosinophilic cytoplasm, distinct cell borders, and prominent nuclei with coarse chromatin; intercellular bridges may be visible, and occasional keratinization features can be present in well-differentiated foci. The surrounding lung parenchyma shows desmoplastic stromal response and inflammatory infiltrate. The lesion demonstrates peripheral localization, an infiltrative growth pattern, and disruption of normal alveolar architecture. The image supports a histopathologic diagnosis of squamous cell carcinoma due to squamous differentiation, keratinization in places, and intercellular keratin bridges; such morphology is typical in smokers with bronchogenic carcinoma. Clinically, this histology correlates with a smoking history and indicates a solid, non-small cell lung cancer variant with squamous lineage. This image would be valuable for educational purposes, pathology review, differential diagnosis with adenocarcinoma or large cell carcinoma, and in teaching about tumor-stroma interactions in peripheral lung cancers. Correlation with clinical history enhances interpretive accuracy and guides multidisciplinary care in treatment planning.

This histopathology image depicts a central lung squamous cell carcinoma with a prominent endobronchial polypoid/papillary component. Acquired from lung tissue with central airway involvement, the specimen is prepared as a Hematoxylin and Eosin stained slide and examined under light microscopy at low to intermediate magnification. The architecture shows nests and sheets of malignant squamous cells arranged in a papillary to polypoid configuration within the bronchial lumen, with focal invasion into submucosa and adjacent parenchyma. Tumor cells exhibit classic squamous differentiation, including intercellular bridges, nuclear pleomorphism, prominent eosinophilic cytoplasm, and occasional keratinization with keratin pearl formation. The lesion projects into the bronchial lumen, causing obstruction and potential secondary atelectasis, bronchiectasis, and obstructive bronchopneumonia in surrounding lung segments. This central, endobronchial growth pattern is characteristic of squamous cell carcinoma of the lung, which commonly arises in smokers and tends to present with hemoptysis, cough, or recurrent infections due to airway obstruction. Differential considerations include other central neoplasms such as adenosquamous carcinoma, small cell carcinoma, carcinoid tumor, and inflammatory polyps; histology favors squamous differentiation. Clinically, findings guide bronchoscopic debulking, surgical resection considerations, radiotherapy, and chemotherapy planning. Accurate histopathologic subtyping has implications for prognosis and targeted therapy decisions, including assessment for p63/p40 positivity and keratinization.

Imaging modality and technique: Histopathology via light microscopy of Hematoxylin and Eosin stained lung tissue. Primary subject: basaloid squamous cell carcinoma of the lung, with interanastomosing cords of basaloid cells and focal central squamous differentiation. Specimen: paraffin-embedded pulmonary biopsy section, representing tumor infiltrating lung parenchyma. Observed architecture comprises intricate, branching cellular cords embedded in a fibrous stroma, with nests of small, hyperchromatic basaloid cells and scant cytoplasm; occasional abrupt keratinization or squamous pearls in central zones. Adjacent lung parenchyma appears compressed and distorted at the superior edge of the image, consistent with tumor expansion. Cytology shows marked pleomorphism, high mitotic rate, and apoptotic debris; mitotic figures may be present. Overall pattern aligns with basaloid variant of squamous cell carcinoma, known for aggressive clinical behavior and relatively poor prognosis compared with conventional SCC. Diagnostic significance: recognition of basaloid differentiation informs prognosis, guides multimodal therapy, and prompts thorough staging for potential nodal involvement and distant metastasis. Potential differential diagnoses include conventional squamous cell carcinoma with basaloid features, small cell carcinoma with basaloid aspects, and large cell carcinoma variants; histology helps distinguish via keratinization and morphological context. Clinical correlation: correlates with rapid disease progression; supports consideration of aggressive surgical and systemic treatment alongside radiotherapy.
small cell lung cancer histology oat cell carcinoma

Lung cancer histologic types distribution infographic presenting major histologies and their relative frequencies. The chart is a non-imaging visualization with labeled segments. It shows adenocarcinoma as the most common histology (~38%), followed by squamous cell carcinoma (~20%), small cell carcinoma (~14%), large cell carcinoma (~3%), and other types (~25%). This representation highlights epidemiology: adenocarcinoma is more frequent in women and never-smokers and tends to arise in peripheral airways, whereas squamous and small cell carcinomas originate in proximal airways and show strong smoking associations. Mixed histologies occur in about 10% of cases (e.g., adenocarcinoma with squamous cell). In never-smokers, adenocarcinoma frequently harbors EGFR mutations, while KRAS mutations are more linked to smoking history; TP53 mutations are more common in smoking-related cancers. Clinical relevance includes informing diagnostic workups, guiding biopsy targeting, and shaping research into histology-specific biology and molecular profiles. This image serves educational, epidemiologic, and research contexts in pathology, oncology, pulmonology, and medical education, and supports discussions about tumor heterogeneity, histology-driven therapy implications, and population-based cancer statistics.

Digital whole-slide histopathology image of a peripherally located lung squamous cell carcinoma captured on a hematoxylin and eosin stained section. The specimen represents peripheral parenchyma with a bronchogenic carcinoma infiltrating the lung periphery. On low- and high-power inspection, nests and irregular clusters of polygonal tumor cells extend from the capsule into adjacent stroma. Tumor cells exhibit eosinophilic cytoplasm, distinct cell borders, and prominent nuclei with coarse chromatin; intercellular bridges may be visible, and occasional keratinization features can be present in well-differentiated foci. The surrounding lung parenchyma shows desmoplastic stromal response and inflammatory infiltrate. The lesion demonstrates peripheral localization, an infiltrative growth pattern, and disruption of normal alveolar architecture. The image supports a histopathologic diagnosis of squamous cell carcinoma due to squamous differentiation, keratinization in places, and intercellular keratin bridges; such morphology is typical in smokers with bronchogenic carcinoma. Clinically, this histology correlates with a smoking history and indicates a solid, non-small cell lung cancer variant with squamous lineage. This image would be valuable for educational purposes, pathology review, differential diagnosis with adenocarcinoma or large cell carcinoma, and in teaching about tumor-stroma interactions in peripheral lung cancers. Correlation with clinical history enhances interpretive accuracy and guides multidisciplinary care in treatment planning.
large cell carcinoma lung histology

Digital whole-slide histopathology image of a peripherally located lung squamous cell carcinoma captured on a hematoxylin and eosin stained section. The specimen represents peripheral parenchyma with a bronchogenic carcinoma infiltrating the lung periphery. On low- and high-power inspection, nests and irregular clusters of polygonal tumor cells extend from the capsule into adjacent stroma. Tumor cells exhibit eosinophilic cytoplasm, distinct cell borders, and prominent nuclei with coarse chromatin; intercellular bridges may be visible, and occasional keratinization features can be present in well-differentiated foci. The surrounding lung parenchyma shows desmoplastic stromal response and inflammatory infiltrate. The lesion demonstrates peripheral localization, an infiltrative growth pattern, and disruption of normal alveolar architecture. The image supports a histopathologic diagnosis of squamous cell carcinoma due to squamous differentiation, keratinization in places, and intercellular keratin bridges; such morphology is typical in smokers with bronchogenic carcinoma. Clinically, this histology correlates with a smoking history and indicates a solid, non-small cell lung cancer variant with squamous lineage. This image would be valuable for educational purposes, pathology review, differential diagnosis with adenocarcinoma or large cell carcinoma, and in teaching about tumor-stroma interactions in peripheral lung cancers. Correlation with clinical history enhances interpretive accuracy and guides multidisciplinary care in treatment planning.

Lung cancer histologic types distribution infographic presenting major histologies and their relative frequencies. The chart is a non-imaging visualization with labeled segments. It shows adenocarcinoma as the most common histology (~38%), followed by squamous cell carcinoma (~20%), small cell carcinoma (~14%), large cell carcinoma (~3%), and other types (~25%). This representation highlights epidemiology: adenocarcinoma is more frequent in women and never-smokers and tends to arise in peripheral airways, whereas squamous and small cell carcinomas originate in proximal airways and show strong smoking associations. Mixed histologies occur in about 10% of cases (e.g., adenocarcinoma with squamous cell). In never-smokers, adenocarcinoma frequently harbors EGFR mutations, while KRAS mutations are more linked to smoking history; TP53 mutations are more common in smoking-related cancers. Clinical relevance includes informing diagnostic workups, guiding biopsy targeting, and shaping research into histology-specific biology and molecular profiles. This image serves educational, epidemiologic, and research contexts in pathology, oncology, pulmonology, and medical education, and supports discussions about tumor heterogeneity, histology-driven therapy implications, and population-based cancer statistics.
small cell lung carcinoma neuroendocrine tumor microscopy

Imaging modality: Histopathology, light microscopy of formalin-fixed, paraffin-embedded lung tissue stained with Hematoxylin and Eosin (H&E). The specimen reveals a malignant neuroendocrine tumor of the lung, classically described as small cell carcinoma. The tumor shows cohesive nests and interconnecting cords with scant cytoplasm and hyperchromatic nuclei; nuclear molding; finely textured chromatin with indistinct nucleoli. Cells are round to spindle-shaped and often display high nuclear-to-cytoplasmic ratio. The stroma is minimal, with frequent mitotic figures and areas of necrosis; crush artifacts may be present. The pattern is characteristic of a high-grade neuroendocrine carcinoma, typically with high cellularity and limited stromal support. Immunohistochemistry, while not visible in the image, commonly demonstrates neuroendocrine markers (synaptophysin, chromogranin, CD56) and TTF-1 positivity in many cases; the Ki-67 index is high. Clinically, this diagnosis indicates an aggressive neoplasm with rapid growth and early metastatic potential, necessitating systemic platinum-based chemotherapy with possible radiotherapy and comprehensive staging. Differential considerations include other small blue cell tumors of the lung such as lymphoma, atypical carcinoid, and poorly differentiated squamous cell carcinoma. Correlation with radiologic imaging and, when available, molecular studies is essential for definitive classification and appropriate treatment planning. This description supports diagnostic accuracy and informs multidisciplinary management decisions for care.

This is a hematoxylin and eosin stained histopathology image of a large cell neuroendocrine carcinoma (LCNEC) of the lung, rendered as a paraffin-embedded tissue section viewed under light microscopy. The specimen originates from pulmonary parenchyma and displays classic high-grade neuroendocrine tumor architecture with sheets or nests of large polygonal cells. Tumor cells have abundant cytoplasm, coarse to vesicular nuclear chromatin, prominent nucleoli, and frequent mitotic figures. Nuclear molding and geographic necrosis are common, imparting a highly anaplastic appearance. The appearance closely resembles small cell lung carcinoma in aggressiveness but is distinguished by larger cell size and more cytoplasm. The neoplasm often demonstrates neuroendocrine differentiation; immunohistochemical studies would typically reveal positivity for neuroendocrine markers (synaptophysin, chromogranin A, CD56) and a high Ki-67 proliferation index. Molecularly, LCNEC frequently harbors inactivation of TP53 and RB1, paralleling SCLC molecular pathogenesis and differing from carcinoids. Clinically, this lesion portends a poor prognosis and requires aggressive management, often involving platinum-based chemotherapy, immunotherapy considerations, and staging to exclude metastatic disease. This image is valuable for illustrating the histomorphologic hallmarks, aiding differential diagnosis against carcinoids and poorly differentiated NSCLC, and illustrating the molecular-pathology correlation that informs prognosis and therapeutic strategy.
lung carcinoid tumor bronchial neuroendocrine

Histopathology image of a central pulmonary carcinoid tumor obtained from bronchial tissue. Imaging modality: light microscopy of formalin-fixed, paraffin-embedded lung biopsy with Hematoxylin and Eosin (H&E) stain. The specimen shows a luminal, endobronchial mass arising within the mainstem/lobar bronchus with preservation of surrounding lung architecture. On low-power view, tumor cells are arranged in uniform nests and sheets embedded in a delicate vascular stroma, with organoid and palisading growth patterns characteristic of neuroendocrine neoplasms. Cells are round to oval with relatively uniform nuclei and finely stippled (salt-and-pepper) chromatin; cytoplasm is scant to moderate. Mitotic figures are rare; necrosis is not prominent, supporting a diagnosis of a well-differentiated (typical) carcinoid. The lesion markedly occludes the bronchial lumen, consistent with endobronchial involvement and potential postobstructive changes such as pneumonia, abscess formation, or bronchiectasis in clinical context. Clinically, central bronchial carcinoids comprise about two-thirds of cases and commonly present with hemoptysis and airway obstruction; peripheral carcinoids are less frequent and often incidental. This histology is crucial for differential diagnosis against other neuroendocrine and non-neuroendocrine lung carcinomas; confirmatory immunohistochemistry (chromogranin A, synaptophysin, CD56) is often supportive. This image thus exemplifies central bronchial carcinoid pathology and supports diagnostic biopsy planning. Correlation with radiology and endobronchial imaging enhances clinical management decisions.

Gross pathology image of a lung carcinoid tumor. The specimen shows a well-circumscribed, round to oval mass filling the bronchial lumen, consistent with endobronchial growth. Central tumors arise near mainstem or lobar bronchi; peripheral lesions may be asymptomatic. The cut surface is yellow-gray with occasional fibrous septa; the overlying bronchial mucosa may be intact, though infiltration of bronchial wall and adjacent parenchyma is possible. The lesion may be sessile or pedunculated; endobronchial component occurs in a subset of typical carcinoids and a minority of atypical variants. Peripheral tumors are more likely to show spindle cell patterns; centrally located lesions may lead to obstructive pneumonia, abscesses, or bronchiectasis. Paraneoplastic manifestations (Cushing, acromegaly, carcinoid syndrome) are rare. Histology would show neuroendocrine tumor nests with uniform cells; salt-and-pepper chromatin is typical; spindle morphology may be present in atypical carcinoids. Final diagnosis requires histopathology and immunohistochemistry. This image serves educational, diagnostic, and reference purposes for surgical pathology, oncology, and radiology correlation. Recognizing such gross patterns aids intraoperative sampling and aids clinical-pathologic correlation. Typical carcinoids are generally indolent neuroendocrine tumors; atypical variants have higher mitotic rate and necrosis, impacting prognosis and management. Clinical imaging correlates with gross findings on CT. Useful for pathology reporting and teaching.
ls -la /tmp/workspace/ 2>/dev/null || echo "workspace empty"
mkdir -p /tmp/workspace/lung-cancer-notes && pip show reportlab pillow requests 2>/dev/null | grep -E "^Name|^Version"
~/lung-cancer-notes/generate_pdf.py
#!/usr/bin/env python3
"""
Generate handwritten-style PDF notes on lung cancer types.
Uses reportlab with custom fonts, colors, and downloaded histology images.
"""
import os
import io
import requests
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm, mm
from reportlab.lib.colors import HexColor, black, white
from reportlab.pdfgen import canvas
from reportlab.lib.utils import ImageReader
from reportlab.platypus import Paragraph
from reportlab.lib.styles import getSampleStyleSheet
from PIL import Image
OUTPUT_DIR = "/tmp/workspace/lung-cancer-notes"
OUTPUT_FILE = os.path.join(OUTPUT_DIR, "Lung_Cancer_Types_Handwritten_Notes.pdf")
# ── Colour palette (notebook / pastel feel) ──────────────────────────────────
BG_COLOR = HexColor("#FDFAF3") # warm cream paper
RULE_COLOR = HexColor("#C8D8E8") # light blue ruled lines
MARGIN_COLOR = HexColor("#F4B8B8") # pink margin line
TITLE_BG = HexColor("#2B4F6E") # deep navy
TITLE_FG = white
SECTION_BG = HexColor("#EAF4FB") # light sky section header bg
SECTION_FG = HexColor("#1A3A55") # dark navy text
HEADING_COLOR = HexColor("#1A3A55")
INK_COLOR = HexColor("#2C2C2C") # near-black ink
ACCENT_RED = HexColor("#C0392B")
ACCENT_BLUE = HexColor("#2980B9")
ACCENT_GREEN = HexColor("#27AE60")
ACCENT_PURPLE = HexColor("#8E44AD")
ACCENT_ORANGE = HexColor("#E67E22")
BULLET_COLOR = HexColor("#E74C3C")
UNDERLINE_COLOR= HexColor("#3498DB")
NOTE_BOX_BG = HexColor("#FFF9C4") # yellow sticky-note
NOTE_BOX_BORDER= HexColor("#F39C12")
# ── Image URLs ────────────────────────────────────────────────────────────────
IMAGES = {
"overview_pie": "https://cdn.orris.care/cdss_images/Pathology_1760049775021_696f835f-8f3e-4f23-8831-560a934d3fff.jpg",
"adeno_acinar": "https://cdn.orris.care/cdss_images/Pathology_1760049861873_4287e72c-f1d7-4a02-94d2-8c4f26a9dd37.jpg",
"adeno_micro": "https://cdn.orris.care/cdss_images/Pathology_1760049817351_bec07e6a-8d7c-46ea-a50a-fe33f74cd8db.jpg",
"scc_periph": "https://cdn.orris.care/cdss_images/Pathology_1760049885486_d8391438-58ee-4403-bd13-2f0b4fc18fd1.jpg",
"scc_central": "https://cdn.orris.care/cdss_images/Pathology_1760049894293_13535519-9fc6-4b81-9537-339248e3beaa.jpg",
"sclc_hist": "https://cdn.orris.care/cdss_images/Pathology_1760049914134_1336fdae-f5fd-4b85-b7f0-60688c898647.jpg",
"lcnec_hist": "https://cdn.orris.care/cdss_images/Pathology_1760049942667_10823e0b-35f7-4457-b047-abb18a521667.jpg",
"carcinoid_hist": "https://cdn.orris.care/cdss_images/Pathology_1760049946627_6e76faa2-9d66-45e2-b8b0-fccf3cbe4450.jpg",
"carcinoid_gross":"https://cdn.orris.care/cdss_images/Pathology_1760049945887_b48d95ac-8f0f-43db-aecb-5060bd4bec8c.jpg",
}
def download_image(url, name):
"""Download image and return PIL Image object."""
try:
r = requests.get(url, timeout=15)
r.raise_for_status()
img = Image.open(io.BytesIO(r.content)).convert("RGB")
path = os.path.join(OUTPUT_DIR, f"img_{name}.jpg")
img.save(path, "JPEG", quality=85)
return path
except Exception as e:
print(f" [WARN] Could not download {name}: {e}")
return None
# ── Helper drawing functions ──────────────────────────────────────────────────
def draw_ruled_background(c, width, height):
"""Draw cream background with blue ruled lines and pink margin."""
c.setFillColor(BG_COLOR)
c.rect(0, 0, width, height, fill=1, stroke=0)
# horizontal ruled lines every 8mm
c.setStrokeColor(RULE_COLOR)
c.setLineWidth(0.4)
y = height - 3*cm
while y > 1.5*cm:
c.line(0, y, width, y)
y -= 8*mm
# left margin line
c.setStrokeColor(MARGIN_COLOR)
c.setLineWidth(1.2)
c.line(2.0*cm, 0, 2.0*cm, height)
def draw_header_band(c, width, height, title, subtitle=""):
"""Draw dark header band at top of page."""
band_h = 2.8*cm
# shadow
c.setFillColor(HexColor("#1A2E40"))
c.rect(0.08*cm, height - band_h - 0.08*cm, width, band_h, fill=1, stroke=0)
# main band
c.setFillColor(TITLE_BG)
c.rect(0, height - band_h, width, band_h, fill=1, stroke=0)
# red accent stripe
c.setFillColor(ACCENT_RED)
c.rect(0, height - band_h - 0.25*cm, width, 0.25*cm, fill=1, stroke=0)
# title text
c.setFillColor(white)
c.setFont("Helvetica-Bold", 20)
c.drawCentredString(width/2, height - 1.5*cm, title)
if subtitle:
c.setFont("Helvetica-Oblique", 11)
c.setFillColor(HexColor("#A8D8EA"))
c.drawCentredString(width/2, height - 2.2*cm, subtitle)
def draw_section_header(c, x, y, w, h, text, color, accent_color=None):
"""Draw a coloured section heading box."""
accent = accent_color or color
# shadow
c.setFillColor(HexColor("#CCCCCC"))
c.roundRect(x+2, y-2, w, h, 5, fill=1, stroke=0)
# main box
c.setFillColor(color)
c.roundRect(x, y, w, h, 5, fill=1, stroke=0)
# left accent bar
c.setFillColor(accent)
c.roundRect(x, y, 6, h, 3, fill=1, stroke=0)
# text
c.setFillColor(white)
c.setFont("Helvetica-Bold", 13)
c.drawString(x + 14, y + h/2 - 5, text)
def draw_bullet_point(c, x, y, text, bullet_color=None, font_size=10, indent=0, bold_prefix=None):
"""Draw a bullet point with optional bold prefix."""
bc = bullet_color or BULLET_COLOR
# bullet circle
c.setFillColor(bc)
c.circle(x + indent + 4, y + 4, 3, fill=1, stroke=0)
c.setFillColor(INK_COLOR)
if bold_prefix:
c.setFont("Helvetica-Bold", font_size)
bw = c.stringWidth(bold_prefix + " ", "Helvetica-Bold", font_size)
c.drawString(x + indent + 12, y, bold_prefix + " ")
c.setFont("Helvetica", font_size)
c.drawString(x + indent + 12 + bw, y, text)
else:
c.setFont("Helvetica", font_size)
c.drawString(x + indent + 12, y, text)
return y - 14
def draw_note_box(c, x, y, w, h, lines, title=None):
"""Draw a yellow sticky-note style box."""
# shadow
c.setFillColor(HexColor("#E0E0E0"))
c.roundRect(x+3, y-3, w, h, 6, fill=1, stroke=0)
# box
c.setFillColor(NOTE_BOX_BG)
c.roundRect(x, y, w, h, 6, fill=1, stroke=0)
c.setStrokeColor(NOTE_BOX_BORDER)
c.setLineWidth(1.5)
c.roundRect(x, y, w, h, 6, fill=0, stroke=1)
# top bar
c.setFillColor(NOTE_BOX_BORDER)
c.roundRect(x, y+h-16, w, 16, 6, fill=1, stroke=0)
c.rect(x, y+h-16, w, 8, fill=1, stroke=0)
if title:
c.setFillColor(white)
c.setFont("Helvetica-Bold", 9)
c.drawCentredString(x+w/2, y+h-13, title)
ty = y + h - 28
c.setFillColor(INK_COLOR)
c.setFont("Helvetica", 9)
for line in lines:
if ty < y + 6: break
c.drawString(x + 8, ty, line)
ty -= 13
def draw_image_box(c, img_path, x, y, max_w, max_h, caption=None):
"""Draw an image with a border and optional caption."""
if not img_path or not os.path.exists(img_path):
# placeholder
c.setFillColor(HexColor("#EEEEEE"))
c.rect(x, y, max_w, max_h, fill=1, stroke=1)
c.setFillColor(HexColor("#999999"))
c.setFont("Helvetica", 8)
c.drawCentredString(x+max_w/2, y+max_h/2, "[Image unavailable]")
return
try:
ir = ImageReader(img_path)
iw, ih = ir.getSize()
aspect = ih / iw
disp_w = max_w
disp_h = disp_w * aspect
if disp_h > max_h:
disp_h = max_h
disp_w = disp_h / aspect
# border shadow
c.setFillColor(HexColor("#BBBBBB"))
c.rect(x+3, y-3, disp_w, disp_h, fill=1, stroke=0)
c.drawImage(img_path, x, y, width=disp_w, height=disp_h, preserveAspectRatio=True)
# border
c.setStrokeColor(HexColor("#888888"))
c.setLineWidth(0.8)
c.rect(x, y, disp_w, disp_h, fill=0, stroke=1)
if caption:
c.setFillColor(HexColor("#444444"))
c.setFont("Helvetica-Oblique", 7.5)
c.drawString(x, y - 10, caption)
except Exception as e:
print(f" [WARN] Could not draw image {img_path}: {e}")
def draw_two_col_key_value(c, x, y, pairs, col_w, color1, color2, font_size=9.5):
"""Draw key:value pairs in two-column style."""
col2_x = x + col_w + 5
for i, (k, v) in enumerate(pairs):
cx = x if i % 2 == 0 else col2_x
cy = y - (i // 2) * 14
c.setFillColor(color1)
c.setFont("Helvetica-Bold", font_size)
c.drawString(cx, cy, k + ":")
c.setFillColor(color2)
c.setFont("Helvetica", font_size)
c.drawString(cx + c.stringWidth(k+":", "Helvetica-Bold", font_size) + 3, cy, v)
rows = (len(pairs) + 1) // 2
return y - rows * 14
def draw_divider(c, x, y, w, color=None):
col = color or HexColor("#CCCCCC")
c.setStrokeColor(col)
c.setLineWidth(0.8)
c.setDash(3, 3)
c.line(x, y, x+w, y)
c.setDash()
# ── Page builders ─────────────────────────────────────────────────────────────
def page_cover(c, width, height, img_paths):
c.setFillColor(HexColor("#0D2137"))
c.rect(0, 0, width, height, fill=1, stroke=0)
# decorative diagonal band
from reportlab.graphics.shapes import Drawing, Polygon
c.setFillColor(HexColor("#1A3A55"))
p = c.beginPath()
p.moveTo(0, height*0.55)
p.lineTo(width, height*0.35)
p.lineTo(width, 0)
p.lineTo(0, 0)
p.close()
c.drawPath(p, fill=1, stroke=0)
# red accent bar
c.setFillColor(ACCENT_RED)
c.rect(0, height*0.52, width, 0.3*cm, fill=1, stroke=0)
# title
c.setFillColor(white)
c.setFont("Helvetica-Bold", 32)
c.drawCentredString(width/2, height*0.77, "LUNG CANCER")
c.setFont("Helvetica-Bold", 22)
c.setFillColor(HexColor("#A8D8EA"))
c.drawCentredString(width/2, height*0.70, "TYPES & CLASSIFICATION")
c.setFont("Helvetica", 13)
c.setFillColor(HexColor("#78B4C8"))
c.drawCentredString(width/2, height*0.64, "Pathology & Clinical Notes")
# decorative lines
for i, dy in enumerate([0, 6, 12]):
alpha = 1.0 - i*0.3
c.setStrokeColor(HexColor("#4A90D9"))
c.setLineWidth(1.5 - i*0.4)
y_ = height*0.61 - dy
c.line(width*0.25, y_, width*0.75, y_)
# overview pie chart image
ov_img = img_paths.get("overview_pie")
if ov_img and os.path.exists(ov_img):
draw_image_box(c, ov_img, width*0.25, height*0.20, width*0.50, height*0.33)
# bottom bar
c.setFillColor(ACCENT_RED)
c.rect(0, 0, width, 1.2*cm, fill=1, stroke=0)
c.setFillColor(white)
c.setFont("Helvetica-Bold", 10)
c.drawCentredString(width/2, 0.4*cm, "WHO Classification | Pathology | Clinical Features | Treatment")
c.showPage()
def page_overview(c, width, height):
draw_ruled_background(c, width, height)
draw_header_band(c, width, height,
"LUNG CANCER OVERVIEW",
"WHO Classification & Epidemiology")
LEFT = 2.3*cm
RIGHT_IMG_X = width - 6.5*cm
TEXT_W = RIGHT_IMG_X - LEFT - 0.5*cm
y = height - 3.5*cm
# WHO Classification box
draw_section_header(c, LEFT, y, TEXT_W + 6.5*cm - 0.5*cm, 0.7*cm,
"WHO Classification of Epithelial Lung Tumors (2021)", TITLE_BG, ACCENT_BLUE)
y -= 1.0*cm
# Two-column classification
c.setFont("Helvetica-Bold", 11)
c.setFillColor(ACCENT_BLUE)
c.drawString(LEFT, y, "NON-SMALL CELL LUNG CANCER (NSCLC) ~85%")
y -= 0.5*cm
bullets_nsclc = [
("Adenocarcinoma", "Most common overall; ~38%; peripheral; women/never-smokers"),
("Squamous Cell Carcinoma", "~20%; central/hilar; strong smoking link"),
("Large Cell Carcinoma", "<10%; diagnosis of exclusion; peripheral"),
("Adenosquamous Carcinoma", "Mixed features; rare; ~1-2%"),
("Sarcomatoid Carcinoma", "Rare; poor prognosis; spindle/giant cells"),
]
for bold, text in bullets_nsclc:
draw_bullet_point(c, LEFT, y, text, ACCENT_BLUE, 9.5, 0, bold)
y -= 15
y -= 0.3*cm
c.setFont("Helvetica-Bold", 11)
c.setFillColor(ACCENT_RED)
c.drawString(LEFT, y, "SMALL CELL LUNG CANCER (SCLC) ~14%")
y -= 0.5*cm
bullets_sclc = [
("Small Cell Carcinoma", "High-grade neuroendocrine; oat cell; central"),
("Combined SCLC", "Mixed SCLC + NSCLC component"),
]
for bold, text in bullets_sclc:
draw_bullet_point(c, LEFT, y, text, ACCENT_RED, 9.5, 0, bold)
y -= 15
y -= 0.3*cm
c.setFont("Helvetica-Bold", 11)
c.setFillColor(ACCENT_GREEN)
c.drawString(LEFT, y, "NEUROENDOCRINE TUMORS (Carcinoids) ~2%")
y -= 0.5*cm
bullets_net = [
("Typical Carcinoid", "Low-grade; <2 mitoses/2mm²; no necrosis"),
("Atypical Carcinoid", "Intermediate-grade; 2-10 mitoses/2mm²; focal necrosis"),
("Large Cell NEC", "High-grade; aggressive; resembles SCLC"),
]
for bold, text in bullets_net:
draw_bullet_point(c, LEFT, y, text, ACCENT_GREEN, 9.5, 0, bold)
y -= 15
# Key facts note box
y -= 0.4*cm
draw_divider(c, LEFT, y, width - LEFT - 1.5*cm)
y -= 0.5*cm
draw_section_header(c, LEFT, y, 12*cm, 0.65*cm, "KEY EPIDEMIOLOGY FACTS", HexColor("#6C3483"))
y -= 1.0*cm
epi_facts = [
"- #1 cause of cancer death in men AND women worldwide",
"- 5-year survival (all stages): ~20% | Localized: ~50%",
"- >50% have distant metastases at diagnosis",
"- ~90% occur in current/ex-smokers",
"- Adenocarcinoma = most common in never-smokers, women, <60 yrs",
"- Squamous + SCLC have strongest smoking association",
"- EGFR mut: ~15% (Western); ~40-50% (East Asian never-smokers)",
]
c.setFont("Helvetica", 9.5)
c.setFillColor(INK_COLOR)
for fact in epi_facts:
c.drawString(LEFT + 5, y, fact)
y -= 13
c.showPage()
def page_adenocarcinoma(c, width, height, img_paths):
draw_ruled_background(c, width, height)
draw_header_band(c, width, height,
"ADENOCARCINOMA",
"Most Common Lung Cancer • ~38% of Cases")
LEFT = 2.3*cm
y = height - 3.5*cm
IMG_W = 7.5*cm
IMG_H = 5.5*cm
IMG_X = width - IMG_W - 1.5*cm
# Section 1: Key features
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"PATHOLOGY & MORPHOLOGY", HexColor("#1A6B9A"), ACCENT_BLUE)
y -= 0.9*cm
c.setFillColor(INK_COLOR)
features = [
("Origin", "Bronchioles & alveoli (peripheral lung)"),
("Gross", "Peripheral gray-white mass; often subpleural"),
("Histology", "Glandular differentiation / mucin production"),
("Patterns", "Acinar, Papillary, Micropapillary, Solid, Lepidic"),
("Spread", "Pleural invasion, lymphatic, haematogenous"),
]
for k, v in features:
c.setFont("Helvetica-Bold", 10)
c.setFillColor(ACCENT_BLUE)
kw = c.stringWidth(k + ": ", "Helvetica-Bold", 10)
c.drawString(LEFT + 12, y, k + ": ")
c.setFont("Helvetica", 10)
c.setFillColor(INK_COLOR)
c.drawString(LEFT + 12 + kw, y, v)
y -= 14
# Insert first image (acinar adenocarcinoma)
draw_image_box(c, img_paths.get("adeno_acinar"), IMG_X,
height - 3.5*cm - 5.8*cm, IMG_W, IMG_H,
"Fig 1. Acinar pattern adenocarcinoma (H&E)")
y -= 0.3*cm
draw_divider(c, LEFT, y, width - LEFT - 2*cm)
y -= 0.4*cm
# Subtypes
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"GROWTH PATTERNS (IASLC/ATS/ERS 2011)", HexColor("#1A6B9A"), ACCENT_BLUE)
y -= 0.9*cm
subtypes = [
("Lepidic", "Growth along alveolar walls (no invasion); AIS/MIA"),
("Acinar", "Round glands in desmoplastic stroma; most common invasive"),
("Papillary", "Glands with fibrovascular cores; intermediate prognosis"),
("Micropapillary", "Tufts lacking fibrovascular cores; worst prognosis"),
("Solid", "Sheets of cells; mucin in ≥5% cells; aggressive; KRAS >EGFR"),
("Mucinous", "Goblet/columnar cells; spills across lobules; KRAS mutations"),
]
for name, desc in subtypes:
draw_bullet_point(c, LEFT, y, desc, ACCENT_BLUE, 9.5, 0, name)
y -= 15
y -= 0.2*cm
draw_divider(c, LEFT, y, width - LEFT - 2*cm)
y -= 0.4*cm
# Molecular section
draw_section_header(c, LEFT, y, 10*cm, 0.65*cm,
"MOLECULAR TARGETS", ACCENT_GREEN, HexColor("#1E8449"))
y -= 0.9*cm
mol_data = [
"EGFR mut: ~15-20% (Western); ~50% Asian",
"KRAS mut: ~30% (mutually exclusive with EGFR)",
"ALK rearrangement: ~4-7% (young, never-smokers)",
"ROS1 rearrangement: ~1-2%",
"BRAF V600E: ~2-3% | MET exon 14: ~3-4%",
"RET fusion: ~1-2% | HER2 mut: ~2-4%",
"Targetable in nearly 70% of non-squamous NSCLC",
]
c.setFont("Helvetica", 9.5)
c.setFillColor(INK_COLOR)
for item in mol_data:
c.circle(LEFT + 5, y + 4, 2.5, fill=1, stroke=0)
c.setFillColor(ACCENT_GREEN)
c.circle(LEFT + 5, y + 4, 2.5, fill=1, stroke=0)
c.setFillColor(INK_COLOR)
c.drawString(LEFT + 12, y, item)
y -= 13
# Second image (micropapillary)
draw_image_box(c, img_paths.get("adeno_micro"),
IMG_X, height - 3.5*cm - 12.5*cm,
IMG_W, IMG_H,
"Fig 2. Micropapillary adenocarcinoma (H&E)")
y -= 0.3*cm
# Clinical note box
draw_note_box(c, LEFT, y - 3.2*cm, 10*cm, 3.0*cm,
["Prognosis: Lepidic best > Acinar/Papillary > Micropapillary/Solid worst",
"Tx: Resection if localised. EGFR→ osimertinib; ALK→ alectinib",
"IHC: TTF-1 +ve, Napsin A +ve, CK7 +ve, p40/p63 -ve",
"Screening: Low-dose CT for high-risk smokers (NLST/NELSON)"],
"CLINICAL PEARLS")
c.showPage()
def page_squamous(c, width, height, img_paths):
draw_ruled_background(c, width, height)
draw_header_band(c, width, height,
"SQUAMOUS CELL CARCINOMA",
"~20% of Lung Cancers • Central Airways")
LEFT = 2.3*cm
y = height - 3.5*cm
IMG_W = 7.5*cm
IMG_H = 5.5*cm
IMG_X = width - IMG_W - 1.5*cm
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"PATHOLOGY & MORPHOLOGY", HexColor("#8B1A1A"), ACCENT_RED)
y -= 0.9*cm
features = [
("Origin", "Central bronchi (proximal) via bronchial epithelium"),
("Gross", "Cavitating hilar mass; necrosis common; endobronchial growth"),
("Histology", "Keratinization, keratin pearls, intercellular bridges"),
("IHC", "p40 +ve, p63 +ve, CK5/6 +ve; TTF-1 -ve, Napsin A -ve"),
("Cavitation", "30-40% cavitate on imaging"),
]
for k, v in features:
c.setFont("Helvetica-Bold", 10)
c.setFillColor(ACCENT_RED)
kw = c.stringWidth(k + ": ", "Helvetica-Bold", 10)
c.drawString(LEFT + 12, y, k + ": ")
c.setFont("Helvetica", 10)
c.setFillColor(INK_COLOR)
c.drawString(LEFT + 12 + kw, y, v)
y -= 14
draw_image_box(c, img_paths.get("scc_central"), IMG_X,
height - 3.5*cm - 5.8*cm, IMG_W, IMG_H,
"Fig 3. Central endobronchial SCC (H&E)")
y -= 0.3*cm
draw_divider(c, LEFT, y, width - LEFT - 2*cm)
y -= 0.4*cm
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"SUBTYPES", HexColor("#8B1A1A"), ACCENT_RED)
y -= 0.9*cm
subtypes = [
("Keratinizing", "Keratin pearls; classic well-differentiated form"),
("Non-keratinizing", "Intercellular bridges; intermediate grade"),
("Basaloid", "Hyperchromatic basaloid cells; most aggressive subtype"),
]
for name, desc in subtypes:
draw_bullet_point(c, LEFT, y, desc, ACCENT_RED, 9.5, 0, name)
y -= 16
y -= 0.2*cm
draw_divider(c, LEFT, y, width - LEFT - 2*cm)
y -= 0.4*cm
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"CLINICAL FEATURES & PRESENTATION", HexColor("#8B1A1A"), ACCENT_RED)
y -= 0.9*cm
clinical = [
"Presentation: haemoptysis, cough, obstructive pneumonitis, wheeze",
"Pancoast (superior sulcus) tumour: Horner syndrome + ulnar pain + rib destruction",
"Paraneoplastic: PTHrP → hypercalcaemia (most common PNS in SCC)",
"Staging: T1-4, N0-3, M0-1 (8th ed. TNM); stage guides resection",
"Surgery: lobectomy/pneumonectomy if Stage I-IIA; 5-yr survival ~40-60%",
"Stage III-IV: concurrent chemoRT ± durvalumab (PACIFIC trial)",
"Targetable mutations: rare; FGFR1 amplification in ~20%; PD-L1 TPS guides pembrolizumab",
]
c.setFillColor(INK_COLOR)
for item in clinical:
c.setFillColor(HexColor("#8B1A1A"))
c.circle(LEFT + 5, y + 4, 2.5, fill=1, stroke=0)
c.setFillColor(INK_COLOR)
c.setFont("Helvetica", 9.5)
c.drawString(LEFT + 12, y, item)
y -= 13
draw_image_box(c, img_paths.get("scc_periph"),
IMG_X, height - 3.5*cm - 12.5*cm,
IMG_W, IMG_H,
"Fig 4. Peripheral SCC with keratinization (H&E)")
draw_note_box(c, LEFT, y - 3.0*cm, 10*cm, 2.8*cm,
["Key drug: Pembrolizumab (if PD-L1 ≥50%) or carbo+paclitaxel",
"Cavitating central mass in smoker = SCC until proven otherwise",
"No approved EGFR/ALK inhibitors for SCC — always test histology",
"FGFR1 amp & PIK3CA mut = emerging targets"],
"CLINICAL PEARLS")
c.showPage()
def page_sclc(c, width, height, img_paths):
draw_ruled_background(c, width, height)
draw_header_band(c, width, height,
"SMALL CELL LUNG CANCER (SCLC)",
"~14% of Lung Cancers • High-Grade Neuroendocrine")
LEFT = 2.3*cm
y = height - 3.5*cm
IMG_W = 7.5*cm
IMG_H = 5.5*cm
IMG_X = width - IMG_W - 1.5*cm
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"PATHOLOGY & HISTOLOGY", HexColor("#1A1A6B"), ACCENT_PURPLE)
y -= 0.9*cm
features = [
("Origin", "Central bronchi; Kulchitsky (neuroendocrine) cells"),
("Gross", "Large perihilar mass; soft; extensive necrosis; hilar/mediastinal LN"),
("Cell size", "Small (2x lymphocyte); scant cytoplasm; ill-defined borders"),
("Nucleus", "Finely granular 'salt & pepper' chromatin; absent/inconspicuous nucleoli"),
("IHC", "CD56 +ve, synaptophysin +ve, chromogranin +ve, TTF-1 +ve (~80%), INSM1 +ve"),
("Mitoses", "Very high Ki-67 (>50-80%); brisk mitotic activity; necrosis"),
("Crush artifact", "Common on biopsy — Azzopardi effect"),
]
for k, v in features:
c.setFont("Helvetica-Bold", 9.5)
c.setFillColor(ACCENT_PURPLE)
kw = c.stringWidth(k + ": ", "Helvetica-Bold", 9.5)
c.drawString(LEFT + 12, y, k + ": ")
c.setFont("Helvetica", 9.5)
c.setFillColor(INK_COLOR)
c.drawString(LEFT + 12 + kw, y, v)
y -= 13
draw_image_box(c, img_paths.get("sclc_hist"), IMG_X,
height - 3.5*cm - 5.8*cm, IMG_W, IMG_H,
"Fig 5. SCLC — nuclear molding, necrosis (H&E)")
y -= 0.3*cm
draw_divider(c, LEFT, y, width - LEFT - 2*cm)
y -= 0.4*cm
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"STAGING (Veterans' Administration)", HexColor("#1A1A6B"), ACCENT_PURPLE)
y -= 0.9*cm
stages = [
("Limited Disease (LD)", "~30%", "Ipsilateral hemithorax + regional LN; fits one RT field"),
("Extensive Disease (ED)", "~70%", "Beyond LD; contralateral lung; distant mets (brain, liver, bone, adrenal)"),
]
for stage, pct, desc in stages:
c.setFont("Helvetica-Bold", 10)
c.setFillColor(ACCENT_PURPLE)
c.drawString(LEFT + 12, y, f"{stage} ({pct})")
y -= 13
c.setFont("Helvetica", 9.5)
c.setFillColor(INK_COLOR)
c.drawString(LEFT + 20, y, f"→ {desc}")
y -= 14
y -= 0.2*cm
draw_divider(c, LEFT, y, width - LEFT - 2*cm)
y -= 0.4*cm
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"PARANEOPLASTIC SYNDROMES & TREATMENT", HexColor("#1A1A6B"), ACCENT_PURPLE)
y -= 0.9*cm
sclc_info = [
"PNS: SIADH (ectopic ADH), Cushing (ectopic ACTH), Lambert-Eaton, encephalitis",
"LD Treatment: Concurrent chemoRT (etoposide+cisplatin) + prophylactic cranial irradiation (PCI)",
"ED Treatment: EP (etoposide+platinum) + atezolizumab or durvalumab (IMpower133/CASPIAN)",
"Median survival LD: ~20 months | ED: ~10 months",
"2-year survival LD: ~40% | ED: <5%",
"Transforms from NSCLC (esp. after EGFR-TKI treatment) in ~5-10%",
"Nearly always unresectable; rare Stage I cases may benefit from surgery",
]
c.setFillColor(INK_COLOR)
for item in sclc_info:
c.setFillColor(ACCENT_PURPLE)
c.circle(LEFT + 5, y + 4, 2.5, fill=1, stroke=0)
c.setFillColor(INK_COLOR)
c.setFont("Helvetica", 9.5)
c.drawString(LEFT + 12, y, item)
y -= 13
draw_note_box(c, LEFT, y - 2.8*cm, 10*cm, 2.6*cm,
["Oat-cell = classic name; 'oat-like' nuclear shape",
"Rapid doubling time — diagnose & treat urgently",
"Responds dramatically to chemotherapy INITIALLY",
"Relapse almost universal; becomes chemo-resistant quickly"],
"CLINICAL PEARLS")
c.showPage()
def page_large_cell(c, width, height, img_paths):
draw_ruled_background(c, width, height)
draw_header_band(c, width, height,
"LARGE CELL CARCINOMA & LCNEC",
"Large Cell Carcinoma <10% • Large Cell NEC ~3%")
LEFT = 2.3*cm
y = height - 3.5*cm
IMG_W = 7.5*cm
IMG_H = 5.5*cm
IMG_X = width - IMG_W - 1.5*cm
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"LARGE CELL CARCINOMA (LCC) — DIAGNOSIS OF EXCLUSION",
HexColor("#4A235A"), ACCENT_PURPLE)
y -= 0.9*cm
features = [
("Definition", "Undifferentiated NSCLC: NO squamous, glandular, or NE features"),
("Location", "Often peripheral; large mass with necrosis"),
("Histology", "Large polygonal cells, vesicular nuclei, prominent nucleoli, no keratin/mucin"),
("IHC", "CK +ve, TTF-1/p40 typically -ve; NE markers -ve; diagnosis requires resection"),
("Prognosis", "5-year survival ~11-15%; similar to other high-grade NSCLC"),
]
for k, v in features:
c.setFont("Helvetica-Bold", 9.5)
c.setFillColor(ACCENT_PURPLE)
kw = c.stringWidth(k + ": ", "Helvetica-Bold", 9.5)
c.drawString(LEFT + 12, y, k + ": ")
c.setFont("Helvetica", 9.5)
c.setFillColor(INK_COLOR)
c.drawString(LEFT + 12 + kw, y, v)
y -= 13
y -= 0.4*cm
draw_divider(c, LEFT, y, width - LEFT - 2*cm)
y -= 0.4*cm
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"LARGE CELL NEUROENDOCRINE CARCINOMA (LCNEC)",
HexColor("#4A235A"), ACCENT_ORANGE)
y -= 0.9*cm
lcnec_features = [
("Definition", "High-grade NE carcinoma; resembles SCLC but with large cells"),
("Histology", "Nests/sheets of large cells; prominent nucleoli; necrosis; ≥11 mitoses/2mm²"),
("IHC", "Synaptophysin +ve, chromogranin +ve, CD56 +ve; Ki-67 ~50-90%"),
("Genetics", "TP53 + RB1 mutations (like SCLC); STK11, KEAP1 alterations"),
("Treatment", "Platinum + etoposide (SCLC-like) OR platinum + taxane/gemcitabine"),
("Prognosis", "5-year survival ~15-57% (stage-dependent); aggressive course"),
]
for k, v in lcnec_features:
c.setFont("Helvetica-Bold", 9.5)
c.setFillColor(ACCENT_ORANGE)
kw = c.stringWidth(k + ": ", "Helvetica-Bold", 9.5)
c.drawString(LEFT + 12, y, k + ": ")
c.setFont("Helvetica", 9.5)
c.setFillColor(INK_COLOR)
c.drawString(LEFT + 12 + kw, y, v)
y -= 13
draw_image_box(c, img_paths.get("lcnec_hist"), IMG_X,
height - 3.5*cm - 12.0*cm, IMG_W, IMG_H,
"Fig 6. Large Cell NEC — large cells, prominent nucleoli (H&E)")
y -= 0.3*cm
draw_divider(c, LEFT, y, width - LEFT - 2*cm)
y -= 0.4*cm
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"TREATMENT PRINCIPLES FOR LCC/LCNEC", HexColor("#4A235A"), ACCENT_ORANGE)
y -= 0.9*cm
tx = [
"LCC: treat as NSCLC — surgery (stage I-II), chemoRT (III), systemic therapy (IV)",
"LCNEC: platinum/etoposide preferred; SCLC-like behaviour; chemoRT for LD",
"Immunotherapy: pembrolizumab/nivolumab if PD-L1 +ve or TMB-high",
"Molecular testing: full NGS panel — may find targetable EGFR/ALK/ROS1 in ~5-10%",
"Surgery: only for early-stage; recurrence common; poor prognosis overall",
]
c.setFillColor(INK_COLOR)
for item in tx:
c.setFillColor(ACCENT_ORANGE)
c.circle(LEFT + 5, y + 4, 2.5, fill=1, stroke=0)
c.setFillColor(INK_COLOR)
c.setFont("Helvetica", 9.5)
c.drawString(LEFT + 12, y, item)
y -= 13
c.showPage()
def page_carcinoid(c, width, height, img_paths):
draw_ruled_background(c, width, height)
draw_header_band(c, width, height,
"PULMONARY CARCINOID TUMORS",
"Low/Intermediate-Grade Neuroendocrine • ~1-2% of Lung Tumors")
LEFT = 2.3*cm
y = height - 3.5*cm
IMG_W = 7.5*cm
IMG_H = 5.0*cm
IMG_X = width - IMG_W - 1.5*cm
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"TYPICAL CARCINOID (TC) vs ATYPICAL CARCINOID (AC)",
ACCENT_GREEN, HexColor("#1E8449"))
y -= 0.9*cm
# Comparison table header
cols = [LEFT+0.3*cm, LEFT+5.5*cm, LEFT+11.0*cm]
headers = ["Feature", "Typical Carcinoid (TC)", "Atypical Carcinoid (AC)"]
c.setFillColor(ACCENT_GREEN)
c.rect(LEFT, y - 2, width - LEFT - 2*cm, 16, fill=1, stroke=0)
for i, (cx, h) in enumerate(zip(cols, headers)):
c.setFillColor(white)
c.setFont("Helvetica-Bold", 9.5)
c.drawString(cx, y, h)
y -= 18
rows = [
("Mitoses", "< 2 per 2mm²", "2-10 per 2mm²"),
("Necrosis", "Absent", "Focal necrosis present"),
("Grade", "Low (G1)", "Intermediate (G2)"),
("Ki-67", "< 5%", "5-20%"),
("Location", "Central (2/3)", "More peripheral"),
("Metastasis", "Rare (~5% lymph node)", "~50-70% lymph node mets"),
("5-yr survival", "~87-90%", "~44-70%"),
("Genetics", "MEN1 mutations", "MEN1 + TP53/RB1"),
]
alt = False
for row in rows:
if alt:
c.setFillColor(HexColor("#E8F8F5"))
c.rect(LEFT, y - 2, width - LEFT - 2*cm, 14, fill=1, stroke=0)
alt = not alt
c.setFont("Helvetica-Bold", 9) if row[0] in ("Grade","5-yr survival") else c.setFont("Helvetica", 9)
for cx, val in zip(cols, row):
c.setFillColor(HEADING_COLOR)
c.drawString(cx, y, val)
y -= 14
draw_image_box(c, img_paths.get("carcinoid_hist"), IMG_X,
height - 3.5*cm - 5.8*cm, IMG_W, IMG_H,
"Fig 7. Bronchial carcinoid — organoid nests (H&E)")
y -= 0.4*cm
draw_divider(c, LEFT, y, width - LEFT - 2*cm)
y -= 0.4*cm
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"HISTOLOGY & IHC", ACCENT_GREEN)
y -= 0.9*cm
hist_items = [
("Cells", "Uniform round/oval; finely stippled 'salt & pepper' chromatin"),
("Architecture", "Nests, trabeculae, ribbon-like, organoid patterns"),
("Stroma", "Delicate fibrovascular cores; amyloid deposition possible"),
("IHC positive", "Chromogranin A, synaptophysin, CD56, NSE"),
("IHC negative", "p40, p63, TTF-1 usually negative (unlike SCLC)"),
]
for k, v in hist_items:
c.setFont("Helvetica-Bold", 9.5)
c.setFillColor(ACCENT_GREEN)
kw = c.stringWidth(k + ": ", "Helvetica-Bold", 9.5)
c.drawString(LEFT + 12, y, k + ": ")
c.setFont("Helvetica", 9.5)
c.setFillColor(INK_COLOR)
c.drawString(LEFT + 12 + kw, y, v)
y -= 13
y -= 0.2*cm
draw_divider(c, LEFT, y, width - LEFT - 2*cm)
y -= 0.4*cm
draw_section_header(c, LEFT, y, width - LEFT - 2*cm, 0.65*cm,
"CLINICAL FEATURES & MANAGEMENT", ACCENT_GREEN)
y -= 0.9*cm
clin = [
"Presentation: haemoptysis, cough, recurrent pneumonia (central), incidental (peripheral)",
"Carcinoid syndrome: rare (<5%) — only if hepatic mets: flushing, diarrhoea, wheezing",
"Ectopic ACTH: Cushing syndrome (atypical carcinoid more often)",
"Imaging: well-defined endobronchial mass on CT; Octreotide scintigraphy positive",
"Surgery = DEFINITIVE tx: sleeve resection/lobectomy; bronchoplasty to spare lung",
"Somatostatin analogues (octreotide/lanreotide): carcinoid syndrome control + anti-tumour",
"Everolimus: approved for progressive, unresectable carcinoid (RADIANT-4 trial)",
]
c.setFillColor(INK_COLOR)
for item in clin:
c.setFillColor(ACCENT_GREEN)
c.circle(LEFT + 5, y + 4, 2.5, fill=1, stroke=0)
c.setFillColor(INK_COLOR)
c.setFont("Helvetica", 9.5)
c.drawString(LEFT + 12, y, item)
y -= 13
draw_image_box(c, img_paths.get("carcinoid_gross"),
IMG_X, height - 3.5*cm - 13.0*cm,
IMG_W, 4.5*cm,
"Fig 8. Gross carcinoid — polypoid endobronchial mass")
c.showPage()
def page_summary(c, width, height):
draw_ruled_background(c, width, height)
draw_header_band(c, width, height,
"COMPARISON SUMMARY",
"Lung Cancer Types at a Glance")
LEFT = 2.3*cm
y = height - 3.5*cm
# Table header
col_w = [4.5*cm, 2.2*cm, 2.8*cm, 3.0*cm, 2.5*cm]
col_x = [LEFT]
for w in col_w[:-1]:
col_x.append(col_x[-1] + w)
headers = ["Type", "Freq", "Location", "Key IHC", "Smoking"]
c.setFillColor(TITLE_BG)
c.rect(LEFT, y - 3, sum(col_w), 18, fill=1, stroke=0)
c.setFillColor(white)
c.setFont("Helvetica-Bold", 10)
for cx, h in zip(col_x, headers):
c.drawString(cx + 3, y, h)
y -= 20
table_data = [
("Adenocarcinoma", "~38%", "Peripheral", "TTF1+ NapA+", "Moderate", ACCENT_BLUE),
("Squamous Cell Ca", "~20%", "Central", "p40+ p63+", "Strong", ACCENT_RED),
("Small Cell Ca (SCLC)","~14%", "Central", "CD56+ Syn+ Chr+","Very Strong",ACCENT_PURPLE),
("Large Cell Ca", "<10%", "Peripheral", "Exclusion dx", "Strong", ACCENT_ORANGE),
("LCNEC", "~3%", "Peripheral", "NE markers+", "Strong", HexColor("#D35400")),
("Typical Carcinoid", "~1%", "Central", "Chr+ Syn+ CD56+","None/weak",ACCENT_GREEN),
("Atypical Carcinoid", "<1%", "Peripheral", "Chr+ Syn+", "None/weak", HexColor("#1E8449")),
("Adenosquamous", "~1%", "Peripheral", "Both TTF1+p40+","Strong", HexColor("#7D6608")),
]
alt = False
for row in table_data:
*vals, row_color = row
if alt:
c.setFillColor(HexColor("#F0F0F0"))
c.rect(LEFT, y - 3, sum(col_w), 15, fill=1, stroke=0)
alt = not alt
for cx, val in zip(col_x, vals):
c.setFillColor(row_color if cx == col_x[0] else INK_COLOR)
c.setFont("Helvetica-Bold" if cx == col_x[0] else "Helvetica", 9)
c.drawString(cx + 3, y, val)
y -= 16
y -= 0.6*cm
draw_divider(c, LEFT, y, sum(col_w))
y -= 0.5*cm
# Staging overview
draw_section_header(c, LEFT, y, sum(col_w), 0.65*cm,
"STAGING & TREATMENT FRAMEWORK", TITLE_BG, ACCENT_BLUE)
y -= 0.9*cm
staging_rows = [
("NSCLC Stage I-II", "Surgery (lobectomy) ± adjuvant chemo/osimertinib (EGFR+)"),
("NSCLC Stage III", "Concurrent chemoRT + durvalumab (unresectable; PACIFIC trial)"),
("NSCLC Stage IV", "Targeted therapy (EGFR/ALK/ROS1/BRAF) or CPI ± chemo"),
("SCLC Limited", "Concurrent EP-chemo + thoracic RT + PCI"),
("SCLC Extensive", "EP + atezolizumab/durvalumab; PCI if responding"),
("Carcinoid", "Surgery (curative); octreotide/lanreotide; everolimus (2nd line)"),
]
for stage, tx in staging_rows:
c.setFont("Helvetica-Bold", 9.5)
c.setFillColor(ACCENT_BLUE)
sw = c.stringWidth(stage + ": ", "Helvetica-Bold", 9.5)
c.drawString(LEFT + 12, y, stage + ": ")
c.setFont("Helvetica", 9.5)
c.setFillColor(INK_COLOR)
c.drawString(LEFT + 12 + sw, y, tx)
y -= 14
y -= 0.4*cm
draw_divider(c, LEFT, y, sum(col_w))
y -= 0.5*cm
draw_section_header(c, LEFT, y, sum(col_w), 0.65*cm,
"HIGH-YIELD ASSOCIATIONS FOR EXAMS", ACCENT_RED)
y -= 0.9*cm
mnemonics = [
"Central + smoker + cavitation + hypercalcaemia → SCC (PTHrP)",
"Central + smoker + SIADH/ACTH/Lambert-Eaton → SCLC",
"Peripheral + never-smoker/woman + EGFR → Adenocarcinoma",
"Haemoptysis + endobronchial mass + no smoking → Carcinoid",
"Large peripheral mass + exclusion dx + smoker → Large Cell Ca",
"Crush artefact on biopsy → SCLC",
"Keratin pearls + intercellular bridges → Squamous Cell Ca",
"Lepidic growth (ground-glass on CT) → Adenocarcinoma in situ",
]
c.setFillColor(INK_COLOR)
for item in mnemonics:
c.setFillColor(ACCENT_RED)
c.circle(LEFT + 5, y + 4, 2.5, fill=1, stroke=0)
c.setFillColor(INK_COLOR)
c.setFont("Helvetica", 9.5)
c.drawString(LEFT + 12, y, item)
y -= 13
c.showPage()
# ── Main ──────────────────────────────────────────────────────────────────────
def main():
print("Downloading images...")
img_paths = {}
for name, url in IMAGES.items():
print(f" Downloading {name}...")
img_paths[name] = download_image(url, name)
print("Building PDF...")
c = canvas.Canvas(OUTPUT_FILE, pagesize=A4)
width, height = A4
c.setTitle("Lung Cancer Types — Handwritten Notes")
c.setAuthor("Orris Medical Library")
c.setSubject("Lung Cancer Classification, Pathology, and Clinical Features")
page_cover(c, width, height, img_paths)
page_overview(c, width, height)
page_adenocarcinoma(c, width, height, img_paths)
page_squamous(c, width, height, img_paths)
page_sclc(c, width, height, img_paths)
page_large_cell(c, width, height, img_paths)
page_carcinoid(c, width, height, img_paths)
page_summary(c, width, height)
c.save()
print(f"PDF saved to: {OUTPUT_FILE}")
if __name__ == "__main__":
main()
cd /tmp/workspace/lung-cancer-notes && python generate_pdf.py 2>&1
ls -lh /tmp/workspace/lung-cancer-notes/*.pdf
Lung Cancer Types Handwritten Notes
PDF Document · PDF
| Page | Content |
|---|---|
| Cover | Title page with a lung cancer histology frequency pie chart (real pathology image) |
| Overview | WHO 2021 classification of all types, epidemiology key facts |
| Adenocarcinoma | Morphology, 6 growth patterns (lepidic to solid), molecular targets (EGFR/KRAS/ALK/ROS1), 2 histology images |
| Squamous Cell Carcinoma | Pathology, 3 subtypes (keratinizing/non-keratinizing/basaloid), clinical features & treatment, 2 histology images |
| SCLC | Histology (oat cell), VA staging (LD vs ED), paraneoplastic syndromes, treatment (EP + immunotherapy), histology image |
| Large Cell Ca & LCNEC | LCC as exclusion diagnosis + LCNEC molecular/treatment differences, histology image |
| Pulmonary Carcinoids | Typical vs Atypical comparison table, IHC, management (surgery/octreotide/everolimus), gross + histology images |
| Summary | Full comparison table of all types + staging framework + high-yield exam associations |