Diagnosis work up and management

Reading File
Running Command

python3 -c " from pptx import Presentation prs = Presentation('/tmp/workspace/attachments/37eff665-04d3-401c-8f18-eeb82fb0eba1/SHORT CASES.pptx') for i, slide in enumerate(prs.slides, 1): print(f'=== SLIDE {i} ===') for shape in slide.shapes: if shape.has_text_frame and shape.text_frame.text.strip(): print(shape.text_frame.text) print() "

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Here is the full diagnosis, workup, and management for all 10 gynae short cases from your presentation:

SHORT CASES - GYNAECOLOGY: Diagnosis, Workup & Management


CASE 1 - 65-year-old, DM for 30 years, postmenopausal x18 years, PMB x4 months, uterus enlarged to 8 weeks

Diagnosis

Endometrial Carcinoma (most likely - Endometrioid Type I)
Classic triad risk factors present: Postmenopausal bleeding + Diabetes + Hypertension (Obesity, DM, HTN = the "Estrogen excess" triad)

Workup

InvestigationPurpose
Pap smear / P/SScreen, though often normal in endometrial Ca
Endometrial biopsy (Pipelle)Gold standard first-line tissue diagnosis
Fractional D&CIf biopsy inconclusive or cervical involvement suspected
Transvaginal USGEndometrial thickness >4 mm in PMB is significant
MRI pelvisDepth of myometrial invasion, cervical spread (staging)
CT chest/abdomen/pelvisLymph node and distant metastases
CBC, LFT, RFT, blood sugarPreoperative assessment
CA-125Elevated in advanced disease, baseline for follow-up

Staging (FIGO)

  • Stage I: Confined to uterus
  • Stage II: Cervical involvement
  • Stage III: Local/regional spread
  • Stage IV: Bladder/bowel/distant mets

Management

  • Surgery (mainstay): Total abdominal hysterectomy + bilateral salpingo-oophorectomy (TAH + BSO) + pelvic & para-aortic lymph node dissection
  • Adjuvant RT: Vaginal brachytherapy for Stage IB (deep myometrial invasion); pelvic EBRT for Stage II-III
  • Chemotherapy (advanced/recurrent): Carboplatin + Paclitaxel
  • Hormonal therapy: Medroxyprogesterone acetate (MPA) / Megace for Grade 1, Stage I unfit for surgery or recurrent hormone-receptor positive disease
  • Optimize DM and HTN preoperatively

CASE 2 - 30-year-old nullipara, menorrhagia x4 years, 8/28 cycle, dysmenorrhoea, uterus enlarged to 10 weeks symmetrically, Pallor++

Diagnosis

Leiomyoma (Fibroid) Uterus - likely intramural/submucosal causing menorrhagia

Workup

InvestigationPurpose
Transvaginal/Transabdominal USGConfirms fibroids, number, size, type (submucosal/intramural/subserosal)
CBC + peripheral smearDegree of anaemia
Iron studies (serum ferritin, TIBC)Iron deficiency anaemia workup
LFT, coagulation profileRule out bleeding disorders
TSHHypothyroidism as cause of menorrhagia
HysteroscopyGold standard for submucosal fibroids, direct visualisation + biopsy
MRI pelvisMapping prior to myomectomy or embolisation
Endometrial biopsyIf abnormal bleeding pattern
Blood group and cross-matchPre-surgical

Management

Medical (temporising, for those wanting fertility):
  • Iron supplementation to correct anaemia
  • Tranexamic acid / NSAIDs for menorrhagia
  • Combined OCP or LNG-IUS (Mirena) - reduces flow
  • GnRH agonists (Leuprolide) for 3-6 months preoperatively - shrinks fibroids, corrects anaemia
Surgical:
  • Myomectomy (preferred - nulliparous, wants fertility) - open/laparoscopic/hysteroscopic depending on fibroid type
  • Hysterectomy - if family complete, large/multiple fibroids
  • Uterine artery embolisation (UAE) - minimally invasive option

CASE 3 - 64-year-old, postmenopausal x20 years, P3L3, abdominal bloating, lower back pain, early satiety, fatigue, weight loss, left ovarian complex mass 10x8x9 cm with gross ascites

Diagnosis

Carcinoma Ovary (Epithelial - High-grade Serous Ovarian Carcinoma most likely, Stage IIIC based on ascites + pelvic mass)
Triad: Postmenopausal + Adnexal mass + Ascites = Ovarian Ca until proven otherwise

Workup

InvestigationPurpose
CA-125Elevated in >80% of epithelial ovarian Ca; staging/follow-up
HE4 (Human epididymis protein 4)Better specificity than CA-125
ROMA scoreCombines CA-125 + HE4 for malignancy risk
CEA, CA 19-9Rule out colorectal/GI primary
AFP, beta-hCG, LDHIf germ cell tumor suspected (less likely at age 64)
Contrast CT abdomen/pelvisExtent of disease, peritoneal deposits, lymph nodes
MRI pelvisBetter characterisation of ovarian mass
CXR / CT chestPleural effusion, lung mets (Stage IV)
Diagnostic paracentesisCytology for malignant cells; CA-125 in fluid
USG-guided biopsy (if unresectable)Tissue diagnosis before neoadjuvant chemo
BRCA1/BRCA2 testingGenetic counselling, treatment implications
CBC, LFT, RFT, albuminNutritional/preoperative status

FIGO Staging

  • Stage I: Limited to ovaries
  • Stage III: Peritoneal spread/retroperitoneal nodes (most common at presentation)
  • Stage IV: Distant mets (liver parenchyma, pleura)

Management

Surgical:
  • Optimal debulking surgery (cytoreduction): TAH + BSO + omentectomy + peritoneal stripping + appendicectomy - aim for no residual disease (<1 cm)
  • Interval debulking after neoadjuvant chemo if initially unresectable
Chemotherapy:
  • First-line: Carboplatin (AUC 5-6) + Paclitaxel 175 mg/m² IV, 6 cycles
  • Bevacizumab (anti-VEGF) added in high-risk Stage III/IV
  • PARP inhibitors (Olaparib, Niraparib) as maintenance therapy in BRCA-mutated cases
  • Neoadjuvant chemotherapy (NACT) + interval debulking if poor PS or unresectable disease
Palliative care for symptomatic ascites (serial paracentesis / PleurX catheter)

CASE 4 - 30-year-old, P2, LCB 3 years ago, menorrhagia + low abdominal pain x6 months, dysmenorrhoea, uterus 16 weeks irregular, mobile, BPV++

Diagnosis

Fibroid Uterus (Multiple intramural/subserosal fibroids - larger and irregular compared to Case 2)
  • BPV = Bleeding Per Vaginum; irregular enlarged uterus strongly suggests multiple fibroids

Workup

