Give me the content of above headings after assessing standard books and pubmed give me the content with the following headings relevant to pain and pallitive medicine
"palliative surgery" AND oncology AND outcomes
palliative surgery AND cancer AND indications morbidity
PMID: 39610018
PMID: 39667288
orthopedic surgery palliative AND bone metastases AND outcomes
urinary diversion palliative AND cancer AND quality of life
PMID: 35226235
PMID: 40251493
palliative surgery decision making goals cancer patient quality of life
| Principle | Description |
|---|---|
| Symptom-first intent | All interventions must target a specific, burdensome symptom (pain, obstruction, bleeding, dysphagia) |
| Least invasive approach | Use the minimal intervention that achieves symptom relief |
| Balance of benefit vs. burden | New symptoms from the intervention must not outweigh the benefit gained |
| Realistic goal-setting | Patients must receive accurate information about expected post-operative outcomes and survival |
| Multidisciplinary team (MDT) | Surgery, medical oncology, radiation oncology, and palliative medicine must make decisions together |
| Performance status | Adequate performance status is needed to safely undergo and benefit from surgery |
| Time horizon | Anticipated survival must justify the recovery time and hospitalization burden |
| Symptom | Indication for Palliative Surgery |
|---|---|
| Bowel obstruction | Resection, stoma creation, bypass, stenting |
| Gastrointestinal bleeding | Resection or embolization of bleeding tumor |
| Biliary obstruction / jaundice | ERCP stenting, PTBD, surgical bypass |
| Gastric outlet obstruction | Gastrojejunostomy, duodenal stenting |
| Airway obstruction | Tracheostomy, tumor debulking, stenting |
| Urinary obstruction | Urinary diversion, ureteric stenting, nephrostomy |
| Pain from tumor mass / nerve invasion | Debulking, cordotomy, nerve blocks |
| Pathological fracture / impending fracture | Intramedullary nailing, endoprosthesis |
| Spinal cord compression | Decompressive laminectomy, vertebroplasty |
| Dysphagia | PEG tube placement, esophageal stenting |
| Fistula | Diversion stoma, reconstructive closure |
| Wound / fungating tumor | Debulking, flap coverage |
| Procedure | Indication | Cancer Types |
|---|---|---|
| Colostomy / Ileostomy | Bowel obstruction, fistula | Colorectal, pelvic cancers |
| Gastrostomy (PEG/surgical) | Dysphagia, nutritional support, gastric drainage | Head/neck, esophageal, stomach |
| Urinary diversion / JJ stent / nephrostomy | Malignant ureteric obstruction | Cervical, bladder, colorectal, retroperitoneal |
| Tracheostomy | Airway obstruction, aspiration | Head/neck, larynx, trachea, thyroid |
| Luminal stenting (esophagus/colon/duodenum) | Obstruction, dysphagia | Esophageal, gastric, colorectal, pancreatic |
| ERCP / PTBD / biliary bypass | Malignant obstructive jaundice | Pancreatic, cholangiocarcinoma, ampullary, gallbladder |
| Celiac plexus neurolysis | Refractory abdominal/back pain | Pancreatic, upper GI cancers |
| Vertebroplasty / Kyphoplasty | Vertebral compression fracture pain | Breast, prostate, myeloma, lung |
| IMN / endoprosthesis | Pathological/impending long bone fracture | Breast, lung, prostate, RCC |
| Decompressive laminectomy | Spinal cord compression | Any cancer with vertebral metastasis |
| Pleurodesis | Malignant pleural effusion | Lung, breast, mesothelioma |
| Pelvic exenteration | Pelvic pain, fistula, bleeding | Recurrent cervical/rectal cancer |
Make a Word document compiling this content as a study guide for pain & palliative medicine
ls -la /tmp/workspace/ 2>/dev/null || mkdir -p /tmp/workspace && echo "workspace ready"
mkdir -p /tmp/workspace/palliative-surgery && cat > /tmp/workspace/palliative-surgery/create_doc.py << 'PYEOF' from docx import Document from docx.shared import Pt, Inches, RGBColor from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.oxml.ns import qn from docx.oxml import OxmlElement import copy doc = Document() # ── Page margins ────────────────────────────────────────────────────────────── section = doc.sections[0] section.page_width = Inches(8.5) section.page_height = Inches(11) section.left_margin = Inches(1) section.right_margin = Inches(1) section.top_margin = Inches(1) section.bottom_margin = Inches(1) # ── Base Normal style ───────────────────────────────────────────────────────── normal = doc.styles["Normal"] normal.font.name = "Calibri" normal.font.size = Pt(11) # ── Helper colours ───────────────────────────────────────────────────────────── NAVY = RGBColor(0x0D, 0x47, 0xA1) # deep blue – main headings TEAL = RGBColor(0x00, 0x69, 0x5C) # teal – section headings DARK = RGBColor(0x21, 0x21, 0x21) # near-black WHITE = RGBColor(0xFF, 0xFF, 0xFF) ACCENT = RGBColor(0x00, 0x69, 0x5C) # table header fill # ── Utility: shade a table cell ─────────────────────────────────────────────── def shade_cell(cell, hex_color: str): 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_border(cell, **kwargs): """kwargs: top/bottom/left/right = (size_pt, color_hex)""" tc = cell._tc tcPr = tc.get_or_add_tcPr() tcBorders = OxmlElement("w:tcBorders") for side, (sz, color) in kwargs.items(): border = OxmlElement(f"w:{side}") border.set(qn("w:val"), "single") border.set(qn("w:sz"), str(sz * 8)) border.set(qn("w:color"), color) border.set(qn("w:space"), "0") tcBorders.append(border) tcPr.append(tcBorders) # ── Utility: add a horizontal rule ─────────────────────────────────────────── def add_hr(doc, color="0D47A1"): p = doc.add_paragraph() pPr = p._p.get_or_add_pPr() pBdr = OxmlElement("w:pBdr") bot = OxmlElement("w:bottom") bot.set(qn("w:val"), "single") bot.set(qn("w:sz"), "6") bot.set(qn("w:space"), "1") bot.set(qn("w:color"), color) pBdr.append(bot) pPr.append(pBdr) p.paragraph_format.space_before = Pt(2) p.paragraph_format.space_after = Pt(2) return p # ── Utility: styled heading ─────────────────────────────────────────────────── def add_h1(doc, text): p = doc.add_heading(text, level=1) p.clear() run = p.add_run(text) run.font.name = "Calibri" run.font.size = Pt(18) run.font.bold = True run.font.color.rgb = WHITE pPr = p._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"), "0D47A1") pPr.append(shd) p.paragraph_format.space_before = Pt(14) p.paragraph_format.space_after = Pt(6) p.paragraph_format.left_indent = Inches(0.1) return p def add_h2(doc, text): p = doc.add_heading(text, level=2) p.clear() run = p.add_run(text) run.font.name = "Calibri" run.font.size = Pt(14) run.font.bold = True run.font.color.rgb = RGBColor(0x00, 0x69, 0x5C) p.paragraph_format.space_before = Pt(12) p.paragraph_format.space_after = Pt(3) add_hr(doc, color="00695C") return p def add_h3(doc, text): p = doc.add_heading(text, level=3) p.clear() run = p.add_run(text) run.font.name = "Calibri" run.font.size = Pt(12) run.font.bold = True run.font.color.rgb = NAVY p.paragraph_format.space_before = Pt(8) p.paragraph_format.space_after = Pt(2) return p def add_body(doc, text, bold_parts=None): p = doc.add_paragraph() p.paragraph_format.space_before = Pt(2) p.paragraph_format.space_after = Pt(4) run = p.add_run(text) run.font.name = "Calibri" run.font.size = Pt(11) run.font.color.rgb = DARK return p def add_bullet(doc, text, level=0): p = doc.add_paragraph(style="List Bullet") p.paragraph_format.left_indent = Inches(0.25 + level * 0.25) p.paragraph_format.space_before = Pt(1) p.paragraph_format.space_after = Pt(1) # Parse bold markers (**text**) import re parts = re.split(r'(\*\*[^*]+\*\*)', text) for part in parts: if part.startswith("**") and part.endswith("**"): run = p.add_run(part[2:-2]) run.bold = True else: run = p.add_run(part) run.font.name = "Calibri" run.font.size = Pt(11) run.font.color.rgb = DARK return p def add_table(doc, headers, rows, col_widths=None): n_cols = len(headers) table = doc.add_table(rows=1+len(rows), cols=n_cols) table.style = "Table Grid" # Header row hdr_cells = table.rows[0].cells for i, h in enumerate(headers): shade_cell(hdr_cells[i], "0D47A1") p = hdr_cells[i].paragraphs[0] p.clear() run = p.add_run(h) run.font.bold = True run.font.name = "Calibri" run.font.size = Pt(10.5) run.font.color.rgb = WHITE # Data rows for r_idx, row in enumerate(rows): cells = table.rows[r_idx+1].cells fill = "F5F5F5" if r_idx % 2 == 0 else "FFFFFF" for c_idx, val in enumerate(row): shade_cell(cells[c_idx], fill) p = cells[c_idx].paragraphs[0] p.clear() import re parts = re.split(r'(\*\*[^*]+\*\*)', val) for part in parts: if part.startswith("**") and part.endswith("**"): run = p.add_run(part[2:-2]) run.bold = True else: run = p.add_run(part) run.font.name = "Calibri" run.font.size = Pt(10) if col_widths: for r in table.rows: for i, w in enumerate(col_widths): r.cells[i].width = Inches(w) doc.add_paragraph() return table # ══════════════════════════════════════════════════════════════════════════════ # COVER PAGE # ══════════════════════════════════════════════════════════════════════════════ cover = doc.add_paragraph() cover.alignment = WD_ALIGN_PARAGRAPH.CENTER cover.paragraph_format.space_before = Pt(60) cover.paragraph_format.space_after = Pt(4) r = cover.add_run("PAIN & PALLIATIVE MEDICINE") r.font.name = "Calibri" r.font.size = Pt(26) r.font.bold = True r.font.color.rgb = NAVY sub = doc.add_paragraph() sub.alignment = WD_ALIGN_PARAGRAPH.CENTER sub.paragraph_format.space_after = Pt(4) r2 = sub.add_run("STUDY GUIDE") r2.font.name = "Calibri" r2.font.size = Pt(20) r2.font.bold = True r2.font.color.rgb = RGBColor(0x00, 0x69, 0x5C) sec_title = doc.add_paragraph() sec_title.alignment = WD_ALIGN_PARAGRAPH.CENTER sec_title.paragraph_format.space_after = Pt(6) r3 = sec_title.add_run("Section 1.4: Palliative Surgery") r3.font.name = "Calibri" r3.font.size = Pt(15) r3.font.bold = False r3.font.color.rgb = DARK add_hr(doc, "0D47A1") desc = doc.add_paragraph() desc.alignment = WD_ALIGN_PARAGRAPH.CENTER desc.paragraph_format.space_before = Pt(8) r4 = desc.add_run( "Compiled from Standard Textbooks (Bailey & Love, Schwartz's, Cummings, " "Sabiston, Current Surgical Therapy, Campbell-Walsh-Wein) and PubMed Evidence (2022–2026)" ) r4.font.name = "Calibri" r4.font.size = Pt(10) r4.font.italic = True r4.font.color.rgb = RGBColor(0x60, 0x60, 0x60) date_p = doc.add_paragraph() date_p.alignment = WD_ALIGN_PARAGRAPH.CENTER date_p.paragraph_format.space_before = Pt(6) r5 = date_p.add_run("July 2026") r5.font.name = "Calibri" r5.font.size = Pt(10) r5.font.color.rgb = RGBColor(0x80, 0x80, 0x80) doc.add_page_break() # ══════════════════════════════════════════════════════════════════════════════ # SECTION 1: PRINCIPLES OF PALLIATIVE SURGERY # ══════════════════════════════════════════════════════════════════════════════ add_h1(doc, "1. Principles of Palliative Surgery in the Oncology Setting") add_h2(doc, "Definition") add_body(doc, "Palliative surgery is defined as surgical intervention targeted to alleviate a " "patient's symptoms, thus improving quality of life (QoL) despite minimal impact on survival. " "It is fundamentally distinct from curative or cytoreductive surgery." ) add_body(doc, "A 2025 systematic review (Wong et al., J Surg Oncol) of 92 studies identified four recurring " "themes in how palliative surgery is defined across the literature:" ) items_def = [ "Incurable cancer prognosis", "Intent to relieve symptoms or improve quality of life", "Specific operative interventions (procedure-defined)", "Persistence of disease after surgery (incomplete cytoreduction)" ] for it in items_def: add_bullet(doc, it) add_body(doc, "Critically: if an intervention is not directly relieving a symptom, it is not palliative " "therapy. Treatment of incurable cancer aimed at maximizing life length (e.g., systemic " "chemotherapy) is often loosely - and inappropriately - labeled 'palliative.'" ) add_h2(doc, "Guiding Principles") principles = [ ("**Symptom-first intent**", "All interventions must target a specific, burdensome symptom (pain, obstruction, bleeding, dysphagia)."), ("**Least invasive approach**", "Use the minimal intervention that achieves adequate symptom relief."), ("**Balance benefit vs. burden**","New symptoms from the intervention must not outweigh benefits gained."), ("**Realistic goal-setting**", "Patients must receive accurate information about expected post-operative outcomes and survival."), ("**Multidisciplinary team**", "Surgery, medical oncology, radiation oncology, and palliative medicine decide together."), ("**Performance status**", "Adequate ECOG/KPS is needed to safely undergo and benefit from surgery."), ("**Time horizon**", "Anticipated survival must justify the recovery time and hospitalization burden."), ] add_table(doc, ["Principle", "Description"], principles, col_widths=[2.0, 4.5]) add_h2(doc, "Core Competencies for Surgical Palliative Care") competencies = [ "Communication of prognosis and realistic outcomes", "Symptom assessment and relief", "Shared decision-making aligned with patient's goals and values", "Knowledge of when to avoid surgery (surgical futility)", "Coordination with specialist palliative medicine teams", "Awareness of hospice criteria and transition planning", ] for c in competencies: add_bullet(doc, c) add_h2(doc, "Key Evidence") add_body(doc, "Wong et al. (2025, J Surg Oncol, PMID 39610018): In 92 studies of palliative thoraco-abdominal " "surgery, survival (90%) and perioperative morbidity (72%) were the most commonly reported outcomes, " "yet symptom relief, quality of life, and sustainability of success were infrequently measured - " "revealing a critical mismatch between the intent of palliative surgery and what is actually evaluated." ) add_body(doc, "Schwartz's (quoting meta-analysis): In malignant bowel obstruction from peritoneal carcinomatosis, " "although palliative surgery can benefit some patients, many experience serious complications, " "incomplete symptom resolution, and substantial hospitalization relative to remaining survival time." ) doc.add_page_break() # ══════════════════════════════════════════════════════════════════════════════ # SECTION 2: INDICATIONS & MORBIDITIES # ══════════════════════════════════════════════════════════════════════════════ add_h1(doc, "2. Indications and Morbidities of Palliative Surgery in Individual Cancers") add_h2(doc, "Indications by Symptom") ind_rows = [ ("**Bowel obstruction**", "Resection, stoma creation, bypass, stenting"), ("**GI bleeding**", "Resection or embolization of bleeding tumor"), ("**Biliary obstruction / jaundice**", "ERCP stenting, PTBD, surgical bypass"), ("**Gastric outlet obstruction**","Gastrojejunostomy, duodenal stenting"), ("**Airway obstruction**", "Tracheostomy, debulking, bronchial stenting"), ("**Urinary obstruction**", "Urinary diversion, ureteric stenting, nephrostomy"), ("**Pain from tumor / nerve invasion**","Debulking, cordotomy, neurolysis, nerve blocks"), ("**Pathological / impending fracture**","Intramedullary nailing, endoprosthesis"), ("**Spinal cord compression**", "Decompressive laminectomy, vertebroplasty, SBRT"), ("**Dysphagia**", "PEG tube placement, esophageal stenting"), ("**Fistula**", "Diversion stoma, reconstructive closure"), ("**Fungating wound**", "Debulking, flap coverage, wound care"), ] add_table(doc, ["Symptom", "Palliative Surgical Option"], ind_rows, col_widths=[2.5, 4.0]) add_h2(doc, "Indications by Cancer Type") cancer_data = [ ("Gastric Cancer", ["Palliative gastrectomy for bleeding or obstruction", "Roux-en-Y gastrojejunostomy for gastric outlet obstruction", "Intraluminal stenting for cardia / oesophago-gastric junction tumors", "Source: Bailey & Love's Surgery 28th ed., p. 1197"]), ("Colorectal Cancer", ["Diverting colostomy or ileostomy for obstructing left-sided tumors", "Hartmann's procedure (resection + end colostomy) for complicated disease", "Endoscopic stenting as bridge to surgery or definitive palliation", "Defunctioning loop stoma for recto-vaginal or recto-vesical fistulae"]), ("Pancreatic / Periampullary Cancer", ["ERCP stenting or biliary bypass (hepaticojejunostomy) for obstructive jaundice", "Gastrojejunostomy or duodenal stenting for gastric outlet obstruction", "Celiac plexus neurolysis for refractory abdominal / back pain", "Requires MDT 'home team' to coordinate biliary decompression, nutrition, performance status", "Source: Current Surgical Therapy 14e"]), ("Head & Neck Cancer", ["Tracheostomy for airway compromise", "PEG tube for dysphagia / nutrition", "Tumor debulking for compressive symptoms", "Vocal cord medialization (injection laryngoplasty) for voice restoration and aspiration prevention", "Vascular stenting or embolization for tumor erosion into major vessels (carotid blowout)", "Source: Cummings Otolaryngology, p. 1436"]), ("Gynecological / Pelvic Cancers", ["Urinary diversion for malignant ureteric obstruction", "Diverting colostomy for recto-vaginal fistula", "Pelvic exenteration in selected recurrent disease with pelvic pain / fistulae / bleeding"]), ("Breast Cancer (Stage IV)", ["Surgery for palliation in widespread metastatic disease with poor systemic response", "Managed via MDT (surgery + medical + radiation oncology)", "Source: Current Surgical Therapy 14e"]), ("Lung Cancer", ["Tracheobronchial stenting for central airway obstruction", "Pleurodesis for malignant pleural effusion", "VATS procedures for pleural / pericardial disease"]), ("Renal Cell Carcinoma (RCC)", ["Cytoreductive nephrectomy in selected metastatic patients", "Embolization for hemorrhage from primary or metastatic sites", "Source: Campbell-Walsh-Wein Urology"]), ] for cancer, points in cancer_data: add_h3(doc, cancer) for pt in points: add_bullet(doc, pt) add_h2(doc, "Morbidities of Palliative Surgery") add_body(doc, "Morbidity after palliative surgery is significant and must be carefully weighed against expected benefit:" ) morbidity_rows = [ ("Perioperative mortality", "~4% in palliative bowel resection series"), ("Perioperative complications", "~15% (anastomotic leak, wound infection, sepsis, DVT/PE)"), ("Symptom non-resolution", "A proportion of patients do not achieve adequate symptom relief"), ("Prolonged hospitalisation", "Patients may spend a disproportionate part of remaining life in hospital"), ("Nutritional depletion", "Advanced cancer increases surgical risk; malnutrition common"), ("Wound healing failure", "Prior radiotherapy, malnutrition, or steroid use impair healing"), ("Immunosuppression", "Advanced cancer reduces infection resistance and healing capacity"), ] add_table(doc, ["Morbidity", "Detail"], morbidity_rows, col_widths=[2.5, 4.0]) add_body(doc, "Li et al. (2025 meta-analysis, PMID 40251493) in advanced gastric cancer: palliative reduction " "surgery did not confer long-term survival benefit vs. non-surgical treatment; perioperative " "complication rate 15%, mortality 4% in the surgical group." ) add_body(doc, "Low et al. (2025, PMID 39667288): Economic evidence for palliative GI surgery in malignant bowel " "obstruction remains poor-quality and heterogeneous - further standardised research is needed." ) doc.add_page_break() # ══════════════════════════════════════════════════════════════════════════════ # SECTION 3: COMMON PROCEDURES # ══════════════════════════════════════════════════════════════════════════════ add_h1(doc, "3. Common Palliative Surgery Procedures") # 3A Colostomy / Ileostomy add_h2(doc, "A. Colostomy and Ileostomy") colo_points = [ "**Colostomy** (loop or end): diverts fecal flow proximal to obstructing / non-resectable rectal or left colonic tumors; also used for colovesical / rectovaginal fistulae.", "**Ileostomy**: used when colonic segment is compromised, patient is unstable/malnourished/immunosuppressed, or as proximal diversion when anastomosis is unsafe.", "**Hartmann's procedure**: resection of sigmoid / rectum + end colostomy without anastomosis - procedure of choice for perforated or acutely obstructing left-sided colorectal cancer in compromised patients.", "Both procedures are rapid, relatively low-risk, and highly effective for obstruction and fistula relief.", ] for pt in colo_points: add_bullet(doc, pt) # 3B Gastrostomy add_h2(doc, "B. Gastrostomy (PEG / Surgical)") gastro_points = [ "**Percutaneous Endoscopic Gastrostomy (PEG)**: preferred method for enteral feeding when oral intake is inadequate due to dysphagia (head and neck, esophageal cancer, neurological compromise).", "Performed under conscious sedation with minimal morbidity; avoids general anaesthesia.", "**Surgical gastrostomy** (open or laparoscopic): used when endoscopy is not feasible (obstructing pharyngeal / esophageal tumor).", "Also used for **gastric decompression** in patients with malignant bowel obstruction who are not surgical candidates for resection.", "Source: Cummings Otolaryngology, p. 1436", ] for pt in gastro_points: add_bullet(doc, pt) # 3C Urinary Diversion add_h2(doc, "C. Urinary Diversion Procedures") ud_rows = [ ("**Percutaneous nephrostomy**", "Most immediate; minimally invasive; image-guided; first-line in emergency"), ("**JJ (Double-J) ureteric stent**","Endoscopic; preferred if technically feasible; avoids external drainage bag"), ("**Ileal conduit (Bricker's)**", "For bilateral obstruction; adequate performance status required; permanent stoma"), ("**Cutaneous ureterostomy**", "Simpler; used in frail patients who cannot tolerate ileal conduit"), ] add_table(doc, ["Procedure", "Notes"], ud_rows, col_widths=[2.2, 4.3]) add_body(doc, "Goals: relieve obstructive uropathy, prevent renal failure, allow continuation of systemic " "anticancer therapy. Perri et al. (2022, PMID 31018967): palliative urinary diversion in " "gynaecological cancers improves renal function and allows further systemic treatment in " "selected patients." ) # 3D Tracheostomy add_h2(doc, "D. Tracheostomy") trach_points = [ "**Indications**: airway obstruction from laryngeal, hypopharyngeal, tracheal, or cervical esophageal tumors; bilateral vocal cord paralysis post-surgery or from tumor invasion.", "Can be **temporary** (during active treatment) or **permanent** (non-resectable, palliative).", "Provides immediate life-saving airway access; decannulation considered if tumor responds to treatment.", "Often co-exists with PEG tube in head and neck cancer (dual airway + nutrition management).", "Source: Cummings Otolaryngology; Schwartz's Principles of Surgery", ] for pt in trach_points: add_bullet(doc, pt) # 3E Stenting add_h2(doc, "E. Stenting (Luminal and Biliary)") stent_rows = [ ("**Esophageal SEMS**", "Malignant dysphagia from esophageal/cardia tumors; rapid relief; risks: migration, perforation, tumor ingrowth"), ("**Gastroduodenal stents**","Gastric outlet obstruction (pancreatic, gastric, duodenal cancers); endoscopically placed"), ("**Colonic stents**", "Malignant large bowel obstruction; bridge to surgery or definitive palliation in non-surgical candidates"), ("**Biliary SEMS**", "Malignant biliary obstruction; longer patency (~9-12 months) vs plastic stents (~3 months); via ERCP or EUS"), ("**Airway stents**", "Central airway obstruction from lung or tracheal tumors; rigid bronchoscopy required"), ] add_table(doc, ["Stent Type", "Details"], stent_rows, col_widths=[2.2, 4.3]) add_body(doc, "Source: Bailey and Love's Surgery 28th ed.") # 3F ERCP/PTBD add_h2(doc, "F. ERCP / PTBD") add_body(doc, "Indicated for malignant biliary obstruction (pancreatic head, cholangiocarcinoma, ampullary, gallbladder cancer, lymph node compression).") ercp_points = [ "**ERCP + SEMS**: first-line approach; SEMS preferred over plastic stents for longer patency in distal biliary obstruction.", "**PTBD (Percutaneous Transhepatic Biliary Drainage)**: used when ERCP fails, hilar tumors (Klatskin), or prior bilioenteric anastomosis prevents endoscopic access.", "**Surgical biliary bypass** (hepaticojejunostomy / choledochojejunostomy): reserved for patients with good performance status undergoing laparotomy, or when endoscopic approaches are not feasible.", "**Key principle** (Current Surgical Therapy 14e): in patients with operable disease being considered for neoadjuvant therapy, avoid high-risk endoscopic procedures that could compromise subsequent surgery - 'the interventional gastroenterologist should never come first.'", ] for pt in ercp_points: add_bullet(doc, pt) # 3G Other Interventional Procedures add_h2(doc, "G. Other Interventional Surgical / Radiological Procedures") other_rows = [ ("**Embolization (TAE/TACE)**", "Bleeding from HCC, RCC, or hypervascular metastases; TACE for HCC palliation"), ("**Celiac plexus neurolysis (CPN)**", "Chemical ablation via EUS or percutaneous approach; 60-80% response rate in pancreatic cancer pain"), ("**RFA / Microwave ablation (MWA)**", "Hepatic or lung metastases; bone pain from osteolytic lesions"), ("**Vertebroplasty / Kyphoplasty**", "Percutaneous cement injection into vertebral metastases; rapid pain relief and stability"), ("**Pleurodesis**", "Talc pleurodesis (chemical or via VATS) for recurrent malignant pleural effusion"), ("**Paracentesis / Peritoneal catheter**","Repeated paracentesis or tunneled peritoneal catheter (PleurX) for malignant ascites"), ("**Vascular embolization**", "Carotid artery blowout prophylaxis / management; renal artery embolization for hemorrhage"), ("**Pelvic exenteration**", "Anterior/posterior/total; recurrent pelvic malignancy; pelvic pain, bleeding, fistulae; high morbidity"), ] add_table(doc, ["Procedure", "Indication / Notes"], other_rows, col_widths=[2.5, 4.0]) doc.add_page_break() # ══════════════════════════════════════════════════════════════════════════════ # SECTION 4: ORTHOPEDIC SURGERY # ══════════════════════════════════════════════════════════════════════════════ add_h1(doc, "4. Orthopedic Surgeries in Palliative Care") add_h2(doc, "Background and Epidemiology") add_body(doc, "Bone metastases are present in 60-80% of patients with advanced breast, prostate, and lung cancer, " "and in 25-40% with thyroid and renal cell carcinoma. They cause pain, pathological fracture, " "hypercalcaemia, and spinal cord compression - significantly impairing quality of life." ) add_body(doc, "Orthopedic surgery in palliative care aims to: relieve pain, restore skeletal stability, and " "preserve or restore ambulation with minimal surgical invasiveness." ) add_body(doc, "Surgical principles (Hayashi & Tsuchiya, 2022, PMID 35226235): (1) maintain lasting bony " "stability, (2) use minimal surgical invasiveness, (3) anticipate post-operative hardware failure " "by using long-span implants and cement augmentation." ) add_h2(doc, "Pre-operative Assessment") assess_points = [ "**Mirels' Scoring System**: predicts fracture risk in long bone metastases; score >= 9 = prophylactic fixation recommended.", "**Tokuhashi / Tomita Score**: estimate survival in spinal metastases; guides extent of spinal surgery.", "**Estimated survival**: should be >= 6 weeks to justify surgery and recovery.", "**Multidisciplinary Bone Metastasis Cancer Board**: review improves patient selection and outcomes (Miyazaki et al., 2023, PMID 38138190).", "**Imaging**: CT/MRI to define lesion extent; bone scan / PET for polyostotic disease.", "**Haematological optimisation**: anaemia, coagulopathy, thrombocytopaenia common in advanced cancer.", ] for pt in assess_points: add_bullet(doc, pt) add_h2(doc, "Procedures by Anatomical Site") add_h3(doc, "Long Bones (Femur, Humerus, Tibia)") lb_rows = [ ("**Intramedullary nailing (IMN)**", "Preferred for impending/actual pathological fractures; load-sharing; long nails with cement augmentation reduce failure rate; allows rapid weight-bearing."), ("**Plate and screw fixation**", "For smaller lesions; higher failure rate than IMN; less preferred in bone with extensive metastatic disease."), ("**Endoprosthetic replacement**", "For periarticular lesions (femoral head/neck, proximal humerus, distal femur); immediate stability; durable long-term with long-type stems + cement."), ("**PMMA cement injection**", "Augments fixation; used with nails or plates in deficient cortical bone to prevent hardware failure."), ] add_table(doc, ["Procedure", "Notes"], lb_rows, col_widths=[2.2, 4.3]) add_h3(doc, "Spine (Most Common Site)") spine_rows = [ ("**Decompressive laminectomy + stabilisation**", "Spinal cord compression with pain/weakness/incontinence; ideally within 24h of onset; followed by radiotherapy."), ("**Total en bloc spondylectomy (TES)**", "Solitary metastases from RCC or thyroid cancer (radioresistant); good prognosis; high blood loss but durable."), ("**Separation surgery**", "Debulking of epidural tumor to create margin for SBRT; less invasive than TES; combined with SBRT for local control."), ("**Vertebroplasty / Kyphoplasty**", "Percutaneous cement for compression fracture pain without cord compression; minimally invasive; rapid pain relief."), ] add_table(doc, ["Procedure", "Notes"], spine_rows, col_widths=[2.5, 4.0]) add_body(doc, "SBRT/SABR: ASTRO 2024 Clinical Practice Guideline (PMID 38788923) supports external beam " "radiotherapy as first-line for painful bone metastases, with SBRT for oligometastatic or " "previously irradiated sites." ) add_h3(doc, "Pelvis and Acetabulum") pelvis_points = [ "Custom-made implants or recycled autologous bone grafting for acetabular metastases in patients with good prognosis.", "Hemipelvectomy or internal hemipelvectomy for isolated, resectable pelvic tumors with good performance status.", "Percutaneous bone cement injection into pelvis is effective and less invasive for pain from acetabular metastases.", ] for pt in pelvis_points: add_bullet(doc, pt) add_h2(doc, "Key Decision Points for Pathological Fractures") kd_points = [ "**Stabilise before irradiating**: radiotherapy weakens bone in the short term; surgical fixation first provides immediate structural support.", "**Cement augmentation** at time of fixation prevents hardware failure in demineralised bone.", "**Post-operative radiotherapy** reduces local recurrence and hardware loosening.", "**Prophylactic fixation** of impending fractures (Mirels >=9) prevents worse pain, blood loss, and morbidity of actual fracture surgery.", ] for pt in kd_points: add_bullet(doc, pt) add_h2(doc, "Morbidities of Orthopedic Palliative Procedures") orth_morb = [ ("Short-term", "Dislocation (endoprosthesis), DVT/PE, wound infection, blood loss, hardware failure"), ("Long-term", "Implant loosening, tumor re-growth, hardware failure (reduced by long IMN + cement)"), ("Benefit", "Clearly demonstrated in functional restoration (ambulation, pain) even with modest survival gains"), ] add_table(doc, ["Timeframe", "Morbidities / Outcomes"], orth_morb, col_widths=[1.5, 5.0]) doc.add_page_break() # ══════════════════════════════════════════════════════════════════════════════ # SUMMARY TABLE # ══════════════════════════════════════════════════════════════════════════════ add_h1(doc, "Quick Reference: Palliative Surgical Procedures at a Glance") summary_rows = [ ("Colostomy / Ileostomy", "Bowel obstruction, fistula", "Colorectal, pelvic cancers"), ("Gastrostomy (PEG/surgical)", "Dysphagia, nutritional support, gastric drainage", "Head/neck, esophageal, gastric"), ("Urinary diversion / JJ / nephrostomy","Malignant ureteric obstruction", "Cervical, bladder, colorectal, retroperitoneal"), ("Tracheostomy", "Airway obstruction, aspiration", "Head/neck, larynx, trachea, thyroid"), ("Luminal stenting", "Obstruction, dysphagia", "Esophageal, gastric, colorectal, pancreatic"), ("ERCP / PTBD / biliary bypass", "Malignant obstructive jaundice", "Pancreatic, cholangiocarcinoma, ampullary, gallbladder"), ("Celiac plexus neurolysis", "Refractory abdominal/back pain", "Pancreatic, upper GI cancers"), ("Vertebroplasty / Kyphoplasty", "Vertebral compression fracture pain", "Breast, prostate, myeloma, lung"), ("Intramedullary nail / Endoprosthesis","Pathological/impending long bone fracture","Breast, lung, prostate, RCC"), ("Decompressive laminectomy", "Spinal cord compression", "Any cancer with vertebral metastasis"), ("Pleurodesis", "Malignant pleural effusion", "Lung, breast, mesothelioma"), ("Pelvic exenteration", "Pelvic pain, fistula, bleeding", "Recurrent cervical / rectal cancer"), ("Embolization (TAE/TACE)", "Tumor bleeding, HCC palliation", "HCC, RCC, hypervascular metastases"), ("Paracentesis / Peritoneal catheter","Malignant ascites", "GI, ovarian, peritoneal carcinomatosis"), ] add_table(doc, ["Procedure", "Indication", "Cancer Types"], summary_rows, col_widths=[2.0, 2.2, 2.3] ) doc.add_page_break() # ══════════════════════════════════════════════════════════════════════════════ # REFERENCES # ══════════════════════════════════════════════════════════════════════════════ add_h1(doc, "References") refs = [ "1. Schwartz's Principles of Surgery, 11th Edition. McGraw-Hill.", "2. Bailey and Love's Short Practice of Surgery, 28th Edition. CRC Press/Taylor & Francis.", "3. Current Surgical Therapy, 14th Edition. Elsevier.", "4. Cummings Otolaryngology - Head and Neck Surgery, 7th Edition. Elsevier.", "5. Campbell-Walsh-Wein Urology, 12th Edition. Elsevier.", "6. Sabiston Textbook of Surgery, The Biological Basis of Modern Surgical Practice. Elsevier.", "7. Wong JSM et al. Definition of Palliative Surgery in Cancer Care: A Systematic Review. J Surg Oncol. 2025. PMID: 39610018.", "8. Low XC et al. Economic evaluation of palliative gastrointestinal surgery for advanced cancer patients with malignant bowel obstruction: A systematic review. Eur J Surg Oncol. 2025. PMID: 39667288.", "9. Li X et al. Meta-analysis of the efficacy of applying reduced surgery for the treatment of asymptomatic unresectable advanced gastric cancer. BMC Gastroenterol. 2025. PMID: 40251493.", "10. Hayashi K, Tsuchiya H. The role of surgery in the treatment of metastatic bone tumor. Int J Clin Oncol. 2022. PMID: 35226235.", "11. Miyazaki K et al. Effect of Bone Metastasis Cancer Board on Spinal Surgery Outcomes. Medicina. 2023. PMID: 38138190.", "12. Alcorn S et al. External Beam Radiation Therapy for Palliation of Symptomatic Bone Metastases: An ASTRO Clinical Practice Guideline. Pract Radiat Oncol. 2024. PMID: 38788923.", "13. Perri T et al. Palliative urinary diversion in patients with malignant ureteric obstruction due to gynaecological cancer. BMJ Support Palliat Care. 2022. PMID: 31018967.", ] for ref in refs: p = doc.add_paragraph() p.paragraph_format.space_before = Pt(2) p.paragraph_format.space_after = Pt(3) run = p.add_run(ref) run.font.name = "Calibri" run.font.size = Pt(10) run.font.color.rgb = DARK # ── Save ───────────────────────────────────────────────────────────────────── out_path = "/tmp/workspace/palliative-surgery/Palliative_Surgery_Study_Guide.docx" doc.save(out_path) print(f"Saved: {out_path}") PYEOF echo "Script written."
python3 /tmp/workspace/palliative-surgery/create_doc.py
python3 -c " from docx import Document doc = Document('/tmp/workspace/palliative-surgery/Palliative_Surgery_Study_Guide.docx') count = 0 for p in doc.paragraphs: if p.text.strip(): print(f'[{p.style.name}] {p.text[:80]}') count += 1 if count > 40: break print('---') print(f'Total paragraphs: {len(doc.paragraphs)}') print(f'Total tables: {len(doc.tables)}') "
Palliative Surgery Study Guide
Word Document · DOCX
| Section | Content |
|---|---|
| Cover Page | Title, subtitle, source attribution, date |
| Section 1 | Definition of palliative surgery, guiding principles table, core competencies, key PubMed evidence |
| Section 2 | Indications by symptom (table), indications by 8 cancer types (gastric, colorectal, pancreatic, H&N, gynae, breast, lung, RCC), morbidity table with % figures |
| Section 3 | All 7 common procedures: Colostomy/Ileostomy, Gastrostomy, Urinary Diversion, Tracheostomy, Stenting, ERCP/PTBD, Other interventional procedures - each with a formatted table |
| Section 4 | Orthopedic surgery: epidemiology, pre-op assessment (Mirels/Tokuhashi), procedures by site (long bones, spine, pelvis), key decision points, morbidity table |
| Quick Reference | Full summary table of all 14 procedures, indications, and cancer types |
| References | 13 references: 6 standard textbooks + 7 PubMed citations (2022-2026) |