attachment
attachment
attachment
attachment
attachment
attachment

Differential diagnosis according to history written

analyse_media
analyse_media
analyse_media
Now I have all the clinical information. Let me construct a thorough differential diagnosis.

Patient Summary - Rabeya Begum, 71F

Consolidated Clinical History:
DomainDetails
Presenting complaintsRecurrent fever with chills/rigors, ear pain, facial/neurological symptoms
FebruaryLow-grade fever (few days), abdominal pain, hemoptysis (several episodes, 1 day) - admitted to Islami Bank Hospital: Rt-sided pneumonia with abscess diagnosed - Shifted to NIDCH, received meropenem 14 days
AprilRt facial deviation, Rt ear pain with pus, slurring of speech - ENT: Rt Bell's palsy + ASOM (Acute Suppurative Otitis Media) - Neuro: Rt-sided ischemic stroke - Imaging: Rt capsulo-ganglionic infarct; Bilateral maxillary & ethmoido-sphenoido-frontal sinus collection + mucosal thickening - Admitted again: moxibac + meropenem 24 days, IV albumin x3 - 2 weeks post-discharge: WBC 16,000; ear pain recurred → Moxiclav 10 days
June 27Fever with chills and rigors; WBC 61,500 → 72,000 (extreme leukocytosis) - Urine C/S: E. coli (sensitive to colistin, ceftazidime/efitaz, fosfomycin) - Started meropenem → changed to Efitaz + Linezolid - Developed conjunctival congestion (Lt > Rt) - Bone marrow biopsy considered but deferred (hematologist: WBC elevation due to infection, not malignancy)
Past HistoryBilateral salpingo-oophorectomy + cystectomy (2003); Recurrent dental infection; H/O recurrent stroke (2 yrs back); DM 20 yrs (on insulin); HTN 20 yrs
Social/ObsHousewife; G6P6 (4 sons, 2 daughters); All vaginal deliveries; 2 units RCC transfusion Feb 2026 (Hb 6.9 g/dL)

Differential Diagnosis

PRIMARY DIAGNOSIS (Most Likely)