Same as Case 2, with additions:
  • Pap smear - cervix healthy but standard of care
  • Detailed USG fibroid mapping (number, size, vascularity)
  • MRI if myomectomy/UAE planned

Management

  • Since family is complete (P2): Hysterectomy is definitive treatment
  • Laparoscopic or abdominal hysterectomy depending on uterine size (16 weeks - likely abdominal approach)
  • If fertility desired: myomectomy (though at 16 weeks size, risk of recurrence and blood loss is higher)
  • GnRH agonist preoperatively to shrink fibroid and correct anaemia
  • Iron + folic acid to optimise haemoglobin before surgery

CASE 5 - 35-year-old, DM Type 2, P2, perineal itching, red vulva, thick curdy discharge, white flakes with oozing spots on removal

Diagnosis

Vulvovaginal Candidiasis (VVC) - complicated (Diabetic = predisposing factor, likely Candida albicans)
Classic signs: Curdy/cottage-cheese discharge + vulval erythema + itching + white plaques that bleed when removed (thrush)

Workup

InvestigationPurpose
High vaginal swab (HVS) + cultureConfirms Candida species; speciation important (C. glabrata, C. krusei are azole-resistant)
Wet mount microscopyBudding yeast cells + pseudohyphae (KOH preparation)
Vaginal pHTypically normal <4.5 (distinguishes from BV/Trichomoniasis)
Fasting blood glucose / HbA1cAssess diabetic control (poor control predisposes to recurrence)
Urine R/EGlucosuria
HIV testingImmunocompromise if recurrent

Management

Local (uncomplicated):
  • Clotrimazole 500 mg pessary single dose or 100 mg x 7 days
  • Miconazole cream for vulval involvement
Systemic (complicated - DM patient, likely recurrent):
  • Fluconazole 150 mg oral, single dose (or 150 mg every 72 hours x 3 doses for severe)
  • For recurrent VVC (≥4 episodes/year): Fluconazole 150 mg weekly x 6 months (suppressive therapy)
Address underlying cause:
  • Strict glycaemic control (HbA1c <7%)
  • Avoid tight synthetic clothing, local irritants

CASE 6 - 58-year-old, P7, low socio-economic status, irregular PV bleeding x1 year, foul-smelling discharge x6 months, fungating growth replacing cervix, bleeds on touch, parametrium bilateral up to lateral pelvic wall, rectal mucosa free

Diagnosis

Carcinoma Cervix - Stage IIIB (parametrium involved bilaterally up to lateral pelvic wall; rectal mucosa free rules out Stage IVA)
Classic presentation: Multipara + poor SES + postmenopausal bleeding + foul discharge + fungating cervix + contact bleeding

Workup

InvestigationPurpose
Cervical biopsyHistopathological confirmation (Squamous cell Ca ~80%, Adenocarcinoma ~15%)
Pap smear (if no biopsy)Cytology
ColposcopyIf lesion not visible; map extent
MRI pelvisBest for parametrial invasion, nodal involvement, staging
CT chest/abdomen/pelvisLymph nodes, distant metastases
CystoscopyRule out bladder involvement (Stage IVA)
ProctosigmoidoscopyRule out rectal involvement
IVU / CT urographyHydronephrosis (Stage IIIB criterion)
CBC, LFT, RFTAnaemia (Pallor+++), organ function, nutritional status
HPV typingFor documentation; HPV 16/18 commonest
Blood group, cross-matchSevere anaemia, may need transfusion

FIGO Staging (Clinical)

  • Stage IIIB: Parametrium involvement to lateral pelvic wall and/or hydronephrosis/non-functioning kidney

Management

This is Stage IIIB - NOT suitable for surgery. Standard treatment:
  • Concurrent Chemoradiation (CCRT):
    • External beam radiotherapy (EBRT) to pelvis: 45-50 Gy in 25 fractions
    • Intracavitary brachytherapy (ICBT): Boost to central disease
    • Weekly Cisplatin 40 mg/m² concurrent with radiotherapy (radiosensitiser)
  • Correct anaemia before radiotherapy (Hb > 10 g/dL preferred)
  • Nutritional support, palliative care
  • If renal impairment from ureteric obstruction: ureteric stenting / nephrostomy

CASE 7 - 50-year-old, menopausal x1 year, multipara (P4), rapid succession of pregnancies, chronic cough, dragging sensation x3 years, something coming out PV x1 year, cystocele + rectocele, cervix outside introitus, decubitus ulcers on cervical lips, uterus small menopausal size

Diagnosis

Third-Degree (Complete) Uterovaginal Prolapse with:
  • Cystocele (anterior vaginal wall prolapse)
  • Rectocele (posterior vaginal wall prolapse)
  • Decubitus (cervical) ulcers from chronic exposure
Risk factors present: Multiparity + prolonged labours + rapid succession + chronic cough (raised intra-abdominal pressure) + menopause (oestrogen deficiency)

Workup

InvestigationPurpose
POP-Q (Pelvic Organ Prolapse Quantification)Objective staging of prolapse
Urine R/E + cultureUrinary symptoms (stress incontinence common with cystocele)
UrodynamicsIf urinary incontinence present, pre-surgical planning
Biopsy of cervical ulcerMust rule out carcinoma in a decubitus ulcer
Pap smearCervical cytology
ColposcopyIf biopsy needed
USG pelvisUterine/adnexal pathology
CXRChronic cough - assess chest (also preoperative)
CBC, blood sugar, RFTPreoperative workup
ECGPreoperative cardiac assessment

Management

Conservative (for those unfit for surgery or mild symptoms):
  • Pelvic floor exercises (Kegel)
  • Ring pessary - temporary, for those awaiting surgery or unfit
  • Local oestrogen cream for atrophic changes
Definitive - Surgical (this patient - complete prolapse, fit for surgery):
  • Vaginal hysterectomy (procedure of choice in complete prolapse)
  • Anterior colporrhaphy (repair of cystocele)
  • Posterior colpoperineorrhaphy (repair of rectocele)
  • Pelvic floor repair (Manchester repair if uterus to be preserved)
  • Treat decubitus ulcers before surgery: local oestrogen + saline soaks + reduce prolapse with pessary for 4-6 weeks

CASE 8 - 28-year-old, P2, LCB 3 years, post-coital bleeding x2 months, Pallor+, fungating growth from posterior lip of cervix 3 cm, bleeds on touch, parametrium free, vagina healthy

Diagnosis

Carcinoma Cervix - Stage IB1 (clinically visible lesion ≤4 cm, confined to cervix, parametrium free, vagina free)
Young woman + PCB + fungating cervical growth + bleeds on touch = Ca Cervix until proven otherwise

Workup

