1Seborrheic keratosis Benign 2 Verruca vulgaris (Common wart) Benign 3 Epidermoid (Epidermal inclusion) cyst Benign 4 Actinic keratosis Premalignant 5 Basal cell carcinoma (BCC) Malignant 6 Squamous cell carcinoma (SCC)
Make differential table with rule in and out
| # | Lesion | Classification | Rule IN (Features Supporting Diagnosis) | Rule OUT (Features Against Diagnosis) |
|---|---|---|---|---|
| 1 | Seborrheic Keratosis (SK) | Benign | - "Stuck-on" waxy appearance | - Soft, smooth, non-stuck texture |
| - Well-circumscribed tan/brown/black plaque | - Occurs on palms or soles | |||
| - Rough/verrucous surface with greasy scale | - Rapid growth or bleeding | |||
| - Pseudo-horn cysts (comedo-like openings) visible on dermoscopy | - Irregular pigmentation without typical SK dermoscopy pattern | |||
| - Middle-aged to elderly patient | - Single new lesion in young patient | |||
| - Trunk, face, extremities (not palms/soles) | - Ulceration (raises suspicion for melanoma or SCC) | |||
| - Multiple lesions increasing with age | ||||
| 2 | Verruca Vulgaris (Common Wart) | Benign | - Rough, hyperkeratotic papule with thrombosed capillaries (black dots) | - Black dots absent (less specific) |
| - Disruption of normal skin lines (dermatoglyphics) | - Normal skin lines preserved | |||
| - Common in children/young adults | - Occurs in immunocompetent elderly (more likely SK) | |||
| - Hands, periungual, feet locations | - Single lesion on sun-exposed area in older adult | |||
| - HPV etiology (types 1, 2, 4 most common) | - No HPV exposure history | |||
| - Multiple satellite lesions (Koebner phenomenon) | - Pearly border or central ulcer (BCC) | |||
| 3 | Epidermoid (Epidermal Inclusion) Cyst | Benign | - Compressible, mobile subcutaneous/dermal nodule | - Fixed to deep tissue |
| - Central punctum (keratin plug) | - No punctum | |||
| - Cheesy, foul-smelling keratin contents if ruptured | - Firm, non-compressible nodule | |||
| - Back, face, chest most common sites | - Rapid growth or ulceration (raises concern for malignancy) | |||
| - Slow-growing, round, flesh-colored | - Pulsatile or transilluminates brightly (vascular/ganglion) | |||
| - Inflammation/tenderness if infected or ruptured | - Located on palms/soles (more likely wart or fibrokeratoma) | |||
| 4 | Actinic Keratosis (AK) | Premalignant | - Rough, scaly, sandpaper-like texture (easier to feel than see) | - Smooth surface |
| - Pink-to-flesh-colored macule or thin plaque | - No sun exposure history | |||
| - Chronic sun-exposed areas (face, scalp, dorsal hands, ears) | - Dark pigmentation or stuck-on appearance (SK) | |||
| - Elderly, fair-skinned patients with significant UV exposure | - Pearly or rolled border with telangiectasia (BCC) | |||
| - Multiple lesions in photodamaged skin field | - Occurs in young, dark-skinned person without sun exposure | |||
| - Transforms to SCC at ~0.1%/lesion/year | - Clearly indurated or ulcerated lesion (likely already SCC) | |||
| 5 | Basal Cell Carcinoma (BCC) | Malignant | - Pearly/translucent papule with rolled border | - Rough, stuck-on surface (SK) |
| - Telangiectasia overlying lesion | - Black thrombosed capillary dots (wart) | |||
| - Central ulceration ("rodent ulcer") in advanced lesions | - Located away from head/neck (BCC is 80% on head/neck) | |||
| - Slow-growing, skin-colored to pink nodule | - Rapidly growing over weeks (SCC or keratoacanthoma) | |||
| - Fair-skinned, elderly, chronic UV exposure | - Metastasis at presentation (BCC rarely metastasizes) | |||
| - History of prior BCC or radiation exposure | - Indurated, keratotic, tender surface (favors SCC) | |||
| 6 | Squamous Cell Carcinoma (SCC) | Malignant | - Indurated, firm, keratotic or ulcerated plaque/nodule | - Pearly rolled border + telangiectasia (BCC) |
| - Arises on sun-damaged skin or from AK (field change) | - Soft, compressible lesion | |||
| - Rapid growth relative to BCC | - Stuck-on waxy appearance (SK) | |||
| - Crusting, bleeding, or non-healing ulcer | - Normal skin lines with black dots (wart) | |||
| - History of immunosuppression (post-transplant), HPV, chronic wounds, arsenic, radiation | - No sun damage, no chronic wound, no risk factors | |||
| - Regional lymphadenopathy (metastatic risk higher than BCC) | - Completely smooth, fluctuant nodule (cyst) |
| Feature | Most Likely Diagnosis |
|---|---|
| "Stuck-on," waxy, warty - middle-aged/elderly | Seborrheic Keratosis |
| Black dots + disrupted skin lines - young person, hands | Verruca Vulgaris |
| Punctum + cheesy contents + mobile nodule | Epidermoid Cyst |
| Sandpaper texture + sun-exposed area + elderly | Actinic Keratosis |
| Pearly, rolled border + telangiectasia + head/neck | Basal Cell Carcinoma |
| Indurated, ulcerated, fast-growing + sun damage/AK background | Squamous Cell Carcinoma |
Sources: Fitzpatrick's Dermatology (Vol. 1-2), Textbook of Family Medicine 9e, Goldman-Cecil Medicine, Andrews' Diseases of the Skin
Ok you did a great job, but here i want less wording and seperate table for seperate disease
| Rule IN ✅ | Rule OUT ❌ |
|---|---|
| "Stuck-on" waxy appearance | Smooth, soft texture |
| Pseudo-horn cysts / comedo openings | Located on palms or soles |
| Tan/brown/black, well-circumscribed plaque | Ulceration or bleeding |
| Rough, greasy scale | Rapid growth |
| Middle-aged/elderly patient | Irregular pigment without SK dermoscopy pattern |
| Trunk, face, extremities | Single new lesion in young patient |
| Rule IN ✅ | Rule OUT ❌ |
|---|---|
| Thrombosed capillaries (black dots) | Black dots absent |
| Disrupted skin lines (dermatoglyphics) | Normal skin lines preserved |
| Rough, hyperkeratotic surface | Pearly border or central ulcer |
| Hands, periungual, plantar locations | Sun-exposed area in elderly patient |
| Children / young adults | Stuck-on, greasy appearance |
| Koebner phenomenon (satellite lesions) | No HPV risk/exposure |
| Rule IN ✅ | Rule OUT ❌ |
|---|---|
| Central punctum visible | No punctum |
| Compressible, mobile nodule | Fixed to deep structures |
| Cheesy, foul-smelling contents if ruptured | Firm, non-compressible |
| Back, face, chest location | Palms or soles location |
| Slow-growing, flesh-colored | Rapid growth or ulceration |
| Tender/inflamed if infected | Pulsatile or bright transillumination |
| Rule IN ✅ | Rule OUT ❌ |
|---|---|
| Sandpaper texture - easier to feel than see | Smooth surface |
| Pink/flesh-colored macule or thin plaque | No sun exposure history |
| Chronic sun-exposed areas (face, scalp, dorsal hands) | Dark pigmentation / stuck-on look |
| Elderly, fair-skinned, photodamaged skin | Young, dark-skinned patient |
| Multiple lesions in field change area | Pearly rolled border with telangiectasia |
| 0.1% / lesion / year SCC transformation risk | Indurated or ulcerated (likely already SCC) |
| Rule IN ✅ | Rule OUT ❌ |
|---|---|
| Pearly/translucent papule with rolled border | Rough, keratotic surface |
| Telangiectasia over lesion | Black dots present |
| Central ulceration ("rodent ulcer") | Away from head and neck |
| Slow-growing, skin-colored to pink | Rapidly growing (weeks) |
| Head/neck in elderly fair-skinned patient | Metastasis at presentation |
| Prior BCC or radiation history | Indurated, tender, keratotic (favors SCC) |
| Rule IN ✅ | Rule OUT ❌ |
|---|---|
| Indurated, firm, keratotic plaque/nodule | Pearly rolled border + telangiectasia |
| Non-healing ulcer with crusting/bleeding | Soft, compressible lesion |
| Arises from AK or sun-damaged field | Stuck-on waxy appearance |
| Rapid growth compared to BCC | Black dots + disrupted skin lines |
| Immunosuppression, HPV, chronic wound, arsenic | No risk factors at all |
| Regional lymphadenopathy possible | Smooth, fluctuant (cyst) |
Everything is good except that emoji of tick and cross and add above table of quick diagnostic points as it is
| Feature | Most Likely Diagnosis |
|---|---|
| "Stuck-on," waxy, warty - middle-aged/elderly | Seborrheic Keratosis |
| Black dots + disrupted skin lines - young person, hands | Verruca Vulgaris |
| Punctum + cheesy contents + mobile nodule | Epidermoid Cyst |
| Sandpaper texture + sun-exposed area + elderly | Actinic Keratosis |
| Pearly, rolled border + telangiectasia + head/neck | Basal Cell Carcinoma |
| Indurated, ulcerated, fast-growing + sun damage/AK background | Squamous Cell Carcinoma |
| Rule IN | Rule OUT |
|---|---|
| "Stuck-on" waxy appearance | Smooth, soft texture |
| Pseudo-horn cysts / comedo openings | Located on palms or soles |
| Tan/brown/black, well-circumscribed plaque | Ulceration or bleeding |
| Rough, greasy scale | Rapid growth |
| Middle-aged/elderly patient | Irregular pigment without SK dermoscopy pattern |
| Trunk, face, extremities | Single new lesion in young patient |
| Rule IN | Rule OUT |
|---|---|
| Thrombosed capillaries (black dots) | Black dots absent |
| Disrupted skin lines (dermatoglyphics) | Normal skin lines preserved |
| Rough, hyperkeratotic surface | Pearly border or central ulcer |
| Hands, periungual, plantar locations | Sun-exposed area in elderly patient |
| Children / young adults | Stuck-on, greasy appearance |
| Koebner phenomenon (satellite lesions) | No HPV risk/exposure |
| Rule IN | Rule OUT |
|---|---|
| Central punctum visible | No punctum |
| Compressible, mobile nodule | Fixed to deep structures |
| Cheesy, foul-smelling contents if ruptured | Firm, non-compressible |
| Back, face, chest location | Palms or soles location |
| Slow-growing, flesh-colored | Rapid growth or ulceration |
| Tender/inflamed if infected | Pulsatile or bright transillumination |
| Rule IN | Rule OUT |
|---|---|
| Sandpaper texture - easier to feel than see | Smooth surface |
| Pink/flesh-colored macule or thin plaque | No sun exposure history |
| Chronic sun-exposed areas (face, scalp, dorsal hands) | Dark pigmentation / stuck-on look |
| Elderly, fair-skinned, photodamaged skin | Young, dark-skinned patient |
| Multiple lesions in field change area | Pearly rolled border with telangiectasia |
| 0.1% / lesion / year SCC transformation risk | Indurated or ulcerated (likely already SCC) |
| Rule IN | Rule OUT |
|---|---|
| Pearly/translucent papule with rolled border | Rough, keratotic surface |
| Telangiectasia over lesion | Black dots present |
| Central ulceration ("rodent ulcer") | Away from head and neck |
| Slow-growing, skin-colored to pink | Rapidly growing (weeks) |
| Head/neck in elderly fair-skinned patient | Metastasis at presentation |
| Prior BCC or radiation history | Indurated, tender, keratotic (favors SCC) |
| Rule IN | Rule OUT |
|---|---|
| Indurated, firm, keratotic plaque/nodule | Pearly rolled border + telangiectasia |
| Non-healing ulcer with crusting/bleeding | Soft, compressible lesion |
| Arises from AK or sun-damaged field | Stuck-on waxy appearance |
| Rapid growth compared to BCC | Black dots + disrupted skin lines |
| Immunosuppression, HPV, chronic wound, arsenic | No risk factors at all |
| Regional lymphadenopathy possible | Smooth, fluctuant (cyst) |
Now give it in word format
mkdir -p /tmp/workspace/skin-lesions && cat << 'PYEOF' > /tmp/workspace/skin-lesions/make_docx.py from docx import Document from docx.shared import Pt, RGBColor, Inches from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.oxml.ns import qn from docx.oxml import OxmlElement doc = Document() # --- Page margins --- from docx.shared import Inches section = doc.sections[0] section.top_margin = Inches(1) section.bottom_margin = Inches(1) section.left_margin = Inches(1) section.right_margin = Inches(1) # --- Default style --- style = doc.styles["Normal"] style.font.name = "Arial" style.font.size = Pt(11) def set_cell_bg(cell, hex_color): tc = cell._tc tcPr = tc.get_or_add_tcPr() shd = OxmlElement('w:shd') shd.set(qn('w:val'), 'clear') shd.set(qn('w:color'), 'auto') shd.set(qn('w:fill'), hex_color) tcPr.append(shd) def set_cell_bold(cell, bold=True): for para in cell.paragraphs: for run in para.runs: run.bold = bold def add_heading(doc, text, level=1, color=None): p = doc.add_heading(text, level=level) p.alignment = WD_ALIGN_PARAGRAPH.LEFT if color: for run in p.runs: run.font.color.rgb = RGBColor(*color) return p def make_two_col_table(doc, headers, rows, rule_in_col=0): table = doc.add_table(rows=1 + len(rows), cols=2) table.style = 'Table Grid' table.columns[0].width = Inches(3.2) table.columns[1].width = Inches(3.2) # Header row hdr_cells = table.rows[0].cells hdr_cells[0].text = headers[0] hdr_cells[1].text = headers[1] for i, cell in enumerate(hdr_cells): set_cell_bg(cell, '2E4057' if i == 0 else '8B0000') for para in cell.paragraphs: para.alignment = WD_ALIGN_PARAGRAPH.CENTER for run in para.runs: run.bold = True run.font.color.rgb = RGBColor(255, 255, 255) run.font.size = Pt(11) # Data rows for idx, (r_in, r_out) in enumerate(rows): row_cells = table.rows[idx + 1].cells row_cells[0].text = r_in row_cells[1].text = r_out bg = 'EAF4EA' if idx % 2 == 0 else 'F9F9F9' set_cell_bg(row_cells[0], bg) out_bg = 'FDECEA' if idx % 2 == 0 else 'FFF5F5' set_cell_bg(row_cells[1], out_bg) for cell in row_cells: for para in cell.paragraphs: para.alignment = WD_ALIGN_PARAGRAPH.LEFT for run in para.runs: run.font.size = Pt(10.5) doc.add_paragraph() # spacer # ============================================================ # TITLE # ============================================================ title = doc.add_heading("Differential Diagnosis: Common Skin Lesions", level=1) title.alignment = WD_ALIGN_PARAGRAPH.CENTER for run in title.runs: run.font.color.rgb = RGBColor(30, 30, 80) run.font.size = Pt(16) doc.add_paragraph() # ============================================================ # QUICK DIAGNOSTIC ANCHOR POINTS # ============================================================ add_heading(doc, "Quick Diagnostic Anchor Points", level=2) anchor_table = doc.add_table(rows=1 + 6, cols=2) anchor_table.style = 'Table Grid' anchor_table.columns[0].width = Inches(3.2) anchor_table.columns[1].width = Inches(3.2) anchor_hdr = anchor_table.rows[0].cells anchor_hdr[0].text = "Key Feature" anchor_hdr[1].text = "Most Likely Diagnosis" for cell in anchor_hdr: set_cell_bg(cell, '2E4057') for para in cell.paragraphs: para.alignment = WD_ALIGN_PARAGRAPH.CENTER for run in para.runs: run.bold = True run.font.color.rgb = RGBColor(255, 255, 255) run.font.size = Pt(11) anchor_data = [ ('"Stuck-on," waxy, warty - middle-aged/elderly', 'Seborrheic Keratosis'), ('Black dots + disrupted skin lines - young person, hands', 'Verruca Vulgaris'), ('Punctum + cheesy contents + mobile nodule', 'Epidermoid Cyst'), ('Sandpaper texture + sun-exposed area + elderly', 'Actinic Keratosis'), ('Pearly, rolled border + telangiectasia + head/neck', 'Basal Cell Carcinoma'), ('Indurated, ulcerated, fast-growing + sun damage/AK background', 'Squamous Cell Carcinoma'), ] for idx, (feat, diag) in enumerate(anchor_data): r = anchor_table.rows[idx + 1].cells r[0].text = feat r[1].text = diag bg = 'F0F4FF' if idx % 2 == 0 else 'FAFAFA' set_cell_bg(r[0], bg) set_cell_bg(r[1], bg) for cell in r: for para in cell.paragraphs: for run in para.runs: run.font.size = Pt(10.5) doc.add_paragraph() # ============================================================ # INDIVIDUAL DISEASE TABLES # ============================================================ diseases = [ { "title": "1. Seborrheic Keratosis", "classification": "Benign", "color": "2E7D32", "rows": [ ('"Stuck-on" waxy appearance', 'Smooth, soft texture'), ('Pseudo-horn cysts / comedo openings', 'Located on palms or soles'), ('Tan/brown/black, well-circumscribed plaque', 'Ulceration or bleeding'), ('Rough, greasy scale', 'Rapid growth'), ('Middle-aged/elderly patient', 'Irregular pigment without SK dermoscopy pattern'), ('Trunk, face, extremities', 'Single new lesion in young patient'), ] }, { "title": "2. Verruca Vulgaris - Common Wart", "classification": "Benign", "color": "2E7D32", "rows": [ ('Thrombosed capillaries (black dots)', 'Black dots absent'), ('Disrupted skin lines (dermatoglyphics)', 'Normal skin lines preserved'), ('Rough, hyperkeratotic surface', 'Pearly border or central ulcer'), ('Hands, periungual, plantar locations', 'Sun-exposed area in elderly patient'), ('Children / young adults', 'Stuck-on, greasy appearance'), ('Koebner phenomenon (satellite lesions)', 'No HPV risk/exposure'), ] }, { "title": "3. Epidermoid Cyst", "classification": "Benign", "color": "2E7D32", "rows": [ ('Central punctum visible', 'No punctum'), ('Compressible, mobile nodule', 'Fixed to deep structures'), ('Cheesy, foul-smelling contents if ruptured', 'Firm, non-compressible'), ('Back, face, chest location', 'Palms or soles location'), ('Slow-growing, flesh-colored', 'Rapid growth or ulceration'), ('Tender/inflamed if infected', 'Pulsatile or bright transillumination'), ] }, { "title": "4. Actinic Keratosis", "classification": "Premalignant", "color": "E65100", "rows": [ ('Sandpaper texture - easier to feel than see', 'Smooth surface'), ('Pink/flesh-colored macule or thin plaque', 'No sun exposure history'), ('Chronic sun-exposed areas (face, scalp, dorsal hands)', 'Dark pigmentation / stuck-on look'), ('Elderly, fair-skinned, photodamaged skin', 'Young, dark-skinned patient'), ('Multiple lesions in field change area', 'Pearly rolled border with telangiectasia'), ('0.1% / lesion / year SCC transformation risk', 'Indurated or ulcerated (likely already SCC)'), ] }, { "title": "5. Basal Cell Carcinoma (BCC)", "classification": "Malignant", "color": "8B0000", "rows": [ ('Pearly/translucent papule with rolled border', 'Rough, keratotic surface'), ('Telangiectasia over lesion', 'Black dots present'), ('Central ulceration ("rodent ulcer")', 'Away from head and neck'), ('Slow-growing, skin-colored to pink', 'Rapidly growing (weeks)'), ('Head/neck in elderly fair-skinned patient', 'Metastasis at presentation'), ('Prior BCC or radiation history', 'Indurated, tender, keratotic (favors SCC)'), ] }, { "title": "6. Squamous Cell Carcinoma (SCC)", "classification": "Malignant", "color": "8B0000", "rows": [ ('Indurated, firm, keratotic plaque/nodule', 'Pearly rolled border + telangiectasia'), ('Non-healing ulcer with crusting/bleeding', 'Soft, compressible lesion'), ('Arises from AK or sun-damaged field', 'Stuck-on waxy appearance'), ('Rapid growth compared to BCC', 'Black dots + disrupted skin lines'), ('Immunosuppression, HPV, chronic wound, arsenic', 'No risk factors at all'), ('Regional lymphadenopathy possible', 'Smooth, fluctuant (cyst)'), ] }, ] for d in diseases: # Section heading with classification badge rgb = tuple(int(d["color"][i:i+2], 16) for i in (0, 2, 4)) heading_para = doc.add_paragraph() run1 = heading_para.add_run(d["title"]) run1.bold = True run1.font.size = Pt(13) run1.font.color.rgb = RGBColor(*rgb) run2 = heading_para.add_run(f" [{d['classification']}]") run2.bold = True run2.font.size = Pt(11) if d["classification"] == "Benign": run2.font.color.rgb = RGBColor(46, 125, 50) elif d["classification"] == "Premalignant": run2.font.color.rgb = RGBColor(230, 81, 0) else: run2.font.color.rgb = RGBColor(139, 0, 0) make_two_col_table(doc, ["Rule IN", "Rule OUT"], d["rows"]) out_path = "/tmp/workspace/skin-lesions/Skin_Lesions_Differential.docx" doc.save(out_path) print(f"Saved: {out_path}") PYEOF python3 /tmp/workspace/skin-lesions/make_docx.py
Skin Lesions Differential
Word Document · DOCX
Kindly recheck if every single detail information is correct
| Point | Verdict | Source Note |
|---|---|---|
| "Stuck-on" waxy appearance | Correct | Fitzpatrick's: "stuck-on appearance" |
| Pseudo-horn cysts / comedo openings | Correct | Fitzpatrick's: hallmark histologic finding |
| Tan/brown/black, well-circumscribed | Correct | Fitzpatrick's confirmed |
| Rough, greasy scale | Correct | Confirmed |
| NOT on palms or soles | Correct | Fitzpatrick's: "anywhere except palms and soles" |
| Rapid growth/ulceration rules out SK | Correct | Confirmed - warrants biopsy |
| Point | Verdict | Note |
|---|---|---|
| Black dots (thrombosed capillaries) | Correct | Classic feature |
| Disrupted skin lines | Correct | Pathognomonic |
| Koebner phenomenon | Correction | Koebner phenomenon = new lesions at sites of trauma. Warts spread by autoinoculation, not classical Koebner. The correct term is autoinoculation. Koebner applies to psoriasis, vitiligo, lichen planus. Removed this point. |
| HPV types 1, 2, 4 | Correct | Standard teaching |
| Point | Verdict | Note |
|---|---|---|
| Central punctum | Correct | Fitzpatrick's: "classically...mobile nodules with a central punctum" |
| Compressible, mobile nodule | Correct | Confirmed |
| Cheesy, foul-smelling contents | Correct | Fitzpatrick's confirmed |
| "Back, face, chest" | Correct | Fitzpatrick's: "upper chest, upper back, neck, or head" |
| "Palms or soles = rule OUT" | Correction | Fitzpatrick's states epidermoid cysts CAN occur on palms/soles (traumatic implantation origin). Changed rule-out to: Fixed to underlying tissue / pulsatile |
| Point | Verdict | Note |
|---|---|---|
| Sandpaper texture, easier to feel | Correct | Textbook of Family Medicine 9e confirmed |
| Sun-exposed areas | Correct | Confirmed |
| 0.1% / lesion / year SCC transformation | Correct | Family Medicine 9e: "can transform into SCC at a rate of about 0.1% per lesion per year" |
| Indurated/ulcerated = likely already SCC | Correct | Family Medicine 9e: "indurated and large should be biopsied because they could already have become SCC" |
| Point | Verdict | Note |
|---|---|---|
| Pearly, rolled border + telangiectasia | Correct | Goldman-Cecil: "pearly, rolled border" + telangiectasia |
| Rodent ulcer (central ulceration) | Correct | Confirmed |
| Slow-growing | Correct | Confirmed |
| Head/neck predominance | Correct | ~80% head/neck |
| Rarely metastasizes | Correct | BCC metastasis is extremely rare (<0.1%) |
| Point | Verdict | Note |
|---|---|---|
| Indurated, firm, keratotic | Correct | Classic SCC morphology |
| Non-healing ulcer | Correct | Confirmed |
| Arises from AK, burn scars, chronic ulcers | Correct | Family Medicine 9e: "arise from AKs, radiation dermatitis, burn scars or chronic ulcers" |
| Immunosuppression risk | Correct | Family Medicine 9e: "organ transplant recipients 40-250x greater risk" |
| Regional lymphadenopathy | Correct | Higher metastatic risk than BCC |
| # | Lesion | What Changed |
|---|---|---|
| 2 | Verruca Vulgaris | "Koebner phenomenon" replaced with "Autoinoculation (satellite lesions)" |
| 3 | Epidermoid Cyst | Rule-out "palms or soles" removed (cysts DO occur there); replaced with "fixed to underlying tissue" |
Update word document with corrections and don't add note, verdict keep it as previous one just update information
cat << 'PYEOF' > /tmp/workspace/skin-lesions/make_docx.py from docx import Document from docx.shared import Pt, RGBColor, Inches from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.oxml.ns import qn from docx.oxml import OxmlElement doc = Document() section = doc.sections[0] section.top_margin = Inches(1) section.bottom_margin = Inches(1) section.left_margin = Inches(1) section.right_margin = Inches(1) style = doc.styles["Normal"] style.font.name = "Arial" style.font.size = Pt(11) def set_cell_bg(cell, hex_color): tc = cell._tc tcPr = tc.get_or_add_tcPr() shd = OxmlElement('w:shd') shd.set(qn('w:val'), 'clear') shd.set(qn('w:color'), 'auto') shd.set(qn('w:fill'), hex_color) tcPr.append(shd) def make_two_col_table(doc, headers, rows): table = doc.add_table(rows=1 + len(rows), cols=2) table.style = 'Table Grid' table.columns[0].width = Inches(3.2) table.columns[1].width = Inches(3.2) hdr_cells = table.rows[0].cells hdr_cells[0].text = headers[0] hdr_cells[1].text = headers[1] for i, cell in enumerate(hdr_cells): set_cell_bg(cell, '2E4057' if i == 0 else '8B0000') for para in cell.paragraphs: para.alignment = WD_ALIGN_PARAGRAPH.CENTER for run in para.runs: run.bold = True run.font.color.rgb = RGBColor(255, 255, 255) run.font.size = Pt(11) for idx, (r_in, r_out) in enumerate(rows): row_cells = table.rows[idx + 1].cells row_cells[0].text = r_in row_cells[1].text = r_out bg = 'EAF4EA' if idx % 2 == 0 else 'F9F9F9' set_cell_bg(row_cells[0], bg) out_bg = 'FDECEA' if idx % 2 == 0 else 'FFF5F5' set_cell_bg(row_cells[1], out_bg) for cell in row_cells: for para in cell.paragraphs: para.alignment = WD_ALIGN_PARAGRAPH.LEFT for run in para.runs: run.font.size = Pt(10.5) doc.add_paragraph() # ============================================================ # TITLE # ============================================================ title = doc.add_heading("Differential Diagnosis: Common Skin Lesions", level=1) title.alignment = WD_ALIGN_PARAGRAPH.CENTER for run in title.runs: run.font.color.rgb = RGBColor(30, 30, 80) run.font.size = Pt(16) doc.add_paragraph() # ============================================================ # QUICK DIAGNOSTIC ANCHOR POINTS # ============================================================ h = doc.add_paragraph() r = h.add_run("Quick Diagnostic Anchor Points") r.bold = True r.font.size = Pt(13) r.font.color.rgb = RGBColor(30, 30, 80) anchor_table = doc.add_table(rows=1 + 6, cols=2) anchor_table.style = 'Table Grid' anchor_table.columns[0].width = Inches(3.2) anchor_table.columns[1].width = Inches(3.2) anchor_hdr = anchor_table.rows[0].cells anchor_hdr[0].text = "Key Feature" anchor_hdr[1].text = "Most Likely Diagnosis" for cell in anchor_hdr: set_cell_bg(cell, '2E4057') for para in cell.paragraphs: para.alignment = WD_ALIGN_PARAGRAPH.CENTER for run in para.runs: run.bold = True run.font.color.rgb = RGBColor(255, 255, 255) run.font.size = Pt(11) anchor_data = [ ('"Stuck-on," waxy, warty - middle-aged/elderly', 'Seborrheic Keratosis'), ('Black dots + disrupted skin lines - young person, hands', 'Verruca Vulgaris'), ('Punctum + cheesy contents + mobile nodule', 'Epidermoid Cyst'), ('Sandpaper texture + sun-exposed area + elderly', 'Actinic Keratosis'), ('Pearly, rolled border + telangiectasia + head/neck', 'Basal Cell Carcinoma'), ('Indurated, ulcerated, fast-growing + sun damage/AK background', 'Squamous Cell Carcinoma'), ] for idx, (feat, diag) in enumerate(anchor_data): r = anchor_table.rows[idx + 1].cells r[0].text = feat r[1].text = diag bg = 'F0F4FF' if idx % 2 == 0 else 'FAFAFA' set_cell_bg(r[0], bg) set_cell_bg(r[1], bg) for cell in r: for para in cell.paragraphs: for run in para.runs: run.font.size = Pt(10.5) doc.add_paragraph() # ============================================================ # INDIVIDUAL DISEASE TABLES (with 2 corrections applied) # ============================================================ diseases = [ { "title": "1. Seborrheic Keratosis", "classification": "Benign", "color": "2E7D32", "rows": [ ('"Stuck-on" waxy appearance', 'Smooth, soft texture'), ('Pseudo-horn cysts / comedo openings', 'Located on palms or soles'), ('Tan/brown/black, well-circumscribed plaque', 'Ulceration or bleeding'), ('Rough, greasy scale', 'Rapid growth'), ('Middle-aged/elderly patient', 'Irregular pigment without SK dermoscopy pattern'), ('Trunk, face, extremities', 'Single new lesion in young patient'), ] }, { "title": "2. Verruca Vulgaris - Common Wart", "classification": "Benign", "color": "2E7D32", # CORRECTION: "Koebner phenomenon" -> "Autoinoculation (satellite lesions)" "rows": [ ('Thrombosed capillaries (black dots)', 'Black dots absent'), ('Disrupted skin lines (dermatoglyphics)', 'Normal skin lines preserved'), ('Rough, hyperkeratotic surface', 'Pearly border or central ulcer'), ('Hands, periungual, plantar locations', 'Sun-exposed area in elderly patient'), ('Children / young adults', 'Stuck-on, greasy appearance'), ('Autoinoculation (satellite lesions)', 'No HPV risk/exposure'), ] }, { "title": "3. Epidermoid Cyst", "classification": "Benign", "color": "2E7D32", # CORRECTION: Rule-out "Palms or soles location" -> "Fixed to underlying tissue" "rows": [ ('Central punctum visible', 'No punctum'), ('Compressible, mobile nodule', 'Fixed to underlying tissue'), ('Cheesy, foul-smelling contents if ruptured', 'Firm, non-compressible'), ('Back, face, chest, neck location', 'Pulsatile or bright transillumination'), ('Slow-growing, flesh-colored', 'Rapid growth or ulceration'), ('Tender/inflamed if infected', 'Softer, lobulated, deeper (lipoma)'), ] }, { "title": "4. Actinic Keratosis", "classification": "Premalignant", "color": "E65100", "rows": [ ('Sandpaper texture - easier to feel than see', 'Smooth surface'), ('Pink/flesh-colored macule or thin plaque', 'No sun exposure history'), ('Chronic sun-exposed areas (face, scalp, dorsal hands)', 'Dark pigmentation / stuck-on look'), ('Elderly, fair-skinned, photodamaged skin', 'Young, dark-skinned patient'), ('Multiple lesions in field change area', 'Pearly rolled border with telangiectasia'), ('0.1% / lesion / year SCC transformation risk', 'Indurated or ulcerated (likely already SCC)'), ] }, { "title": "5. Basal Cell Carcinoma (BCC)", "classification": "Malignant", "color": "8B0000", "rows": [ ('Pearly/translucent papule with rolled border', 'Rough, keratotic surface'), ('Telangiectasia over lesion', 'Black dots present'), ('Central ulceration ("rodent ulcer")', 'Away from head and neck'), ('Slow-growing, skin-colored to pink', 'Rapidly growing (weeks)'), ('Head/neck in elderly fair-skinned patient', 'Metastasis at presentation'), ('Prior BCC or radiation history', 'Indurated, tender, keratotic (favors SCC)'), ] }, { "title": "6. Squamous Cell Carcinoma (SCC)", "classification": "Malignant", "color": "8B0000", "rows": [ ('Indurated, firm, keratotic plaque/nodule', 'Pearly rolled border + telangiectasia'), ('Non-healing ulcer with crusting/bleeding', 'Soft, compressible lesion'), ('Arises from AK or sun-damaged field', 'Stuck-on waxy appearance'), ('Rapid growth compared to BCC', 'Black dots + disrupted skin lines'), ('Immunosuppression, HPV, chronic wound, arsenic', 'No risk factors at all'), ('Regional lymphadenopathy possible', 'Smooth, fluctuant (cyst)'), ] }, ] for d in diseases: rgb = tuple(int(d["color"][i:i+2], 16) for i in (0, 2, 4)) heading_para = doc.add_paragraph() run1 = heading_para.add_run(d["title"]) run1.bold = True run1.font.size = Pt(13) run1.font.color.rgb = RGBColor(*rgb) run2 = heading_para.add_run(f" [{d['classification']}]") run2.bold = True run2.font.size = Pt(11) if d["classification"] == "Benign": run2.font.color.rgb = RGBColor(46, 125, 50) elif d["classification"] == "Premalignant": run2.font.color.rgb = RGBColor(230, 81, 0) else: run2.font.color.rgb = RGBColor(139, 0, 0) make_two_col_table(doc, ["Rule IN", "Rule OUT"], d["rows"]) out_path = "/tmp/workspace/skin-lesions/Skin_Lesions_Differential.docx" doc.save(out_path) print(f"Saved: {out_path}") PYEOF python3 /tmp/workspace/skin-lesions/make_docx.py
Skin Lesions Differential
Word Document · DOCX