1. Invasive Fungal Sinusitis (Mucormycosis / Invasive Aspergillosis) with Intracranial Extension
This is the MOST compelling unifying diagnosis. The entire clinical picture fits:
  • Poorly controlled DM (20+ yrs, on insulin) = classic host for angioinvasive fungi
  • Bilateral pansinusitis (maxillary, ethmoidal, sphenoidal, frontal) on imaging
  • Rt-sided ischemic stroke / capsulo-ganglionic infarct - caused by fungal vascular invasion of the carotid siphon or perforators
  • Rt facial palsy (peripheral, diagnosed as Bell's palsy - but more likely fungal cranial nerve involvement)
  • Rt ASOM with pus + ear pain - otologic spread
  • Hemoptysis + lung abscess in February - pulmonary mucormycosis or Aspergillus
  • Failed repeated broad-spectrum antibacterial courses (meropenem, moxifloxacin) because the primary pathogen is fungal
  • Fever, leukocytosis, hypoalbuminemia (needing IV albumin) in an immunocompromised diabetic
  • Anemia requiring transfusion (Hb 6.9 - chronic disease / bone marrow suppression)
Sinusitis + stroke + diabetes + failed antibiotics = Mucormycosis until proven otherwise

DIFFERENTIAL DIAGNOSES (in order of likelihood)

2. Chronic Invasive Aspergillosis (Sinonasal + Pulmonary)
  • Also causes pansinusitis in diabetics and immunocompromised patients
  • Can cause vascular invasion and cerebral infarction
  • Pulmonary aspergillosis could explain Feb hemoptysis + abscess
  • Less fulminant than mucormycosis; more indolent progression fits this multi-month course
  • Distinguished from Mucormycosis by culture/histology (septate vs. non-septate hyphae)
3. Septic Embolic Stroke from Infective Endocarditis (IE)
  • Recurrent bacteremia (E. coli UTI, dental infections, prior procedures in 2003)
  • Rt capsulo-ganglionic infarct could be septic embolism
  • Fever, high WBC, systemic involvement across multiple organs (lung, brain, sinuses, ear)
  • Conjunctival congestion could represent Roth spots or septic emboli
  • Bilateral sinusitis could be secondary to bacteremia seeding
  • Requires echo to rule in/out
4. Granulomatosis with Polyangiitis (GPA / Wegener's)
  • Pansinusitis + pulmonary infiltrates/cavitation (abscess) + renal (E. coli may be incidental)
  • Can cause cranial nerve palsies, orbital involvement, otologic disease
  • Stroke less typical but CNS vasculitis occurs
  • Age 71F is unusual but possible; c-ANCA/PR3 would help distinguish
5. Malignancy - Sinonasal Carcinoma / Lymphoma with Intracranial Extension
  • Bilateral sinusitis in elderly with constitutional symptoms, weight loss, anemia
  • Sinonasal NK/T-cell lymphoma (previously called lethal midline granuloma) - associated with EBV, causes destructive sinonasal disease and facial palsy
  • WBC 61,500-72,000 raises concern for hematological malignancy (though hematologist attributed to infection)
  • Bone marrow biopsy was wisely considered
  • Explains treatment failure with antibiotics
6. Chronic Suppurative Otitis Media (CSOM) with Intracranial Complications
  • Rt ASOM with pus → could progress to coalescent mastoiditis → lateral sinus thrombosis → cerebral venous thrombosis → stroke-like presentation
  • Rt facial palsy from mastoid involvement of the facial nerve (more anatomically plausible than Bell's palsy in this context)
  • Sinusitis could be concurrent or secondary
  • Does not fully explain hemoptysis or extreme leukocytosis
7. Disseminated Mycobacterial Infection (TB / NTM)
  • Lung abscess + hemoptysis in February in a South Asian patient = high TB suspicion
  • Miliary TB can cause sinusitis, cerebral tuberculomas mimicking infarct
  • Chronic anemia, hypoalbuminemia, poor response to antibacterials
  • NTM (e.g., M. abscessus) increasingly seen in diabetics, can be very antibiotic resistant
  • AFB smear/culture and IGRA essential
8. Bacterial Meningitis / Intracranial Abscess from Contiguous Spread
  • Pansinusitis → direct extension through cribriform plate or via thrombophlebitis → frontal lobe abscess / meningitis
  • Explains persistent fever, neurological deterioration, facial palsy
  • Less likely to produce capsulo-ganglionic stroke pattern (deep perforator territory)
  • But sinogenic intracranial complications are well-recognized
9. Leukaemia (AML/CML) with Secondary Infection
  • WBC 61,500-72,000 is extreme and warrants serious consideration of leukemic process
  • Leukostasis can cause CNS symptoms and stroke-like presentation
  • Recurrent infections (dental, sinus, lung, urinary) suggest chronic immune dysfunction
  • Anemia (Hb 6.9) + high WBC + systemic illness = classic leukemia picture
  • Hematologist deferred bone marrow, but this should be revisited if WBC does not normalize

INVESTIGATION PRIORITIES

TestReason
MRI Brain + Paranasal Sinuses with contrast (or CT with bone windows)Characterize sinusitis extent, infarct pattern, intracranial complications, bony erosion (mucormycosis)
Nasal endoscopy + biopsy of sinus tissueHistology/culture for fungal hyphae (GMS stain) - essential for mucormycosis/Aspergillus
Serum galactomannan + beta-D-glucanAspergillus markers
Mucormycosis PCR / culture from sinus biopsy
HbA1c, fasting glucose, ketonesAssess DM control - DKA state = highest risk for mucormycosis
ANCA (c-ANCA/PR3, p-ANCA/MPO)Rule out GPA
Blood cultures x3 (aerobic + anaerobic)IE workup
Echocardiography (TTE/TEE)Vegetations for IE
AFB smear + culture + CBNAAT (sputum/BAL)TB workup
Bone marrow biopsyIf WBC remains elevated - rule out leukemia/lymphoma
Peripheral blood filmBlast cells, atypical lymphocytes
CT ChestPulmonary lesion characterization (abscess vs. cavity vs. nodule)
Urine C/S (repeat)E. coli UTI source control
Albumin, CRP, ESR, LDH, ferritinInflammatory burden, nutritional status

SUMMARY TABLE

DiagnosisSupporting FeaturesAgainst
MucormycosisDM, pansinusitis, stroke, facial palsy, ASOM, failed antibiotics, hypoalbuminemiaNo black eschar described yet
Invasive AspergillosisLung abscess, pansinusitis, DM, indolent courseLess likely to cause ASOM
Septic Embolic Stroke / IEDental/sinus infections, multi-organ involvement, conjunctival signsE. coli rarely causes IE
GPA (Wegener's)Sinusitis + lung + cranial nerveStroke pattern unusual
Sinonasal Malignancy / LymphomaRefractory course, anemia, high WBC, ageHematologist deferred BM biopsy
CSOM + Intracranial ComplicationRt ear pus, Rt facial palsy, sinusitisDoes not explain hemoptysis/lung abscess
TB / NTMLung abscess, hemoptysis, South Asian background, DMNo AFB workup documented
Leukemia (AML/CML)WBC 61-72K, anemia, recurrent infectionsHematologist felt infection-driven
The overarching unifying diagnosis to investigate urgently is angioinvasive fungal sinusitis (mucormycosis/Aspergillosis) with cerebrovascular complications in the setting of long-standing poorly controlled DM. Antifungal therapy (IV Amphotericin B liposomal) should be considered empirically while awaiting biopsy results if clinical suspicion is high, as delay in mucormycosis treatment significantly worsens mortality.

Make it in pdf file

Reading File
Running Command

mkdir -p /home/daytona/workspace/differential-dx && ls /home/daytona/workspace/

Writing File

~/differential-dx/generate_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY

OUTPUT = "/home/daytona/workspace/differential-dx/Differential_Diagnosis_Rabeya_Begum.pdf"

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=2*cm, rightMargin=2*cm,
    topMargin=2*cm, bottomMargin=2*cm
)

styles = getSampleStyleSheet()

# Custom styles
title_style = ParagraphStyle(
    "Title", parent=styles["Title"],
    fontSize=16, textColor=colors.HexColor("#1a3c5e"),
    spaceAfter=4
)
subtitle_style = ParagraphStyle(
    "Subtitle", parent=styles["Normal"],
    fontSize=11, textColor=colors.HexColor("#4a6e8a"),
    spaceAfter=10, alignment=TA_CENTER
)
h1_style = ParagraphStyle(
    "H1", parent=styles["Heading1"],
    fontSize=13, textColor=colors.HexColor("#1a3c5e"),
    spaceBefore=14, spaceAfter=4,
    borderPad=4
)
h2_style = ParagraphStyle(
    "H2", parent=styles["Heading2"],
    fontSize=11, textColor=colors.HexColor("#c0392b"),
    spaceBefore=10, spaceAfter=3
)
h3_style = ParagraphStyle(
    "H3", parent=styles["Heading3"],
    fontSize=10.5, textColor=colors.HexColor("#16a085"),
    spaceBefore=8, spaceAfter=2
)
body_style = ParagraphStyle(
    "Body", parent=styles["Normal"],
    fontSize=9.5, leading=14, spaceAfter=4,
    alignment=TA_JUSTIFY
)
bullet_style = ParagraphStyle(
    "Bullet", parent=styles["Normal"],
    fontSize=9.5, leading=13, leftIndent=14,
    bulletIndent=4, spaceAfter=2
)
small_style = ParagraphStyle(
    "Small", parent=styles["Normal"],
    fontSize=8.5, leading=12, textColor=colors.HexColor("#555555")
)
warning_style = ParagraphStyle(
    "Warning", parent=styles["Normal"],
    fontSize=9.5, leading=14, textColor=colors.HexColor("#7d1111"),
    backColor=colors.HexColor("#fff3f3"),
    borderPad=6, spaceAfter=6, spaceBefore=6,
    leftIndent=8, rightIndent=8
)

# Table styles
def section_table(header_color, data, col_widths):
    ts = TableStyle([
        ("BACKGROUND", (0,0), (-1,0), header_color),
        ("TEXTCOLOR", (0,0), (-1,0), colors.white),
        ("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
        ("FONTSIZE", (0,0), (-1,0), 9),
        ("FONTNAME", (0,1), (-1,-1), "Helvetica"),
        ("FONTSIZE", (0,1), (-1,-1), 8.5),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.white, colors.HexColor("#f0f4f8")]),
        ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#cccccc")),
        ("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),
        ("WORDWRAP", (0,0), (-1,-1), True),
    ])
    t = Table(data, colWidths=col_widths, repeatRows=1)
    t.setStyle(ts)
    return t

def bp(text):
    return Paragraph(f"• {text}", bullet_style)

def p(text, style=None):
    return Paragraph(text, style or body_style)

story = []

# ─── TITLE BLOCK ───────────────────────────────────────────────────────────────
story.append(Paragraph("Differential Diagnosis Report", title_style))
story.append(Paragraph("Patient: Rabeya Begum | Age: 71 Years | Sex: Female", subtitle_style))
story.append(Paragraph("BMU Hospital, Shahbag, Dhaka | Date: July 14, 2026", subtitle_style))
story.append(HRFlowable(width="100%", thickness=2, color=colors.HexColor("#1a3c5e"), spaceAfter=10))

# ─── PATIENT SUMMARY ──────────────────────────────────────────────────────────
story.append(Paragraph("1. Patient Summary & Clinical History", h1_style))

summary_data = [
    ["Domain", "Details"],
    ["Patient", "Rabeya Begum, 71F | Housewife | G6P6 (4 sons, 2 daughters) | All vaginal deliveries"],
    ["Comorbidities", "DM 20+ yrs (on insulin) | HTN 20+ yrs | H/O recurrent stroke (2 yrs back) | H/O recurrent dental infection"],
    ["Surgical Hx", "Bilateral salpingo-oophorectomy + cystectomy (2003) | Dental cystectomy (5 yrs back)"],
    ["February 2026", "Low-grade fever (few days) + abdominal pain + hemoptysis (several episodes, 1 day)\n→ Admitted Islami Bank Hospital: Rt-sided pneumonia with abscess diagnosed\n→ Shifted to NIDCH: Meropenem 14 days"],
    ["April 2026", "Rt facial deviation | Rt ear pain with pus | Slurring of speech\n→ ENT: Rt Bell's palsy + ASOM\n→ Neuro: Rt-sided ischemic stroke\n→ Imaging: Rt capsulo-ganglionic infarct; Bilateral maxillary & ethmoido-sphenoido-frontal sinus collection + mucosal thickening\n→ Readmitted: Moxibac + Meropenem 24 days | IV Albumin x3\n→ 2 weeks later: WBC 16,000 | Ear pain recurred → Moxiclav 10 days"],
    ["June 27, 2026", "Fever with chills and rigors\nWBC → 61,500 → 72,000 (extreme leukocytosis)\nUrine C/S: E. coli (sensitive to colistin, ceftazidime, fosfomycin)\nMeropenem started → changed to Efitaz + Linezolid\nConjunctival congestion developed (Lt > Rt)\nBone marrow biopsy deferred by hematologist (attributed to infection)"],
    ["Blood / Labs", "Hb 6.9 g/dL (Feb 2026) → 2 units RCC transfused | WBC 61,500–72,000 | Persistent leukocytosis"],
]
t = section_table(colors.HexColor("#1a3c5e"), summary_data, [3.5*cm, 13.5*cm])
story.append(t)
story.append(Spacer(1, 10))

# ─── PRIMARY DIAGNOSIS ────────────────────────────────────────────────────────
story.append(Paragraph("2. Primary Diagnosis (Most Likely)", h1_style))
story.append(Paragraph("Invasive Fungal Sinusitis — Mucormycosis / Invasive Aspergillosis with Intracranial & Systemic Extension", h2_style))

story.append(p("This is the most compelling unifying diagnosis. The entire multi-month clinical trajectory fits a single underlying condition:"))
story.append(bp("Poorly controlled DM (20+ years, on insulin) = classic host for angioinvasive fungi"))
story.append(bp("Bilateral pansinusitis (maxillary, ethmoidal, sphenoidal, frontal) confirmed on imaging"))
story.append(bp("Rt-sided ischemic stroke / capsulo-ganglionic infarct — caused by fungal vascular invasion of carotid siphon or deep perforators"))
story.append(bp("Rt facial palsy — likely fungal cranial nerve involvement (not idiopathic Bell's palsy)"))
story.append(bp("Rt ASOM with pus + ear pain — otologic spread of fungal infection"))
story.append(bp("Hemoptysis + lung abscess in February — pulmonary mucormycosis or Aspergillus"))
story.append(bp("Repeated failure of broad-spectrum antibacterials (meropenem, moxifloxacin) — primary pathogen is fungal, not bacterial"))
story.append(bp("Fever, extreme leukocytosis, hypoalbuminemia, anemia — immunocompromised state"))
story.append(Spacer(1, 6))
story.append(Paragraph(
    "⚠  KEY CLINICAL PEARL: Sinusitis + Stroke + Diabetes + Failed Antibiotics = Mucormycosis until proven otherwise. "
    "IV Liposomal Amphotericin B should be considered empirically pending biopsy. Delay significantly worsens mortality.",
    warning_style
))
story.append(Spacer(1, 8))

# ─── DIFFERENTIAL DIAGNOSES ───────────────────────────────────────────────────
story.append(Paragraph("3. Differential Diagnoses (In Order of Likelihood)", h1_style))

diffs = [
    (
        "1. Invasive Aspergillosis (Chronic Sinonasal + Pulmonary)",
        colors.HexColor("#c0392b"),
        [
            "Causes pansinusitis in diabetics and immunocompromised patients",
            "Can cause vascular invasion and cerebral infarction",
            "Pulmonary aspergillosis explains February hemoptysis and lung abscess",
            "More indolent than mucormycosis — fits this multi-month course",
            "Distinction from mucormycosis: culture/histology (septate vs. non-septate hyphae)",
        ]
    ),
    (
        "2. Septic Embolic Stroke from Infective Endocarditis (IE)",
        colors.HexColor("#e67e22"),
        [
            "Recurrent bacteremia sources: dental infections, prior abdominal surgeries (2003), UTI",
            "Rt capsulo-ganglionic infarct could represent septic embolism",
            "Fever, high WBC, multi-organ involvement (lung, brain, sinuses, ear)",
            "Conjunctival congestion could represent Roth spots or septic emboli",
            "Echocardiography (TTE/TEE) essential to rule in/out",
        ]
    ),
    (
        "3. Granulomatosis with Polyangiitis (GPA / Wegener's Granulomatosis)",
        colors.HexColor("#8e44ad"),
        [
            "Pansinusitis + pulmonary infiltrates/cavitation (abscess) + possible renal involvement",
            "Can cause cranial nerve palsies, orbital involvement, otologic disease",
            "Stroke can occur via CNS vasculitis (less common)",
            "c-ANCA / PR3-ANCA serology essential for diagnosis",
        ]
    ),
    (
        "4. Sinonasal Malignancy / NK-T Cell Lymphoma",
        colors.HexColor("#2980b9"),
        [
            "Bilateral pansinusitis in elderly with constitutional symptoms, anemia, weight loss",
            "NK/T-cell lymphoma (lethal midline granuloma): EBV-associated, destructive sinonasal disease, facial palsy",
            "WBC 61,500–72,000 raises concern for hematological malignancy",
            "Bone marrow biopsy was wisely considered — should be revisited if WBC persists",
            "Explains repeated antibacterial treatment failure",
        ]
    ),
    (
        "5. CSOM with Intracranial Complications",
        colors.HexColor("#27ae60"),
        [
            "Rt ASOM with pus → coalescent mastoiditis → lateral sinus thrombosis → stroke-like presentation",
            "Rt facial palsy: anatomically fits mastoid involvement of the facial nerve canal",
            "Sinusitis could be concurrent or secondary",
            "Does not fully explain hemoptysis, lung abscess, or extreme leukocytosis",
        ]
    ),
    (
        "6. Disseminated TB / Non-Tuberculous Mycobacteriosis (NTM)",
        colors.HexColor("#16a085"),
        [
            "Lung abscess + hemoptysis in South Asian patient = high TB suspicion",
            "Miliary TB can cause sinusitis, cerebral tuberculomas mimicking infarct",
            "Chronic anemia, hypoalbuminemia, poor response to standard antibacterials",
            "NTM (e.g., M. abscessus) increasingly seen in diabetics, very antibiotic resistant",
            "AFB smear/culture, CBNAAT (GeneXpert), IGRA essential",
        ]
    ),
    (
        "7. Leukemia (AML / CML) with Secondary Infections",
        colors.HexColor("#1a3c5e"),
        [
            "WBC 61,500–72,000 is extreme and cannot be dismissed as infection alone",
            "Leukostasis can cause CNS symptoms and stroke-like presentation",
            "Recurrent infections (dental, sinus, lung, urinary) suggest chronic immune dysfunction",
            "Anemia (Hb 6.9 g/dL) + high WBC + systemic illness = classic leukemia picture",
            "Bone marrow biopsy deferred — must be reconsidered urgently if WBC does not normalize",
        ]
    ),
    (
        "8. Bacterial Meningitis / Intracranial Abscess from Contiguous Spread",
        colors.HexColor("#7f8c8d"),
        [
            "Pansinusitis → direct extension via cribriform plate or thrombophlebitis → frontal lobe abscess",
            "Explains persistent fever, neurological deterioration, facial palsy",
            "Less consistent with capsulo-ganglionic stroke pattern (deep perforator territory)",
            "Sinogenic intracranial complications are well-recognized — contrast-enhanced MRI/CT essential",
        ]
    ),
]

for title, color, bullets in diffs:
    story.append(Paragraph(title, ParagraphStyle(
        "DiffH", parent=h3_style,
        textColor=color, spaceBefore=10, spaceAfter=3, fontSize=10.5
    )))
    for b in bullets:
        story.append(bp(b))

story.append(Spacer(1, 10))

# ─── SUMMARY TABLE ────────────────────────────────────────────────────────────
story.append(Paragraph("4. Summary Comparison Table", h1_style))

summary_table_data = [
    ["Diagnosis", "Supporting Features", "Against / Caveats"],
    ["Mucormycosis\n(PRIMARY)", "DM, pansinusitis, stroke, facial palsy,\nASOM, failed antibiotics, hypoalbuminemia", "No black eschar described\n(may be absent in early/deep disease)"],
    ["Invasive Aspergillosis", "Lung abscess, pansinusitis, DM,\nindolent multi-month course", "Less likely to cause ASOM;\nGalactomannan may help distinguish"],
    ["Infective Endocarditis", "Dental/sinus infection source, multi-organ,\nconjunctival signs", "E. coli rarely causes IE;\nneeds echo confirmation"],
    ["GPA (Wegener's)", "Sinusitis + lung + cranial nerve palsy", "Stroke pattern unusual;\nc-ANCA needed"],
    ["Sinonasal Lymphoma / Ca", "Refractory course, anemia, high WBC, elderly", "Hematologist deferred BM;\nneeds tissue biopsy"],
    ["CSOM + Intracranial Complication", "Rt ear pus, Rt facial palsy, sinusitis", "Does not explain hemoptysis\nor extreme leukocytosis"],
    ["TB / NTM", "Lung abscess, hemoptysis, South Asian,\nDM, poor antibiotic response", "No AFB workup documented yet;\nshould be pursued urgently"],
    ["Leukemia (AML/CML)", "WBC 61–72K, anemia, recurrent infections", "Hematologist attributed to infection;\nBM biopsy needed"],
]
t2 = section_table(colors.HexColor("#1a3c5e"), summary_table_data, [4*cm, 7*cm, 6*cm])
story.append(t2)
story.append(Spacer(1, 10))

# ─── INVESTIGATION PRIORITIES ─────────────────────────────────────────────────
story.append(Paragraph("5. Recommended Investigations (Priority Order)", h1_style))

inv_data = [
    ["Priority", "Investigation", "Rationale"],
    ["URGENT", "MRI Brain + PNS with contrast\n(or CT with bone windows)", "Characterize sinusitis extent, infarct pattern,\nbony erosion (mucormycosis), intracranial complications"],
    ["URGENT", "Nasal endoscopy + sinus biopsy\n(GMS stain, culture)", "Histology/culture for fungal hyphae — essential for\nmucormycosis vs. Aspergillus diagnosis"],
    ["URGENT", "Peripheral blood film + bone marrow biopsy", "Rule out leukemia/lymphoma given extreme WBC"],
    ["HIGH", "Serum galactomannan + beta-D-glucan", "Aspergillus markers (galactomannan negative in mucor)"],
    ["HIGH", "Mucormycosis PCR from sinus biopsy", "Molecular confirmation"],
    ["HIGH", "HbA1c + fasting glucose + ketones", "DKA / poor glycemic control = highest mucormycosis risk"],
    ["HIGH", "ANCA (c-ANCA/PR3, p-ANCA/MPO)", "Rule out GPA (Wegener's)"],
    ["HIGH", "Blood cultures x3 (aerobic + anaerobic)\n+ Echocardiography (TTE/TEE)", "IE workup — vegetations"],
    ["HIGH", "AFB smear + culture + CBNAAT (sputum/BAL)", "TB / NTM workup"],
    ["MODERATE", "CT Chest", "Characterize pulmonary lesion (cavity, nodule, abscess)"],
    ["MODERATE", "Urine C/S (repeat) + renal function", "E. coli UTI source control; renal status before Ampho B"],
    ["MODERATE", "LDH, ferritin, CRP, ESR, albumin", "Inflammatory burden, nutritional status, lymphoma markers"],
]
t3 = section_table(colors.HexColor("#1a3c5e"), inv_data, [2.5*cm, 6.5*cm, 8*cm])
story.append(t3)
story.append(Spacer(1, 10))

# ─── MANAGEMENT NOTE ──────────────────────────────────────────────────────────
story.append(Paragraph("6. Urgent Management Note", h1_style))
story.append(Paragraph(
    "⚠  EMPIRICAL ANTIFUNGAL THERAPY: If clinical suspicion for mucormycosis is high, do NOT wait for culture confirmation. "
    "Start IV Liposomal Amphotericin B (5–10 mg/kg/day) immediately. Mortality rises sharply with every day of delay. "
    "Surgical debridement of necrotic sinus tissue is often necessary in addition to antifungals.",
    warning_style
))
story.append(bp("Optimize glycemic control aggressively (target HbA1c; treat DKA if present)"))
story.append(bp("Discontinue deferoxamine if used (increases mucormycosis risk)"))
story.append(bp("Antifungal step-down to Posaconazole or Isavuconazole after clinical stabilization"))
story.append(bp("Neurology review for ongoing stroke management and secondary prevention"))
story.append(bp("Hematology review — bone marrow biopsy should not be deferred further if WBC remains >50,000"))
story.append(bp("ENT surgical review for endoscopic debridement"))
story.append(bp("Nutritional support: IV albumin, dietitian referral"))
story.append(Spacer(1, 10))

# ─── FOOTER ───────────────────────────────────────────────────────────────────
story.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor("#cccccc"), spaceBefore=10))
story.append(p(
    "<i>This report is generated for clinical reference purposes. All diagnoses must be confirmed by appropriate "
    "investigations and clinical judgment. Prepared: July 14, 2026 — BMU Hospital, Dhaka.</i>",
    small_style
))

doc.build(story)
print(f"PDF created: {OUTPUT}")
Running Command

python /home/daytona/workspace/differential-dx/generate_pdf.py

Your PDF is ready. Here is the download link:

Differential Diagnosis Rabeya Begum

PDF Document · PDF

The PDF includes:
  • Patient summary table with the full clinical timeline (February → April → June)
  • Primary diagnosis - Invasive Fungal Sinusitis (Mucormycosis/Aspergillosis) with the clinical reasoning
  • 8 differential diagnoses listed in order of likelihood, each with supporting features
  • Summary comparison table (diagnosis vs. supporting vs. against)
  • Prioritized investigation list (Urgent / High / Moderate)
  • Urgent management note including empirical Liposomal Amphotericin B recommendation
This is a shared conversation. Sign in to Orris to start your own chat.