InvestigationPurpose
Cervical punch biopsyHistopathological confirmation
Colposcopy + directed biopsyIf biopsy site unclear
MRI pelvisTumour size, stromal invasion, parametrium, lymph nodes
PET-CTNodal staging, especially for surgical candidates
Cystoscopy / ProctoscopyRule out bladder/rectal involvement
HPV DNA test + genotypingDocumentation
CBC, LFT, RFTPreoperative
Chest X-rayLung metastases
Colposcopy of vaginaAssess vaginal walls

Management

Stage IB1 (≤4 cm, clinically confined to cervix) - Surgical approach preferred (young patient):
  • Radical hysterectomy (Wertheim's hysterectomy) - uterus + upper vaginal cuff + parametria + bilateral pelvic lymph node dissection
    • Advantage over CCRT in young patients: ovaries preserved, no radiation-induced vaginal stenosis or bowel complications
  • OR Concurrent Chemoradiation (CCRT) - equivalent oncological outcomes but preferred when surgery is contraindicated
  • Fertility-sparing option (if patient requests): Radical trachelectomy + pelvic lymph node dissection (for Stage IA2 - IB1 ≤2 cm; this lesion is 3 cm, so requires multidisciplinary decision)
Adjuvant therapy post-surgery if high-risk features (positive nodes, positive margins, parametrial involvement): CCRT

CASE 9 - 26-year-old, recently married, burning micturition x10 days, foul-smelling discharge x10 days, thin frothy greenish discharge, cervix healthy, multiple punctate haemorrhagic spots on vaginal walls

Diagnosis

Trichomoniasis (Trichomonas vaginalis infection)
Pathognomonic: Thin, frothy, greenish/yellow foul-smelling discharge + strawberry cervix/vagina (punctate haemorrhagic spots = colpitis macularis)

Workup

InvestigationPurpose
Wet mount microscopyMotile, pear-shaped flagellated trichomonads - gold standard for point-of-care
Vaginal pHElevated >4.5 (alkaline)
NAAT (Nucleic Acid Amplification Test)Highest sensitivity (~98%), confirms diagnosis
HVS + culture (Diamond's medium)Culture if wet mount negative
Vaginal discharge Gram stainRule out concurrent BV
STI screen: HIV, VDRL, chlamydia, gonorrhoeaTrichomoniasis is an STI - screen for coinfection
Partner notification and testingEssential for treatment success

Management

  • Metronidazole 2 g orally, single dose (treatment of choice)
  • OR Metronidazole 400-500 mg BD x 7 days (if single dose fails)
  • Tinidazole 2 g single dose (alternative, better compliance)
  • Treat sexual partner simultaneously (to prevent reinfection)
  • Avoid alcohol during and 48 hours after metronidazole (disulfiram-like reaction)
  • Retest in 3 months if high-risk (concurrent STI screening)
  • Counselling on safe sex practices

CASE 10 - 30-year-old, dribbling of urine x7 months, vaginal delivery 7 months ago at home by local practitioner with forceps application, 2-day labour, stillbirth 3.5 kg, small hole 0.5 x 1 cm at vesico-cervical junction (anterior vaginal wall-cervix)

Diagnosis

Vesico-Vaginal Fistula (VVF) - Obstetric (iatrogenic/obstructed labour-related)
Classic scenario: Prolonged obstructed labour + instrumental delivery + stillbirth + continuous dribbling of urine postpartum = Obstetric VVF

Workup

InvestigationPurpose
Dye test (Methylene blue / Evans blue)200 ml instilled into bladder via catheter; blue dye seen vaginally confirms VVF
Three swab testDifferentiates VVF from ureterovaginal fistula (upper swab wet = ureterovaginal)
Cystoscopy + vaginoscopyLocalise fistula site, assess size, proximity to ureteric orifices
IVU / CT urographyRule out concurrent ureterovaginal fistula; assess upper tracts
MRI pelvisComplex fistulas, extent of tissue necrosis
Urine R/E + culture + sensitivityTreat UTI before surgery
RFTAssess renal function
CBCPre-surgical
Biopsy of fistula edgeRule out malignancy (especially if radiation-related)

Classification of VVF

  • Simple: <0.5 cm, away from ureters
  • Complex: >2 cm, near ureteric orifice, radiation-induced, recurrent

Management

Conservative (small, fresh fistulas <72 hours or small <3 mm):
  • Continuous bladder drainage (Foley catheter x 4-6 weeks) - may spontaneously close
  • Antibiotics, anticholinergics
Surgical (definitive):
  • Wait 3 months after delivery before surgery (allows oedema and inflammation to resolve)
  • Fistula repair (colpocleisis/transvaginal approach):
    • Latzko operation (for post-hysterectomy VVF)
    • Transvaginal layered repair - first-line for obstetric VVF
    • Transabdominal (O'Connor) approach - for complex/recurrent VVF
  • Principles of repair: Wide mobilisation, tension-free closure, layered repair, adequate vascular supply, urinary diversion post-repair (catheter x 14 days)
  • Pre-surgical: treat active UTI, correct anaemia, local oestrogen for tissue quality
  • Post-repair: Foley catheter x 14-21 days, anticholinergics, pelvic rest
Rehabilitation and counselling - psychological support (social stigma of constant leakage)

Quick Summary Table

CaseDiagnosisKey InvestigationsKey Management
1Endometrial CarcinomaEndometrial biopsy, TVUS, MRI pelvisTAH+BSO+LND ± adjuvant RT/chemo
2Fibroid Uterus (nullipara)TVUS, hysteroscopyMyomectomy (fertility-preserving)
3Carcinoma Ovary Stage IIICCA-125, CT abdomen/pelvis, cytologyDebulking surgery + Carboplatin/Paclitaxel
4Fibroid Uterus (family complete)TVUS, MRIHysterectomy
5Vulvovaginal Candidiasis (DM)KOH wet mount, HVS culture, HbA1cFluconazole 150 mg ± glucose control
6Ca Cervix Stage IIIBCervical biopsy, MRI, cystoscopyCCRT (Cisplatin + EBRT + brachytherapy)
7Complete Uterovaginal ProlapsePOP-Q, ulcer biopsy, urodynamicsVaginal hysterectomy + colporrhaphy
8Ca Cervix Stage IB1Cervical biopsy, MRI, PET-CTWertheim's hysterectomy
9TrichomoniasisWet mount, NAAT, STI screenMetronidazole 2 g single dose + treat partner
10Vesico-Vaginal Fistula (obstetric)Dye test, cystoscopy, IVUTransvaginal fistula repair (after 3 months)

Create a clinical summary PDF for quick reference during rounds

Reading File
Running Command

ls -la /tmp/workspace/ 2>/dev/null && mkdir -p /tmp/workspace/gynae-rounds-pdf

Writing File

~/gynae-rounds-pdf/build_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, mm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether, PageBreak
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import Frame, PageTemplate
from reportlab.pdfgen import canvas
from datetime import date

OUTPUT = "/tmp/workspace/gynae-rounds-pdf/Gynae_Short_Cases_Quick_Reference.pdf"

# ── Colour palette ──────────────────────────────────────────────────────────
NAVY      = colors.HexColor("#1B3A6B")
TEAL      = colors.HexColor("#007F8B")
SAGE      = colors.HexColor("#E8F5F7")
ACCENT    = colors.HexColor("#D94F4F")
GOLD      = colors.HexColor("#F0A500")
LIGHT_GRY = colors.HexColor("#F5F5F5")
MID_GRY   = colors.HexColor("#CCCCCC")
WHITE     = colors.white
BLACK     = colors.black

# ── Styles ──────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def S(name, **kw):
    """Quick style builder."""
    return ParagraphStyle(name, **kw)

TITLE_STYLE = S("Title", fontSize=20, textColor=WHITE, alignment=TA_CENTER,
                fontName="Helvetica-Bold", spaceAfter=2)
SUBTITLE_STYLE = S("Sub", fontSize=11, textColor=colors.HexColor("#B0D8E0"),
                   alignment=TA_CENTER, fontName="Helvetica", spaceAfter=4)
CASE_HEADER = S("CaseH", fontSize=13, textColor=WHITE, fontName="Helvetica-Bold",
                alignment=TA_LEFT, leading=16)
SECTION_LABEL = S("SecL", fontSize=8, textColor=TEAL, fontName="Helvetica-Bold",
                  spaceAfter=1, spaceBefore=4)
BODY = S("Body", fontSize=8.5, textColor=BLACK, fontName="Helvetica",
         leading=12, spaceAfter=1)
BULLET = S("Bul", fontSize=8.5, textColor=BLACK, fontName="Helvetica",
           leading=12, leftIndent=10, bulletIndent=0, spaceAfter=1)
DIAG_STYLE = S("Diag", fontSize=10, textColor=NAVY, fontName="Helvetica-Bold",
               spaceAfter=2)
SMALL = S("Sm", fontSize=7.5, textColor=colors.HexColor("#555555"),
          fontName="Helvetica", leading=10)
TABLE_HDR = S("TH", fontSize=8, textColor=WHITE, fontName="Helvetica-Bold",
              alignment=TA_CENTER, leading=10)
TABLE_CELL = S("TC", fontSize=8, textColor=BLACK, fontName="Helvetica",
               alignment=TA_LEFT, leading=10)

# ── Header/Footer canvas callback ───────────────────────────────────────────
def header_footer(canvas_obj, doc):
    canvas_obj.saveState()
    W, H = A4
    # Footer
    canvas_obj.setFont("Helvetica", 7)
    canvas_obj.setFillColor(colors.HexColor("#888888"))
    canvas_obj.drawString(1.5*cm, 0.8*cm,
        f"Gynaecology Short Cases | Quick Reference | {date.today().strftime('%B %Y')}")
    canvas_obj.drawRightString(W - 1.5*cm, 0.8*cm,
        f"Page {doc.page}")
    canvas_obj.setStrokeColor(MID_GRY)
    canvas_obj.setLineWidth(0.3)
    canvas_obj.line(1.5*cm, 1.0*cm, W - 1.5*cm, 1.0*cm)
    canvas_obj.restoreState()

# ── Helper: coloured banner row for a case ──────────────────────────────────
def case_banner(case_num, title, diagnosis):
    data = [[
        Paragraph(f"CASE {case_num}", CASE_HEADER),
        Paragraph(title, CASE_HEADER),
        Paragraph(f"Dx: {diagnosis}", S("DxBan", fontSize=9.5, textColor=GOLD,
                  fontName="Helvetica-Bold", alignment=TA_LEFT, leading=13)),
    ]]
    col_widths = [2.0*cm, 8.0*cm, 7.5*cm]
    t = Table(data, colWidths=col_widths)
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), NAVY),
        ("TOPPADDING",   (0,0), (-1,-1), 6),
        ("BOTTOMPADDING",(0,0), (-1,-1), 6),
        ("LEFTPADDING",  (0,0), (-1,-1), 8),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
        ("VALIGN",       (0,0), (-1,-1), "MIDDLE"),
        ("LINEBELOW", (0,0), (-1,-1), 1, TEAL),
    ]))
    return t

