A 50 year male , farmer , smoker by occupational presents with cough chest pain and occasional fever since 20 days Xray suggested of pleural effusion with left sided consolidation Pleural fluid reports written in prescription What could be the diagnosis How to approach
| Parameter | Value | Significance |
|---|---|---|
| Appearance | Reddish | Bloody/serosanguinous - think malignancy, hemothorax, PE, trauma |
| Lymphocytes | 25% | Modest lymphocytic component |
| Eosinophils | 65% | Dominant - this is an eosinophilic pleural effusion (EPE) |
| Cytology | Negative for malignancy | Rules out malignant cells on cytology (but NOT cancer itself - sensitivity ~70% for adenocarcinoma) |
| ADA | 17 U/L | LOW - does NOT support tuberculosis |
Note: This analysis is for clinical decision-support. The treating physician must correlate all findings with the patient's full history and examination findings and make the final diagnostic and therapeutic decisions.
Generate a clinical summary document for MDT discussion
mkdir -p /tmp/workspace/mdt-summary && ls /tmp/workspace/mdt-summary/
~/mdt-summary/generate_mdt_doc.py
from docx import Document
from docx.shared import Pt, Inches, RGBColor, Cm
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_TABLE_ALIGNMENT, WD_ALIGN_VERTICAL
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
import datetime
doc = Document()
# ── Page margins ──────────────────────────────────────────────────────────────
section = doc.sections[0]
section.page_width = Inches(8.27) # A4
section.page_height = Inches(11.69)
section.top_margin = Cm(2)
section.bottom_margin = Cm(2)
section.left_margin = Cm(2.5)
section.right_margin = Cm(2.5)
# ── Default normal style ──────────────────────────────────────────────────────
normal = doc.styles["Normal"]
normal.font.name = "Calibri"
normal.font.size = Pt(11)
# ── Helper: set paragraph shading ────────────────────────────────────────────
def shade_paragraph(paragraph, fill_hex):
pPr = paragraph._p.get_or_add_pPr()
shd = OxmlElement("w:shd")
shd.set(qn("w:val"), "clear")
shd.set(qn("w:color"), "auto")
shd.set(qn("w:fill"), fill_hex)
pPr.append(shd)
# ── Helper: add coloured heading paragraph ────────────────────────────────────
def add_section_heading(doc, text, bg_hex="1F4E79", font_hex="FFFFFF"):
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.LEFT
shade_paragraph(p, bg_hex)
run = p.add_run(f" {text}")
run.bold = True
run.font.size = Pt(11)
run.font.color.rgb = RGBColor.from_string(font_hex)
run.font.name = "Calibri"
p.paragraph_format.space_before = Pt(6)
p.paragraph_format.space_after = Pt(2)
return p
# ── Helper: add table ─────────────────────────────────────────────────────────
def add_table(doc, headers, rows, col_widths=None):
table = doc.add_table(rows=1 + len(rows), cols=len(headers))
table.style = "Table Grid"
table.alignment = WD_TABLE_ALIGNMENT.LEFT
# Header row
hdr_row = table.rows[0]
for i, h in enumerate(headers):
cell = hdr_row.cells[i]
cell.text = h
cell.paragraphs[0].runs[0].bold = True
cell.paragraphs[0].runs[0].font.size = Pt(10)
cell.paragraphs[0].runs[0].font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
# shade header
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"), "2E74B5")
tcPr.append(shd)
# Data rows
for ri, row_data in enumerate(rows):
row = table.rows[ri + 1]
for ci, val in enumerate(row_data):
cell = row.cells[ci]
cell.text = str(val)
cell.paragraphs[0].runs[0].font.size = Pt(10)
# alternating rows
if ri % 2 == 0:
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"), "DEEAF1")
tcPr.append(shd)
# Column widths
if col_widths:
for row in table.rows:
for i, cell in enumerate(row.cells):
cell.width = Cm(col_widths[i])
return table
def add_body(doc, text, bold=False, italic=False, indent=False, colour_hex=None, size=11):
p = doc.add_paragraph()
if indent:
p.paragraph_format.left_indent = Cm(0.5)
p.paragraph_format.space_before = Pt(1)
p.paragraph_format.space_after = Pt(1)
run = p.add_run(text)
run.bold = bold
run.italic = italic
run.font.size = Pt(size)
run.font.name = "Calibri"
if colour_hex:
run.font.color.rgb = RGBColor.from_string(colour_hex)
return p
def add_bullet(doc, text, level=0):
p = doc.add_paragraph(style="List Bullet")
p.paragraph_format.left_indent = Cm(0.5 + level * 0.5)
p.paragraph_format.space_before = Pt(1)
p.paragraph_format.space_after = Pt(1)
run = p.add_run(text)
run.font.size = Pt(10.5)
run.font.name = "Calibri"
return p
def spacer(doc, n=1):
for _ in range(n):
p = doc.add_paragraph("")
p.paragraph_format.space_before = Pt(0)
p.paragraph_format.space_after = Pt(0)
# ══════════════════════════════════════════════════════════════════════════════
# HEADER BLOCK
# ══════════════════════════════════════════════════════════════════════════════
# Confidentiality banner
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
shade_paragraph(p, "C00000")
run = p.add_run(" CONFIDENTIAL - MULTIDISCIPLINARY TEAM (MDT) DISCUSSION DOCUMENT ")
run.bold = True
run.font.size = Pt(11)
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
run.font.name = "Calibri"
spacer(doc)
# Title
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("THORACIC MDT CASE REFERRAL SUMMARY")
run.bold = True
run.font.size = Pt(16)
run.font.name = "Calibri"
run.font.color.rgb = RGBColor.from_string("1F4E79")
p2 = doc.add_paragraph()
p2.alignment = WD_ALIGN_PARAGRAPH.CENTER
run2 = p2.add_run("For Pulmonology | Thoracic Surgery | Medical Oncology | Radiology | Pathology")
run2.italic = True
run2.font.size = Pt(11)
run2.font.name = "Calibri"
run2.font.color.rgb = RGBColor.from_string("595959")
spacer(doc)
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 1 - PATIENT DEMOGRAPHICS
# ══════════════════════════════════════════════════════════════════════════════
add_section_heading(doc, "1. PATIENT DEMOGRAPHICS & ADMINISTRATIVE DETAILS")
spacer(doc)
demo_headers = ["Field", "Details"]
demo_rows = [
["Patient Name", "Shankar Lal Keer"],
["UHID / Patient ID", "294707 / 2317323"],
["Age / Sex", "58 Years / Male"],
["Date of Presentation","15 July 2026 (OPD - TB & Chest)"],
["Referred By", "Self-referral to GBH General Hospital, Banswara"],
["Address", "Keer Mohlla, Kotda, Kotra Bara, Banswara, Rajasthan"],
["Treating Physician", "Dr. Shazia KH - MD Respiratory Medicine (Chest), Asst. Professor, GBH"],
["Weight", "59.1 kg"],
["Contact", "8955618074"],
]
add_table(doc, demo_headers, demo_rows, col_widths=[5.5, 10])
spacer(doc)
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 2 - PRESENTING COMPLAINTS & HISTORY
# ══════════════════════════════════════════════════════════════════════════════
add_section_heading(doc, "2. PRESENTING COMPLAINTS & CLINICAL HISTORY")
spacer(doc)
add_body(doc, "Chief Complaints (Duration: 20 days):", bold=True)
add_bullet(doc, "Chest pain - onset 20 days prior to presentation")
add_bullet(doc, "Cough with whitish expectoration - 20 days")
add_bullet(doc, "Fever - 7 days duration (intermittent, degree not documented)")
add_bullet(doc, "No shortness of breath (SOB)")
add_bullet(doc, "No pedal oedema")
spacer(doc)
add_body(doc, "Past Medical History:", bold=True)
add_bullet(doc, "Known case of Type 2 Diabetes Mellitus (T2DM) - UNCONTROLLED (RBS: 286 mg/dL)")
add_bullet(doc, "No prior history of Anti-Koch's Treatment (AKT) / Anti-TB Therapy")
add_bullet(doc, "No known drug allergies documented")
spacer(doc)
add_body(doc, "Occupational & Social History:", bold=True)
add_bullet(doc, "Occupation: Farmer (rural agricultural worker, Rajasthan)")
add_bullet(doc, "Smoking status: SMOKER (active - duration/pack-year history not documented; requires quantification)")
add_bullet(doc, "Potential occupational exposures: dust, soil, biomass, possible asbestos-containing materials (buildings/roofing)")
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 3 - INVESTIGATIONS
# ══════════════════════════════════════════════════════════════════════════════
spacer(doc)
add_section_heading(doc, "3. INVESTIGATIONS SUMMARY")
spacer(doc)
# 3a Blood
add_body(doc, "3a. Blood Tests", bold=True)
blood_headers = ["Test", "Value", "Reference", "Interpretation"]
blood_rows = [
["Random Blood Sugar (RBS)", "286 mg/dL", "<140 mg/dL", "Significantly elevated - uncontrolled DM"],
]
add_table(doc, blood_headers, blood_rows, col_widths=[4.5, 3, 3, 5.5])
spacer(doc)
add_body(doc, "3b. Pleural Fluid Analysis (Date: 6 July 2026)", bold=True)
fluid_headers = ["Parameter", "Result", "Reference", "Clinical Significance"]
fluid_rows = [
["Gross Appearance", "Reddish (serosanguinous/haemorrhagic)", "Normally straw yellow", "Suggests haemothorax, malignancy, PE, trauma"],
["Lymphocytes", "25%", "<20% normal", "Mild lymphocytosis - less prominent"],
["Eosinophils", "65%", "<10%", "DOMINANT finding - eosinophilic pleural effusion (EPE)"],
["Cytology", "Negative for malignancy", "Negative", "ONE negative sample; sensitivity 40-70% only - does NOT exclude cancer"],
["ADA (Adenosine Deaminase)", "17 U/L", "Cutoff: 40 U/L", "LOW - argues AGAINST tuberculous pleuritis"],
]
add_table(doc, fluid_headers, fluid_rows, col_widths=[4, 4, 3, 5])
spacer(doc)
add_body(doc, "3c. Ultrasound Chest (Date: 14 July 2026 - Zeel Multispeciality Hospital)", bold=True)
add_bullet(doc, "Very minimal right-sided pleural effusion, approx. 10 mL")
add_bullet(doc, "No left-sided pleural effusion detected on this date (note: discrepancy with earlier OPD finding - may represent interval drainage or positional variation)")
add_bullet(doc, "No consolidation or mass lesion noted in lower zones")
spacer(doc)
add_body(doc, "3d. USG Abdomen & Pelvis (Date: 14 July 2026)", bold=True)
add_bullet(doc, "Liver, spleen, pancreas, kidneys, urinary bladder, prostate - all within normal limits")
add_bullet(doc, "Gall bladder: distended, no calculus")
add_bullet(doc, "No retroperitoneal or mesenteric lymphadenopathy")
add_bullet(doc, "No ascites, no free peritoneal fluid")
add_body(doc, "Impression: No significant abdominal diagnostic abnormality - no distant intra-abdominal metastatic disease detected on USG.", italic=True, indent=True)
spacer(doc)
add_body(doc, "3e. CECT Chest (Contrast-Enhanced CT Thorax, Date: 13 July 2026 - Zeel Multispeciality Hospital)", bold=True)
add_body(doc, "Reported by: Dr. Aashish Kumar Jain, MBBS MD, Consultant Radiologist (RMC Reg. 28576/14912)", italic=True, indent=True)
spacer(doc)
ct_headers = ["Finding", "Location / Details", "MDT Significance"]
ct_rows = [
["Multiple subcentimetric lymph nodes",
"Pre-tracheal, para-tracheal, AP window regions",
"Reactive vs. neoplastic involvement; subcentimetric but metabolic activity unknown - PET-CT required"],
["Calcified granulomas",
"Along hepatic capsule",
"Old/healed granulomatous disease (prior TB or endemic mycosis); NOT active disease"],
["Mild bilateral pleural effusion/thickening",
"Bilateral; with MULTIPLE CALCIFIED PLEURAL PLAQUES",
"Calcified plaques are HALLMARK of asbestos exposure - raises mesothelioma risk; multiplies malignancy risk"],
["Linear/subsegmental atelectasis + GGO + septal thickening",
"LEFT UPPER LOBE (LUL)",
"Radiologist label: 'likely infective pneumonitis'; however mass/consolidation cannot be excluded without biopsy"],
["No hilar enlargement on formal report",
"Bilateral hila unremarkable per report",
"However CT films show left perihilar soft-tissue density - requires review at MDT"],
["Normal tracheobronchial tree",
"Trachea and both main bronchi normal",
"Endobronchial lesion possible at segmental/subsegmental level - bronchoscopy required"],
["Aorta / spine",
"Degenerative spine changes; atherosclerotic aorta",
"Background age-related changes; no surgical contraindication noted"],
]
add_table(doc, ct_headers, ct_rows, col_widths=[4.5, 4.5, 7])
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 4 - PROBLEM LIST / DIFFERENTIAL DIAGNOSIS
# ══════════════════════════════════════════════════════════════════════════════
spacer(doc)
add_section_heading(doc, "4. PROBLEM LIST & DIFFERENTIAL DIAGNOSIS")
spacer(doc)
add_body(doc, "Key Clinical Problem Statement:", bold=True)
add_body(doc,
"58-year-old male smoker and farmer presenting with 20-day history of chest pain, whitish cough, and fever. "
"CECT shows left upper lobe consolidation/atelectasis with GGO, bilateral calcified pleural plaques, mediastinal "
"lymph nodes, and calcified hepatic granulomas. Pleural fluid is serosanguinous (reddish) with 65% eosinophils, "
"ADA 17 U/L (low), and single cytology negative for malignancy. Uncontrolled T2DM. No prior TB treatment.",
italic=True, indent=True)
spacer(doc)
add_body(doc, "Differential Diagnoses (in order of clinical priority):", bold=True)
dx_headers = ["Priority", "Diagnosis", "Supporting Evidence", "Against / Caveats"]
dx_rows = [
["1 - MOST LIKELY",
"Primary Bronchogenic Carcinoma (Lung Cancer)\n[Possible: Squamous Cell / Adenocarcinoma / SCLC]",
"- Active smoker, 58-year-old male (peak demographic)\n- LUL consolidation/mass on CT\n- Mediastinal LN (subcentimetric)\n- Serosanguinous + eosinophilic effusion (reactive to tumour/haemorrhage)\n- Calcified pleural plaques (asbestos co-exposure)",
"- Single cytology negative (low sensitivity)\n- Subcentimetric LN (not confirmed malignant)\n- CT labelled 'infective pneumonitis' (radiologist impression only)"],
["2 - IMPORTANT",
"Malignant Pleural Mesothelioma",
"- Calcified pleural plaques = asbestos exposure marker\n- Farmer with likely occupational/environmental asbestos contact\n- Bilateral pleural thickening\n- Serosanguinous effusion",
"- No dominant pleural mass on CT report\n- Cytology negative (very low sensitivity for mesothelioma, <10%)"],
["3 - CONSIDER",
"Post-Infectious / Parapneumonic Organized Effusion with Eosinophilia",
"- Fever, cough, consolidation on CT\n- Infective label by radiologist",
"- EPE at 65% highly unusual for simple parapneumonic\n- ADA low\n- Calcified plaques unexplained\n- Must exclude malignancy first"],
["4 - CONSIDER",
"Parasitic / Fungal Infection (e.g. Hydatid, Histoplasmosis, Strongyloides)",
"- Farmer in rural Rajasthan\n- High eosinophil count (65%)\n- Calcified hepatic granulomas",
"- No cystic lesions on CT\n- No peripheral eosinophilia documented yet\n- Calcified plaques not explained"],
["5 - LESS LIKELY",
"Tuberculous Pleuritis",
"- Endemic region, rural farmer\n- Prior healed TB (calcified granulomas on CT)",
"- ADA 17 U/L (well below 40 U/L cutoff; effectively EXCLUDES active TB pleuritis)\n- Lymphocytes only 25% (TB effusions are usually >80% lymphocytes)\n- No prior AKT but ADA strongly argues against"],
]
add_table(doc, dx_headers, dx_rows, col_widths=[2.5, 4, 5.5, 4])
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 5 - MDT QUESTIONS / DISCUSSION POINTS
# ══════════════════════════════════════════════════════════════════════════════
spacer(doc)
add_section_heading(doc, "5. KEY QUESTIONS FOR MDT DISCUSSION")
spacer(doc)
questions = [
("Q1 - Pathology (URGENT)", "The left upper lobe lesion requires tissue diagnosis. Bronchoscopy vs. CT-guided percutaneous biopsy: which is the preferred first approach given the LUL location and mediastinal nodes?"),
("Q2 - Radiology Review", "CT films show a suspicious left perihilar soft-tissue density not fully described in the formal report. MDT radiologist to re-review the CECT with attention to: (a) mass vs. consolidation in LUL, (b) left hilar adenopathy, (c) nature of pleural plaques."),
("Q3 - Pleural Fluid", "Eosinophilic effusion (65%) is reddish - is repeat thoracentesis with full biochemical analysis (LDH, protein, pH, glucose, Light's criteria), repeat cytology x2, cell block, and pleural biopsy indicated?"),
("Q4 - Staging", "If malignancy is confirmed: Is PET-CT feasible and indicated for full mediastinal and distant staging before surgical/oncologic planning? MRI brain for baseline staging?"),
("Q5 - Asbestos Exposure History", "Formal occupational history needs documentation. Was there direct/indirect asbestos exposure (old construction, roofing, agricultural equipment)? This determines mesothelioma workup pathway."),
("Q6 - Diabetes Management", "Uncontrolled DM (RBS 286) will impair healing and complicate any procedure, surgery, or chemotherapy. Endocrinology input required. Insulin initiation/optimisation before any intervention."),
("Q7 - Bronchoscopy", "Even if CT shows no endobronchial lesion at main bronchi level, BAL + bronchoscopic biopsy of the LUL lesion is indicated. Can provide washings for: cytology, AFB culture (rule out TB definitively), and fungal culture."),
("Q8 - Sputum", "Three consecutive morning sputum samples for AFB smear/culture should be sent (standard practice regardless of ADA - to confirm TB exclusion microbiologically and satisfy regulatory requirements)."),
]
for qnum, (title, detail) in enumerate(questions):
add_body(doc, title, bold=True, colour_hex="1F4E79")
add_body(doc, detail, indent=True)
spacer(doc)
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 6 - PROPOSED MANAGEMENT PLAN
# ══════════════════════════════════════════════════════════════════════════════
add_section_heading(doc, "6. PROPOSED MANAGEMENT PLAN (PENDING MDT RATIFICATION)")
spacer(doc)
add_body(doc, "Immediate (This Admission / Within 48-72 Hours):", bold=True, colour_hex="C00000")
immediate = [
"Admit for further workup - do NOT discharge on empirical antibiotics alone",
"Bronchoscopy + BAL + endobronchial biopsy (if visible lesion) + transbronchial biopsy of LUL lesion",
"CT-guided percutaneous needle biopsy of LUL lesion if bronchoscopy non-diagnostic",
"Repeat thoracentesis: full biochemical analysis (protein, LDH, glucose, pH, ADA), cytology x2, cell block preparation, pleural fluid culture (bacterial, AFB, fungal)",
"Sputum AFB smear x3 (morning samples)",
"Blood: CBC with differential (peripheral eosinophilia?), LFTs, RFTs, serum protein/albumin, LDH",
"Tumour markers: CEA, CYFRA 21-1, NSE, ProGRP, CA 19-9",
"Serology: Total IgE, stool ova/cysts/parasites",
"Blood sugar monitoring + endocrinology referral for insulin optimisation (RBS 286 mg/dL)",
"CXR PA view (baseline film for comparison)",
]
for item in immediate:
add_bullet(doc, item)
spacer(doc)
add_body(doc, "Short-Term (Within 1-2 Weeks, Post-Biopsy Results):", bold=True, colour_hex="833C00")
short = [
"PET-CT whole body if malignancy confirmed (for mediastinal and distant staging)",
"MRI brain (baseline staging for lung cancer)",
"Pulmonary function tests (spirometry, DLCO) prior to any surgical planning",
"Formal occupational history documentation (asbestos exposure assessment)",
"Thoracic surgery opinion if resectable disease",
"Medical oncology referral if non-resectable or metastatic",
]
for item in short:
add_bullet(doc, item)
spacer(doc)
add_body(doc, "If Bronchogenic Carcinoma Confirmed - Specific Steps:", bold=True, colour_hex="1F4E79")
cancer = [
"Histological subtype determination (adenocarcinoma, squamous cell, SCLC, large cell, other)",
"Molecular profiling: EGFR, ALK, ROS1, KRAS, PD-L1 (TPS) - mandatory for treatment planning",
"Staging classification per TNM 8th edition",
"Enrolment in thoracic oncology MDT for treatment decision (surgery / CCRT / targeted therapy / immunotherapy)",
"Smoking cessation counselling and NRT if applicable",
]
for item in cancer:
add_bullet(doc, item)
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 7 - RISK FACTORS SUMMARY
# ══════════════════════════════════════════════════════════════════════════════
spacer(doc)
add_section_heading(doc, "7. RISK FACTOR PROFILE")
spacer(doc)
risk_headers = ["Risk Factor", "Status", "Significance"]
risk_rows = [
["Active Smoking", "YES (duration/pack-years TBD)", "Single biggest risk factor for lung cancer; also COPD"],
["Uncontrolled T2DM", "YES (RBS 286 mg/dL)", "Impairs immune response; complicates any intervention"],
["Asbestos Exposure", "LIKELY (calcified pleural plaques)", "Mesothelioma + multiplicative lung cancer risk with smoking"],
["Age / Sex", "58-year-old Male", "Peak incidence demographic for bronchogenic carcinoma"],
["Occupation (Farming)", "YES", "Possible pesticide, dust, biohazard, asbestos exposure"],
["Prior Granulomatous Dz", "YES (calcified granulomas on CT)", "Healed TB/fungal - not active, but prior immunological event"],
["ECOG Performance Status","Not formally assessed", "Must be assessed before any treatment planning"],
]
add_table(doc, risk_headers, risk_rows, col_widths=[4, 4, 8])
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 8 - INVESTIGATIONS PENDING
# ══════════════════════════════════════════════════════════════════════════════
spacer(doc)
add_section_heading(doc, "8. INVESTIGATIONS AWAITED / PENDING AT TIME OF MDT")
spacer(doc)
pending_headers = ["Investigation", "Status", "Urgency"]
pending_rows = [
["Bronchoscopy + BAL + biopsy", "NOT YET DONE", "URGENT"],
["CT-guided percutaneous biopsy LUL", "NOT YET DONE", "URGENT (if bronchoscopy non-diagnostic)"],
["Repeat pleural fluid (full biochemistry)", "NOT YET DONE", "URGENT"],
["Sputum AFB x3", "NOT YET DONE", "URGENT"],
["PET-CT", "NOT YET DONE", "After tissue diagnosis"],
["MRI brain", "NOT YET DONE", "After tissue diagnosis"],
["Pulmonary function tests", "NOT YET DONE", "Before any surgical planning"],
["Tumour markers (CEA, CYFRA21-1, NSE etc.)","NOT YET DONE", "Routine"],
["Molecular profiling (EGFR, ALK, PD-L1)", "NOT YET DONE", "After histology confirmed"],
["Peripheral eosinophil count", "NOT YET DONE", "Routine"],
["IgE levels / stool ova & cysts", "NOT YET DONE", "Routine"],
["ECOG performance status assessment", "NOT YET DONE", "Before MDT decision"],
["Formal pack-year smoking history", "NOT DOCUMENTED", "Documentation required"],
["Formal occupational asbestos history", "NOT DOCUMENTED", "Documentation required"],
]
add_table(doc, pending_headers, pending_rows, col_widths=[7, 5, 4])
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 9 - MDT OUTCOME BOX
# ══════════════════════════════════════════════════════════════════════════════
spacer(doc)
add_section_heading(doc, "9. MDT OUTCOME & DECISION (To be completed at MDT Meeting)")
spacer(doc)
outcome_fields = [
("MDT Date", ""),
("MDT Chair", ""),
("Members Present", "Pulmonologist | Thoracic Surgeon | Medical Oncologist | Radiologist | Histopathologist | Clinical Nurse Specialist"),
("Agreed Diagnosis", ""),
("Stage (if malignancy)", ""),
("Agreed Treatment Plan", ""),
("Lead Clinician", ""),
("Patient Informed Consent", ""),
("Next MDT Review Date", ""),
("Additional Notes", ""),
]
for label, val in outcome_fields:
p = doc.add_paragraph()
p.paragraph_format.space_before = Pt(2)
p.paragraph_format.space_after = Pt(2)
run1 = p.add_run(f"{label}: ")
run1.bold = True
run1.font.size = Pt(11)
run1.font.name = "Calibri"
run2 = p.add_run(val if val else "_" * 60)
run2.font.size = Pt(11)
run2.font.name = "Calibri"
run2.font.color.rgb = RGBColor.from_string("595959")
# ══════════════════════════════════════════════════════════════════════════════
# FOOTER DISCLAIMER
# ══════════════════════════════════════════════════════════════════════════════
spacer(doc)
p = doc.add_paragraph()
shade_paragraph(p, "F2F2F2")
run = p.add_run(
" DISCLAIMER: This document is generated as a clinical decision-support aid for MDT discussion purposes only. "
"It does not constitute a final diagnosis or treatment prescription. All clinical decisions must be made by "
"qualified treating physicians following full clinical assessment, informed consent, and applicable institutional protocols. "
)
run.italic = True
run.font.size = Pt(9)
run.font.color.rgb = RGBColor.from_string("595959")
run.font.name = "Calibri"
spacer(doc)
p2 = doc.add_paragraph()
p2.alignment = WD_ALIGN_PARAGRAPH.CENTER
run3 = p2.add_run(f"Document generated: {datetime.datetime.now().strftime('%d %B %Y, %H:%M')} | Patient: SHANKAR LAL KEER | UHID: 294707")
run3.font.size = Pt(9)
run3.font.color.rgb = RGBColor.from_string("808080")
run3.font.name = "Calibri"
run3.italic = True
# ══════════════════════════════════════════════════════════════════════════════
# SAVE
# ══════════════════════════════════════════════════════════════════════════════
output_path = "/tmp/workspace/mdt-summary/Shankar_Lal_Keer_MDT_Summary.docx"
doc.save(output_path)
print(f"Saved: {output_path}")
cd /tmp/workspace/mdt-summary && python3 generate_mdt_doc.py
python3 -c " from docx import Document doc = Document('/tmp/workspace/mdt-summary/Shankar_Lal_Keer_MDT_Summary.docx') sections = [p.text.strip() for p in doc.paragraphs if p.text.strip()] for s in sections[:30]: print(repr(s[:100])) print('...') print(f'Total paragraphs: {len(doc.paragraphs)}') print(f'Total tables: {len(doc.tables)}') import os size = os.path.getsize('/tmp/workspace/mdt-summary/Shankar_Lal_Keer_MDT_Summary.docx') print(f'File size: {size:,} bytes') "
Shankar Lal Keer MDT Summary
Word Document · DOCX
| Section | Content |
|---|---|
| 1. Demographics | Patient ID, UHID, treating physician, referral details |
| 2. Complaints & History | Presenting symptoms, PMH, occupational/smoking history |
| 3. Investigations | Pleural fluid table, CECT chest table, USG chest & abdomen findings |
| 4. Differential Diagnosis | 5 differentials with supporting and against evidence for each |
| 5. MDT Discussion Questions | 8 specific questions for the team (radiology review, biopsy approach, staging, asbestos history, DM management) |
| 6. Management Plan | Immediate / short-term / post-histology steps with bullet points |
| 7. Risk Factor Profile | Smoking, DM, asbestos, age/sex, occupation in table format |
| 8. Pending Investigations | 14 investigations with urgency tiers - all marked NOT YET DONE |
| 9. MDT Outcome Box | Blank fillable section for MDT chair to complete during the meeting |