# ── Helper: two-column workup + management table ────────────────────────────
def workup_mgmt_table(inv_rows, mgmt_bullets):
    """inv_rows: list of (Investigation, Purpose)  |  mgmt_bullets: list of strings"""
    left_data = [[
        Paragraph("INVESTIGATIONS / WORKUP", TABLE_HDR),
        Paragraph("PURPOSE", TABLE_HDR),
    ]]
    for inv, pur in inv_rows:
        left_data.append([
            Paragraph(inv, S("TCI", fontSize=8, fontName="Helvetica-Bold",
                             textColor=NAVY, leading=10)),
            Paragraph(pur, TABLE_CELL),
        ])

    right_data = [[Paragraph("MANAGEMENT", TABLE_HDR)]]
    for b in mgmt_bullets:
        right_data.append([Paragraph(f"\u2022  {b}", BULLET)])

    # Build left table
    lt = Table(left_data, colWidths=[4.5*cm, 5.5*cm])
    lt.setStyle(TableStyle([
        ("BACKGROUND",   (0,0), (-1,0), TEAL),
        ("BACKGROUND",   (0,1), (-1,-1), LIGHT_GRY),
        ("ROWBACKGROUNDS",(0,1),(-1,-1),[WHITE, LIGHT_GRY]),
        ("GRID",         (0,0), (-1,-1), 0.3, MID_GRY),
        ("TOPPADDING",   (0,0), (-1,-1), 3),
        ("BOTTOMPADDING",(0,0), (-1,-1), 3),
        ("LEFTPADDING",  (0,0), (-1,-1), 5),
        ("RIGHTPADDING", (0,0), (-1,-1), 4),
        ("VALIGN",       (0,0), (-1,-1), "TOP"),
    ]))

    # Build right table
    rt = Table(right_data, colWidths=[7.0*cm])
    rt.setStyle(TableStyle([
        ("BACKGROUND",   (0,0), (-1,0), ACCENT),
        ("BACKGROUND",   (0,1), (-1,-1), colors.HexColor("#FFF5F5")),
        ("ROWBACKGROUNDS",(0,1),(-1,-1),[WHITE, colors.HexColor("#FFF5F5")]),
        ("GRID",         (0,0), (-1,-1), 0.3, MID_GRY),
        ("TOPPADDING",   (0,0), (-1,-1), 3),
        ("BOTTOMPADDING",(0,0), (-1,-1), 3),
        ("LEFTPADDING",  (0,0), (-1,-1), 6),
        ("RIGHTPADDING", (0,0), (-1,-1), 4),
        ("VALIGN",       (0,0), (-1,-1), "TOP"),
    ]))

    combined = Table([[lt, Spacer(0.3*cm,0), rt]], colWidths=[10.2*cm, 0.3*cm, 7.2*cm])
    combined.setStyle(TableStyle([
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("LEFTPADDING", (0,0), (-1,-1), 0),
        ("RIGHTPADDING", (0,0), (-1,-1), 0),
        ("TOPPADDING", (0,0), (-1,-1), 0),
        ("BOTTOMPADDING", (0,0), (-1,-1), 0),
    ]))
    return combined

# ── Helper: key facts ribbon ────────────────────────────────────────────────
def facts_ribbon(facts):
    """facts: list of (label, value)"""
    cells = []
    for label, val in facts:
        cells.append(Paragraph(
            f'<font color="#007F8B"><b>{label}:</b></font> {val}',
            S("FR", fontSize=8, fontName="Helvetica", leading=10, textColor=BLACK)
        ))
    t = Table([cells], colWidths=[17.7*cm/len(facts)]*len(facts))
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), SAGE),
        ("TOPPADDING", (0,0), (-1,-1), 4),
        ("BOTTOMPADDING",(0,0),(-1,-1), 4),
        ("LEFTPADDING", (0,0), (-1,-1), 6),
        ("RIGHTPADDING",(0,0),(-1,-1), 6),
        ("BOX", (0,0),(-1,-1), 0.5, TEAL),
        ("INNERGRID", (0,0),(-1,-1), 0.3, MID_GRY),
        ("VALIGN", (0,0),(-1,-1), "MIDDLE"),
    ]))
    return t

# ── Case data ────────────────────────────────────────────────────────────────
CASES = [

    # ── CASE 1 ──────────────────────────────────────────────────────────────
    dict(
        num=1, short="65F | DM 30y | Postmenopausal 18y | PMB 4 months | Uterus 8wks",
        diagnosis="Endometrial Carcinoma (Type I Endometrioid)",
        facts=[("Age","65F"), ("Key Sx","Postmenopausal bleeding"), ("Risk","DM + HTN"),
               ("FIGO","Confirm by MRI + biopsy"), ("Stage clue","Ut enlarged 8wks")],
        inv=[
            ("Endometrial Biopsy (Pipelle)", "Gold standard tissue diagnosis"),
            ("TVUS endometrial thickness", ">4 mm in PMB is significant"),
            ("Fractional D&C", "If biopsy inconclusive / Cx involvement"),
            ("MRI Pelvis", "Myometrial invasion depth, Cx spread, staging"),
            ("CT Chest/Abdomen/Pelvis", "Lymph nodes, distant mets"),
            ("CA-125", "Baseline; elevated in advanced disease"),
            ("CBC, LFT, RFT, HbA1c", "Preop + DM assessment"),
        ],
        mgmt=[
            "TAH + BSO + pelvic & para-aortic lymph node dissection",
            "Adjuvant vaginal brachytherapy: Stage IB (deep invasion)",
            "Pelvic EBRT: Stage II-III disease",
            "Chemotherapy (advanced/recurrent): Carboplatin + Paclitaxel",
            "Hormonal therapy: MPA/Megace for Grade 1 unfit for surgery",
            "Optimize DM and HTN preoperatively",
        ],
    ),

    # ── CASE 2 ──────────────────────────────────────────────────────────────
    dict(
        num=2, short="30F | Nullipara | Menorrhagia 4y | Dysmenorrhoea | Uterus 10wks symmetrical",
        diagnosis="Fibroid Uterus (Leiomyoma) - Submucosal/Intramural",
        facts=[("Age","30F"), ("Parity","Nulliparous"), ("Key Sx","Menorrhagia + dysmenorrhoea"),
               ("Uterus","10 wks, symmetrical"), ("Pallor","++")],
        inv=[
            ("Transvaginal USG", "Fibroid number, size, subtype"),
            ("CBC + Iron studies", "Degree of iron-deficiency anaemia"),
            ("Hysteroscopy", "Gold standard submucosal fibroids"),
            ("MRI pelvis", "Mapping before myomectomy/UAE"),
            ("TSH", "Rule out hypothyroidism"),
            ("Endometrial biopsy", "Abnormal bleeding pattern workup"),
            ("Coagulation profile", "Rule out bleeding disorder"),
        ],
        mgmt=[
            "MEDICAL: Iron supplementation, Tranexamic acid, NSAIDs",
            "OCP or LNG-IUS (Mirena) to reduce menstrual flow",
            "GnRH agonist (Leuprolide) x3-6 months preop - shrinks fibroid",
            "SURGICAL: Myomectomy (fertility-preserving) - laparoscopic/hysteroscopic",
            "Hysteroscopic myomectomy for submucosal fibroids",
            "UAE (Uterine Artery Embolisation) - minimally invasive option",
        ],
    ),

    # ── CASE 3 ──────────────────────────────────────────────────────────────
    dict(
        num=3, short="64F | Postmenopausal 20y | P3L3 | Pelvic mass + gross ascites | Left ovarian complex mass 10x8x9 cm",
        diagnosis="Carcinoma Ovary - Epithelial (HGSC), Stage IIIC",
        facts=[("Age","64F"), ("Triad","PM + Adnexal mass + Ascites"), ("Mass","Left ovary 10x8x9 cm complex"),
               ("Stage","IIIC - peritoneal spread"), ("Marker","CA-125 + HE4/ROMA")],
        inv=[
            ("CA-125 + HE4 / ROMA score", "Malignancy risk stratification"),
            ("CEA, CA 19-9", "Rule out GI primary"),
            ("Contrast CT abdomen/pelvis", "Extent, nodes, peritoneal deposits"),
            ("MRI pelvis", "Ovarian mass characterisation"),
            ("Diagnostic paracentesis", "Cytology for malignant cells"),
            ("BRCA1/BRCA2 gene testing", "Treatment + genetic implications"),
            ("CBC, LFT, albumin, RFT", "Nutritional/preop status"),
            ("CXR / CT chest", "Pleural effusion, Stage IV"),
        ],
        mgmt=[
            "Optimal cytoreductive surgery: TAH + BSO + omentectomy + peritoneal stripping",
            "Aim for no residual disease (<1 cm) - key prognostic factor",
            "Chemotherapy: Carboplatin AUC5 + Paclitaxel 175 mg/m², 6 cycles",
            "Bevacizumab add-on for high-risk Stage III/IV",
            "PARP inhibitors (Olaparib/Niraparib) maintenance if BRCA-mutated",
            "NACT + interval debulking if unresectable / poor performance status",
            "Symptomatic ascites: serial paracentesis / PleurX catheter",
        ],
    ),

    # ── CASE 4 ──────────────────────────────────────────────────────────────
    dict(
        num=4, short="30F | P2 | LCB 3y | Menorrhagia + pelvic pain 6m | Uterus 16wks irregular",
        diagnosis="Fibroid Uterus - Multiple (Family Complete)",
        facts=[("Age","30F"), ("Parity","Para 2 - family complete"), ("Uterus","16 wks, irregular"),
               ("Key Sx","Menorrhagia + dysmenorrhoea"), ("Plan","Hysterectomy preferred")],
        inv=[
            ("Transvaginal/Abdominal USG", "Fibroid mapping, number, size"),
            ("MRI pelvis", "Preoperative planning"),
            ("Pap smear", "Cervical cytology - standard of care"),
            ("CBC + iron studies", "Severity of anaemia"),
            ("HbA1c, blood group", "Preoperative workup"),
            ("Coagulation profile", "Rule out bleeding disorder"),
        ],
        mgmt=[
            "Definitive: Total abdominal hysterectomy (TAH) - family complete",
            "Laparoscopic hysterectomy if surgical expertise available",
            "GnRH agonist preop: shrink fibroid, correct anaemia",
            "Iron + Folic acid supplementation preoperatively",
            "Target Hb >10 g/dL before surgery",
            "If fertility desired: Myomectomy (high recurrence risk at 16 wks size)",
        ],
    ),

    # ── CASE 5 ──────────────────────────────────────────────────────────────
    dict(
        num=5, short="35F | DM Type 2 | P2 | Perineal itching | Curdy discharge | White flakes with oozing spots",
        diagnosis="Vulvovaginal Candidiasis (Complicated - Diabetic Patient)",
        facts=[("Age","35F"), ("Risk","DM Type 2 - poor glucose control"), ("D/C","Thick curdy/cottage-cheese"),
               ("Sign","White flakes; bleed on removal"), ("pH","<4.5 (normal)")],
        inv=[
            ("Wet mount + KOH prep", "Budding yeast + pseudohyphae - POC diagnosis"),
            ("HVS culture + sensitivity", "Speciation (C. glabrata = azole-resistant)"),
            ("Vaginal pH", "<4.5 in VVC; >4.5 in BV/Trichomonas"),
            ("Fasting glucose + HbA1c", "Assess diabetic control"),
            ("Urine R/E", "Glucosuria"),
            ("HIV serology", "Immunocompromise if recurrent VVC"),
        ],
        mgmt=[
            "Local: Clotrimazole 500 mg pessary single dose OR 100 mg x7d",
            "Miconazole cream for external vulval involvement",
            "Systemic: Fluconazole 150 mg oral single dose (1st line)",
            "Severe/complicated: Fluconazole 150 mg q72h x 3 doses",
            "Recurrent VVC (≥4 episodes/yr): Fluconazole 150 mg weekly x 6 months",
            "STRICT glycaemic control (HbA1c target <7%) - prevent recurrence",
            "Avoid tight synthetic clothing, local irritants",
        ],
    ),

    # ── CASE 6 ──────────────────────────────────────────────────────────────
    dict(
        num=6, short="58F | P7 | Low SES | Irregular PVB 1y | Foul discharge | Fungating Cx | Bilateral parametrium to lateral wall",
        diagnosis="Carcinoma Cervix - Stage IIIB",
        facts=[("Age","58F"), ("Parity","P7 - multipara"), ("Stage","IIIB - parametrium bilateral to lat wall"),
               ("Cx","Fungating, bleeds on touch"), ("Rectum","Free (not IVA)")],
        inv=[
            ("Cervical punch biopsy", "Histopath confirmation (SCC 80%)"),
            ("MRI pelvis", "Parametrial invasion, nodal involvement"),
            ("CT chest/abdomen/pelvis", "Nodal mets, distant spread"),
            ("Cystoscopy", "Rule out bladder = Stage IVA"),
            ("Proctosigmoidoscopy", "Rule out rectal involvement"),
            ("IVU / CT urography", "Hydronephrosis = Stage IIIB criterion"),
            ("CBC, LFT, RFT", "Anaemia +++, organ function"),
            ("Blood group + cross-match", "May need transfusion preRT"),
        ],
        mgmt=[
            "Stage IIIB: NOT operable - Concurrent Chemoradiation (CCRT)",
            "EBRT to pelvis: 45-50 Gy in 25 fractions over 5 weeks",
            "Intracavitary brachytherapy (ICBT): central disease boost",
            "Cisplatin 40 mg/m² IV weekly concurrent (radiosensitiser)",
            "Correct anaemia to Hb >10 g/dL BEFORE radiotherapy",
            "Ureteric obstruction: stenting or nephrostomy",
            "Nutritional support + palliative care team involvement",
        ],
    ),

    # ── CASE 7 ──────────────────────────────────────────────────────────────
    dict(
        num=7, short="50F | Menopausal 1y | P4 | Chronic cough | Cystocele + Rectocele | Cervix outside introitus | Decubitus ulcers",
        diagnosis="3rd Degree Uterovaginal Prolapse + Cystocele + Rectocele",
        facts=[("Age","50F"), ("Parity","P4 - rapid succession"), ("Grade","3rd degree / Complete prolapse"),
               ("Complication","Decubitus ulcers on Cx lips"), ("RF","Cough + Menopause + Prolonged labour")],
        inv=[
            ("POP-Q assessment", "Objective staging of prolapse"),
            ("Biopsy of decubitus ulcer", "MUST rule out carcinomatous change"),
            ("Pap smear + colposcopy", "Cervical cytology"),
            ("Urodynamics", "If stress incontinence; pre-surgical planning"),
            ("Urine R/E + C&S", "Associated UTI"),
            ("USG pelvis", "Uterine/adnexal pathology"),
            ("CXR + spirometry", "Chronic cough - preop chest assessment"),
            ("CBC, blood sugar, ECG", "Preoperative assessment"),
        ],
        mgmt=[
            "PRE-OP: Local oestrogen + saline soaks + ring pessary x 4-6 wks to heal ulcers",
            "DEFINITIVE SURGICAL: Vaginal hysterectomy (procedure of choice)",
            "Anterior colporrhaphy: cystocele repair",
            "Posterior colpoperineorrhaphy: rectocele repair",
            "Pelvic floor repair at same sitting",
            "CONSERVATIVE (unfit): Ring pessary + pelvic floor exercises",
            "Treat chronic cough (bronchodilators) to prevent recurrence",
        ],
    ),

    # ── CASE 8 ──────────────────────────────────────────────────────────────
    dict(
        num=8, short="28F | P2 | LCB 3y | Post-coital bleeding 2m | Fungating growth post lip Cx 3cm | Parametrium free",
        diagnosis="Carcinoma Cervix - Stage IB1 (Lesion ≤4 cm, confined to cervix)",
        facts=[("Age","28F"), ("Stage","IB1 - visible lesion ≤4 cm"), ("Growth","3 cm post lip"),
               ("Parametrium","Free"), ("Preference","Surgery - young patient, preserve ovaries")],
        inv=[
            ("Cervical punch biopsy", "Histopath confirmation"),
            ("Colposcopy + directed biopsy", "Map lesion extent"),
            ("MRI pelvis", "Tumour size, stroma, nodes, parametrium"),
            ("PET-CT", "Nodal staging - surgical candidate"),
            ("Cystoscopy + Proctoscopy", "Rule out Stage IVA"),
            ("HPV DNA genotyping", "Documentation (HPV 16/18)"),
            ("CBC, LFT, RFT, CXR", "Preoperative workup"),
        ],
        mgmt=[
            "Stage IB1: SURGICAL preferred in young patient",
            "Wertheim's Radical Hysterectomy: uterus + upper vaginal cuff + parametria + PLND",
            "Advantage over CCRT: ovaries preserved, no RT vaginal stenosis",
            "Adjuvant CCRT post-surgery if: +ve nodes, +ve margins, parametrial involvement",
            "Alternative: CCRT (equivalent oncological outcome if surgery contraindicated)",
            "Fertility-sparing: Radical trachelectomy if lesion ≤2 cm (this lesion 3 cm - MDT decision)",
        ],
    ),

    # ── CASE 9 ──────────────────────────────────────────────────────────────
    dict(
        num=9, short="26F | Recently married | Burning micturition + Foul discharge 10d | Frothy greenish D/C | Punctate haemorrhagic spots vaginal walls",
        diagnosis="Trichomoniasis (Trichomonas vaginalis)",
        facts=[("Age","26F"), ("Discharge","Thin, frothy, greenish-yellow, foul"), ("Sign","Strawberry cervix/vagina"),
               ("pH","Elevated >4.5 (alkaline)"), ("STI","Screen for coinfections")],
        inv=[
            ("Wet mount microscopy", "Motile pear-shaped flagellated trichomonads - POC"),
            ("Vaginal pH", ">4.5 alkaline in Trichomonas"),
            ("NAAT (gold standard)", "Highest sensitivity ~98%"),
            ("HVS culture (Diamond's medium)", "If wet mount negative"),
            ("Gram stain", "Rule out concurrent BV"),
            ("HIV, VDRL, Chlamydia, GC NAAT", "Full STI screen - coinfections common"),
            ("Partner testing", "Essential for eradication"),
        ],
        mgmt=[
            "Metronidazole 2 g orally, SINGLE DOSE (1st line)",
            "Tinidazole 2 g single dose (alternative, better GI tolerance)",
            "If failure: Metronidazole 400-500 mg BD x 7 days",
            "TREAT SEXUAL PARTNER SIMULTANEOUSLY (prevent reinfection)",
            "Avoid alcohol during + 48h after metronidazole (disulfiram reaction)",
            "Retest at 3 months; safe sex counselling",
            "Notify STI contacts",
        ],
    ),

    # ── CASE 10 ─────────────────────────────────────────────────────────────
    dict(
        num=10, short="30F | Vaginal delivery 7m ago (home, forceps, 2-day labour, stillbirth 3.5kg) | Continuous dribbling urine 7m | Hole 0.5x1 cm vesico-cervical junction",
        diagnosis="Vesico-Vaginal Fistula (VVF) - Obstetric / Iatrogenic",
        facts=[("Age","30F"), ("Cause","Obstructed labour + forceps"), ("Fistula","0.5x1 cm vesico-cervical jn."),
               ("Symptom","Continuous urine dribbling"), ("Wait","Repair after 3 months")],
        inv=[
            ("Dye test (methylene blue)", "200 mL in bladder → blue seen vaginally = VVF"),
            ("Three-swab test", "Differentiate VVF vs ureterovaginal fistula"),
            ("Cystoscopy + vaginoscopy", "Site, size, distance from ureteric orifices"),
            ("IVU / CT urography", "Rule out ureterovaginal fistula; upper tracts"),
            ("MRI pelvis", "Complex fistulas, tissue necrosis extent"),
            ("Urine R/E + C&S", "Treat UTI before surgery"),
            ("RFT + CBC", "Renal function + preoperative status"),
            ("Biopsy fistula edge", "Rule out malignancy (if radiation-related)"),
        ],
        mgmt=[
            "CONSERVATIVE (small fresh <72h or <3mm): Foley catheter x 4-6 wks",
            "Antibiotics + anticholinergics during conservative management",
            "SURGICAL: WAIT 3 MONTHS for oedema/inflammation to resolve",
            "Transvaginal layered repair (1st line for obstetric VVF)",
            "Latzko operation for post-hysterectomy VVF",
            "Transabdominal (O'Connor) for complex/recurrent VVF",
            "Principles: wide mobilisation, tension-free closure, layered repair",
            "Post-repair: Foley catheter x 14-21 days + anticholinergics + pelvic rest",
        ],
    ),
]

# ── Summary table data ───────────────────────────────────────────────────────
SUMMARY_ROWS = [
    ["Case", "Diagnosis", "Key Investigation", "Management"],
    ["1", "Endometrial Carcinoma", "Endometrial Biopsy + MRI Pelvis", "TAH+BSO+LND ± RT/Chemo"],
    ["2", "Fibroid Uterus (Nullipara)", "TVUS + Hysteroscopy", "Myomectomy (fertility-preserving)"],
    ["3", "Carcinoma Ovary Stage IIIC", "CA-125 + CT Abdomen/Pelvis", "Debulking + Carbo/Taxol"],
    ["4", "Fibroid Uterus (P2, family complete)", "TVUS + MRI", "TAH (abdominal hysterectomy)"],
    ["5", "Vulvovaginal Candidiasis (DM)", "KOH Wet Mount + HVS Culture", "Fluconazole 150 mg + glycaemic control"],
    ["6", "Ca Cervix Stage IIIB", "Cervical Biopsy + MRI + Cystoscopy", "CCRT (Cisplatin + EBRT + ICBT)"],
    ["7", "3° Uterovaginal Prolapse", "POP-Q + Ulcer Biopsy + Urodynamics", "Vaginal Hyst. + Colporrhaphy"],
    ["8", "Ca Cervix Stage IB1", "Cervical Biopsy + MRI + PET-CT", "Wertheim's Radical Hysterectomy"],
    ["9", "Trichomoniasis", "Wet Mount + NAAT + STI Screen", "Metronidazole 2 g stat + treat partner"],
    ["10", "Vesico-Vaginal Fistula (Obstetric)", "Dye Test + Cystoscopy + IVU", "Transvaginal fistula repair (after 3 mths)"],
]

# ── Build PDF ────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT, pagesize=A4,
    leftMargin=1.3*cm, rightMargin=1.3*cm,
    topMargin=1.8*cm, bottomMargin=1.8*cm,
)

story = []

# ── Cover band ───────────────────────────────────────────────────────────────
cover_data = [[
    Paragraph("GYNAECOLOGY SHORT CASES", TITLE_STYLE),
]]
cover_sub = [[
    Paragraph("Clinical Summary for Quick Reference During Rounds", SUBTITLE_STYLE),
]]
for d in [cover_data, cover_sub]:
    t = Table(d, colWidths=[17.7*cm])
    bg = NAVY if d is cover_data else TEAL
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0),(-1,-1), bg),
        ("TOPPADDING", (0,0),(-1,-1), 10 if d is cover_data else 6),
        ("BOTTOMPADDING",(0,0),(-1,-1), 10 if d is cover_data else 6),
        ("LEFTPADDING", (0,0),(-1,-1), 10),
        ("RIGHTPADDING",(0,0),(-1,-1), 10),
    ]))
    story.append(t)

story.append(Spacer(1, 0.25*cm))

# meta line
meta = Table([[
    Paragraph("10 Clinical Cases  |  Diagnosis + Workup + Management", SMALL),
    Paragraph(f"Date: {date.today().strftime('%d %B %Y')}", S("MR", fontSize=7.5,
              textColor=colors.HexColor("#555555"), alignment=TA_LEFT, fontName="Helvetica")),
]], colWidths=[13*cm, 4.7*cm])
meta.setStyle(TableStyle([
    ("TOPPADDING",(0,0),(-1,-1),2), ("BOTTOMPADDING",(0,0),(-1,-1),2),
    ("LEFTPADDING",(0,0),(-1,-1),2), ("RIGHTPADDING",(0,0),(-1,-1),2),
]))
story.append(meta)
story.append(HRFlowable(width="100%", thickness=0.5, color=TEAL, spaceAfter=6))

# ── Individual cases ─────────────────────────────────────────────────────────
for c in CASES:
    block = []
    block.append(case_banner(c["num"], c["short"], c["diagnosis"]))
    block.append(Spacer(1, 0.2*cm))
    block.append(facts_ribbon(c["facts"]))
    block.append(Spacer(1, 0.2*cm))
    block.append(workup_mgmt_table(c["inv"], c["mgmt"]))
    block.append(Spacer(1, 0.4*cm))
    story.append(KeepTogether(block[:3]))  # banner + facts together
    story.extend(block[3:])               # table can flow

# ── Summary table ────────────────────────────────────────────────────────────
story.append(PageBreak())
story.append(Paragraph("QUICK REFERENCE SUMMARY TABLE", S("ST", fontSize=13,
             textColor=NAVY, fontName="Helvetica-Bold", spaceAfter=8)))
story.append(HRFlowable(width="100%", thickness=1, color=TEAL, spaceAfter=8))

sm_data = []
for i, row in enumerate(SUMMARY_ROWS):
    if i == 0:
        sm_data.append([Paragraph(c, TABLE_HDR) for c in row])
    else:
        styled = [
            Paragraph(row[0], S("SN", fontSize=8.5, fontName="Helvetica-Bold",
                                 textColor=WHITE, alignment=TA_CENTER)),
            Paragraph(row[1], S("SD", fontSize=8, fontName="Helvetica-Bold", textColor=NAVY)),
            Paragraph(row[2], S("SI", fontSize=8, fontName="Helvetica", textColor=BLACK)),
            Paragraph(row[3], S("SM", fontSize=8, fontName="Helvetica", textColor=BLACK)),
        ]
        sm_data.append(styled)

sm_table = Table(sm_data, colWidths=[1.1*cm, 5.2*cm, 5.7*cm, 5.7*cm])
row_bgs = []
for i in range(1, len(SUMMARY_ROWS)):
    bg = LIGHT_GRY if i % 2 == 0 else WHITE
    row_bgs.append(("BACKGROUND", (0,i), (-1,i), bg))
    if i % 2 == 1:
        row_bgs.append(("BACKGROUND", (0,i), (0,i), NAVY))  # case number cell NAVY
    else:
        row_bgs.append(("BACKGROUND", (0,i), (0,i), TEAL))  # case number cell TEAL

sm_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), NAVY),
    *row_bgs,
    ("GRID", (0,0), (-1,-1), 0.4, MID_GRY),
    ("TOPPADDING", (0,0), (-1,-1), 4),
    ("BOTTOMPADDING",(0,0),(-1,-1), 4),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING",(0,0),(-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
    ("ALIGN", (0,0), (0,-1), "CENTER"),
    ("FONTNAME", (0,1),(0,-1), "Helvetica-Bold"),
    ("TEXTCOLOR", (0,0),(-1,0), WHITE),
    ("TEXTCOLOR", (0,1),(0,-1), WHITE),
]))
story.append(sm_table)

story.append(Spacer(1, 0.5*cm))
story.append(HRFlowable(width="100%", thickness=0.3, color=MID_GRY, spaceAfter=4))
story.append(Paragraph(
    "Reference: Berek & Novak's Gynecology | Robbins Pathology | Campbell-Walsh Urology | Harrison's Internal Medicine",
    S("Ref", fontSize=7, textColor=colors.HexColor("#888888"), fontName="Helvetica-Oblique",
      alignment=TA_CENTER)
))

# ── Build ─────────────────────────────────────────────────────────────────────
doc.build(story, onFirstPage=header_footer, onLaterPages=header_footer)
print(f"PDF created: {OUTPUT}")
Running Command

python3 /tmp/workspace/gynae-rounds-pdf/build_pdf.py

Running Command

ls -lh /tmp/workspace/gynae-rounds-pdf/

Your PDF is ready. Here's what's included:

Gynae Short Cases Quick Reference

PDF Document · PDF


What's in the PDF

The document is structured for fast scanning during ward rounds:
For each of the 10 cases:
  • Navy banner - Case number + clinical vignette summary + diagnosis at a glance
  • Teal facts ribbon - Age, parity, key symptom, FIGO stage / clinical clue
  • Two-column table:
    • Left: Investigations with their purpose (bold investigation names)
    • Right: Bullet-pointed management steps in priority order
Final page - Quick Reference Summary Table with all 10 cases in one view (diagnosis + key investigation + management)
Cases covered:
  1. Endometrial Carcinoma (PMB + DM + HTN)
  2. Fibroid Uterus - Nullipara (myomectomy)
  3. Carcinoma Ovary Stage IIIC (debulking + chemo)
  4. Fibroid Uterus - P2 family complete (hysterectomy)
  5. Vulvovaginal Candidiasis - DM (Fluconazole + glycaemic control)
  6. Ca Cervix Stage IIIB (CCRT - Cisplatin + EBRT + ICBT)
  7. 3rd Degree Uterovaginal Prolapse (vaginal hyst. + colporrhaphy)
  8. Ca Cervix Stage IB1 (Wertheim's hysterectomy)
  9. Trichomoniasis (Metronidazole 2 g stat + treat partner)
  10. Vesico-Vaginal Fistula - Obstetric (transvaginal repair after 3 months)
This is a shared conversation. Sign in to Orris to start your own chat.