make a diagnosis lower abdominal pain for 15 20 mins then goes away
cd /home/daytona/workspace/attachments/a52d0b6a-2236-4cb4-910c-e920dcd111c2/ && python3 -c " import pdfplumber, os files = [ '6122498_11July2026_120839092.pdf', 'WhatsApp Scan 2026-07-10 at 23.23.57.pdf', 'WhatsApp Scan 2026-07-10 at 23.22.38.pdf', 'imtiaz.pdf' ] for fname in files: if os.path.exists(fname): print(f'=== {fname} ===') try: with pdfplumber.open(fname) as pdf: for i, page in enumerate(pdf.pages): text = page.extract_text() if text: print(f'-- Page {i+1} --') print(text[:3000]) except Exception as e: print(f'Error: {e}') print() "
python3 -c " from pypdf import PdfReader import os files = [ '/home/daytona/workspace/attachments/a52d0b6a-2236-4cb4-910c-e920dcd111c2/WhatsApp Scan 2026-07-10 at 23.23.57.pdf', '/home/daytona/workspace/attachments/a52d0b6a-2236-4cb4-910c-e920dcd111c2/WhatsApp Scan 2026-07-10 at 23.22.38.pdf' ] for f in files: print(f'=== {os.path.basename(f)} ===') r = PdfReader(f) print(f'Pages: {len(r.pages)}') for i, pg in enumerate(r.pages): t = pg.extract_text() print(f'Page {i+1}: {repr(t[:200]) if t else \"EMPTY\"}') "
python3 -c " import pdfplumber, sys from PIL import Image import io files = [ '/home/daytona/workspace/attachments/a52d0b6a-2236-4cb4-910c-e920dcd111c2/WhatsApp Scan 2026-07-10 at 23.23.57.pdf', '/home/daytona/workspace/attachments/a52d0b6a-2236-4cb4-910c-e920dcd111c2/WhatsApp Scan 2026-07-10 at 23.22.38.pdf' ] for f in files: print(f'=== {f.split(\"/\")[-1]} ===') with pdfplumber.open(f) as pdf: for i, pg in enumerate(pdf.pages): # Try to get images images = pg.images print(f'Page {i+1}: {len(images)} images found') for img in images[:2]: print(f' Image: {img}') "
python3 -c " import pdfplumber from PIL import Image import io, base64 # Extract images from WhatsApp PDFs and save as JPG for OCR files_out = [] pdfs = [ ('/home/daytona/workspace/attachments/a52d0b6a-2236-4cb4-910c-e920dcd111c2/WhatsApp Scan 2026-07-10 at 23.23.57.pdf', 'wa1'), ('/home/daytona/workspace/attachments/a52d0b6a-2236-4cb4-910c-e920dcd111c2/WhatsApp Scan 2026-07-10 at 23.22.38.pdf', 'wa2') ] for pdf_path, prefix in pdfs: with pdfplumber.open(pdf_path) as pdf: for i, pg in enumerate(pdf.pages): img = pg.to_image(resolution=150) out_path = f'/home/daytona/workspace/{prefix}_page{i+1}.jpg' img.save(out_path) print(f'Saved: {out_path}') "
python3 -c " import pytesseract from PIL import Image imgs = [ '/home/daytona/workspace/wa1_page1.jpg', '/home/daytona/workspace/wa1_page2.jpg', '/home/daytona/workspace/wa2_page1.jpg' ] for p in imgs: print(f'=== {p} ===') img = Image.open(p) text = pytesseract.image_to_string(img) print(text[:3000]) print() "
| Investigation | Result | Reference Range | Status |
|---|---|---|---|
| Testosterone (Total) | 510 ng/dL | 228-711 (age 16-21); <50yr: 164-753 | NORMAL |
| TSH | 5.119 µIU/mL | 0.55-4.78 | ELEVATED (subclinical hypothyroidism) |
| T3 | 1.47 ng/mL | 0.60-1.81 | Normal |
| T4 | 10.70 µg/dL | 3.2-12.6 | Normal |
| LH | 4.26 mIU/mL | 1.5-9.3 | Normal |
| FSH | 3.41 mIU/mL | 1.4-18.1 | Normal |
| Prolactin | 12.45 ng/mL | 2.1-17.7 | Normal |
| Semen Analysis | Azoospermia; Volume 0.5 mL (low); pH 8.0 | Volume >1.5 mL | ABNORMAL |
| Uroflowmetry | Max flow 21 mL/sec; Voided volume 177 mL | Normal Qmax >15 mL/sec | Normal flow pattern |
| Ultrasound Abdomen/Pelvis | Liver Grade 2 (bright echopattern); Prostate measured | Findings noted | Fatty liver Grade 2; Prostate details partially legible |
| Diagnosis | For | Against |
|---|---|---|
| Ejaculatory Duct Obstruction | Low volume azoospermia, lower abdominal pain, normal hormones | Need TRUS to confirm |
| Congenital Bilateral Absence of Vas Deferens (CBAVD) | Low volume azoospermia | Not mentioned on physical exam; usually no pain |
| Retrograde ejaculation | Azoospermia | Volume is low (not zero), flow is normal |
| Seminal vesicle cyst/obstruction | Pain + low volume | Needs imaging confirmation |
| Primary testicular failure | Azoospermia | FSH/LH are normal - rules this out |
| Secondary hypogonadism | Azoospermia | LH/FSH normal, testosterone normal |
| IBS/functional abdominal pain | Crampy lower abdominal pain | Doesn't explain azoospermia |
Important Note: This analysis is based on the lab reports and scans provided. The lower abdominal pain episodically lasting 15-20 minutes and then resolving is a recognized symptom of intermittent ejaculatory duct/seminal vesicle obstruction or seminal vesicle distension. Physical examination findings (vas deferens palpability, testicular size, prostate exam) are essential for confirming this diagnosis and should be correlated by the treating physician. This is not a substitute for clinical evaluation.
Generate a clinical summary document with this diagnosis and treatment plan
mkdir -p /home/daytona/workspace/imtiaz-clinical && ls /home/daytona/workspace/imtiaz-clinical/
Can I, can I explain you the symptoms again?
There is kind of localized pain in the lower abdomen mostly. It is... The pain is high. And it goes away after 15, 20 minutes, in a, in half an hour, it goes away. Uh... Erection is fine, but there is no output of sperm. It is very liquidish sometime, like watery. And the problem is persisting from past seven, eight years? And... I have shared you the... Lab reports and other reports of the patient. What can be the possible diagnosis?
| Symptom | Detail |
|---|---|
| Pain location | Lower abdomen, localized |
| Pain character | High intensity, crampy |
| Duration | 15-30 minutes, then resolves completely |
| Duration of problem | 7-8 years |
| Erection | Normal |
| Ejaculation | Occurs (no anejaculation), but very watery/thin, no visible sperm |
| Semen analysis | Azoospermia, volume only 0.5 mL (severely low) |
| Cause | Likelihood |
|---|---|
| Mullerian duct cyst / prostatic midline cyst | High - congenital, common cause, seen on TRUS |
| Post-infective scarring (prior chlamydia, gonorrhea, UTI) | Moderate - 7-8 year history suggests possible prior infection |
| Ejaculatory duct calculus | Moderate - calculi can cause intermittent partial obstruction |
| Seminal vesicle cyst | Moderate - directly causes pain + low volume azoospermia |
| Step | Treatment |
|---|---|
| Definitive | Transurethral Resection of the Ejaculatory Ducts (TURED) - minimally invasive endoscopic surgery |
| If TURED fails/not suitable | Surgical aspiration of sperm + IVF/ICSI |
| Thyroid | Levothyroxine (25-50 mcg/day) for subclinical hypothyroidism |
| Pain management | NSAIDs (e.g., ibuprofen) for acute pain episodes until surgery |
Bottom line: 7-8 years of watery azoospermic ejaculate + post-orgasmic lower abdominal pain + semen volume 0.5 mL with normal hormones = Ejaculatory Duct Obstruction until proven otherwise. TRUS is the immediate next step.
So, the urologist suggested this medicine, and he didn't say anything about the surgery or anything. He said that the patient has to take this medicine for almost three months and everything will be fine. Do you think that the, the diagnosis from the urologist is fine?
L-carnitine coenzyme Q10 zinc azoospermia male infertility
antioxidant supplement male infertility sperm
PMID: 35506389
PMID: 35128424
| Feature | This Patient | Idiopathic Infertility (Spercus target) |
|---|---|---|
| Sperm count | Zero (azoospermia) | Low/poor quality sperm present |
| Semen volume | 0.5 mL (severely low) | Normal volume |
| FSH/LH | Normal | Often abnormal |
| Pain | Yes - post-orgasmic lower abdominal | Usually no pain |
| Erection | Normal | Normal |
Create a clinical summary with evidence-based treatment plan
mkdir -p /home/daytona/workspace/imtiaz-clinical && node -e "require('docx'); console.log('docx OK')"
~/imtiaz-clinical/generate.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
VerticalAlign, PageNumber, Header, Footer, UnderlineType,
TableOfContents, convertInchesToTwip, PageBreak
} = require('docx');
const fs = require('fs');
// ── colour palette ──────────────────────────────────────────────
const BLUE = '1F4E79';
const BLUE_MID = '2E75B6';
const BLUE_LITE = 'D6E4F0';
const BLUE_HDR = 'BDD7EE';
const RED_LITE = 'FFE0E0';
const GREEN_LITE= 'E2EFDA';
const YELLOW = 'FFF2CC';
const WHITE = 'FFFFFF';
const GREY = 'F2F2F2';
const DARK = '1A1A2E';
// ── helpers ─────────────────────────────────────────────────────
function bold(text, size=22, color=DARK) {
return new TextRun({ text, bold: true, size, color });
}
function normal(text, size=20, color=DARK) {
return new TextRun({ text, size, color });
}
function coloured(text, color, size=20, b=false) {
return new TextRun({ text, color, size, bold: b });
}
function heading1(text) {
return new Paragraph({
children: [new TextRun({ text, bold: true, size: 28, color: WHITE })],
heading: HeadingLevel.HEADING_1,
shading: { type: ShadingType.SOLID, color: BLUE },
spacing: { before: 240, after: 120 },
indent: { left: 120, right: 120 },
});
}
function heading2(text) {
return new Paragraph({
children: [new TextRun({ text, bold: true, size: 24, color: WHITE })],
shading: { type: ShadingType.SOLID, color: BLUE_MID },
spacing: { before: 200, after: 100 },
indent: { left: 80 },
});
}
function sectionLabel(text) {
return new Paragraph({
children: [new TextRun({ text: text.toUpperCase(), bold: true, size: 20, color: BLUE_MID })],
spacing: { before: 160, after: 60 },
border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: BLUE_MID } },
});
}
function para(text, size=20, spacing=80) {
return new Paragraph({
children: [new TextRun({ text, size, color: DARK })],
spacing: { before: spacing, after: spacing },
});
}
function bullet(text, level=0) {
return new Paragraph({
children: [new TextRun({ text, size: 20, color: DARK })],
bullet: { level },
spacing: { before: 60, after: 60 },
indent: { left: convertInchesToTwip(0.25 + level * 0.25) },
});
}
function infoBox(lines, bgColor=BLUE_LITE) {
return new Paragraph({
children: lines.map((l, i) => new TextRun({
text: l + (i < lines.length - 1 ? '\n' : ''),
size: 19,
color: DARK,
})),
shading: { type: ShadingType.SOLID, color: bgColor },
spacing: { before: 100, after: 100 },
indent: { left: 180, right: 180 },
border: {
left: { style: BorderStyle.THICK, size: 12, color: BLUE_MID },
},
});
}
function alertBox(lines, bgColor=YELLOW, borderColor='C9A227') {
return new Paragraph({
children: lines.map((l, i) => new TextRun({
text: l + (i < lines.length - 1 ? '\n' : ''),
size: 19,
color: DARK,
})),
shading: { type: ShadingType.SOLID, color: bgColor },
spacing: { before: 100, after: 100 },
indent: { left: 180, right: 180 },
border: {
left: { style: BorderStyle.THICK, size: 12, color: borderColor },
},
});
}
function makeTable(headers, rows, headerBg=BLUE_MID) {
const headerCells = headers.map(h =>
new TableCell({
children: [new Paragraph({
children: [new TextRun({ text: h, bold: true, size: 19, color: WHITE })],
alignment: AlignmentType.CENTER,
})],
shading: { type: ShadingType.SOLID, color: headerBg },
verticalAlign: VerticalAlign.CENTER,
margins: { top: 60, bottom: 60, left: 80, right: 80 },
})
);
const dataRows = rows.map((row, ri) =>
new TableRow({
children: row.map((cell, ci) => {
const isStatus = typeof cell === 'object';
const cellText = isStatus ? cell.text : cell;
const cellBg = isStatus ? cell.bg : (ri % 2 === 0 ? WHITE : GREY);
const cellColor= isStatus ? cell.color : DARK;
const cellBold = isStatus ? (cell.bold || false) : false;
return new TableCell({
children: [new Paragraph({
children: [new TextRun({ text: cellText, size: 19, color: cellColor, bold: cellBold })],
alignment: ci === 0 ? AlignmentType.LEFT : AlignmentType.CENTER,
})],
shading: { type: ShadingType.SOLID, color: cellBg },
verticalAlign: VerticalAlign.CENTER,
margins: { top: 60, bottom: 60, left: 80, right: 80 },
});
}),
})
);
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [new TableRow({ children: headerCells }), ...dataRows],
margins: { top: 60, bottom: 60, left: 60, right: 60 },
});
}
function spacer(pts=120) {
return new Paragraph({ children: [], spacing: { before: pts, after: 0 } });
}
// ── DOCUMENT BUILD ───────────────────────────────────────────────
const doc = new Document({
styles: {
default: {
document: {
run: { font: 'Calibri', size: 20, color: DARK },
},
},
},
sections: [{
properties: {
page: {
margin: { top: 720, bottom: 720, left: 900, right: 900 },
},
},
headers: {
default: new Header({
children: [
new Paragraph({
children: [
new TextRun({ text: 'CLINICAL SUMMARY REPORT', bold: true, size: 20, color: WHITE }),
new TextRun({ text: ' Prepared by Orris AI | Confidential Medical Document', size: 18, color: 'CCDDEE' }),
],
shading: { type: ShadingType.SOLID, color: BLUE },
alignment: AlignmentType.LEFT,
indent: { left: 100, right: 100 },
}),
],
}),
},
footers: {
default: new Footer({
children: [
new Paragraph({
children: [
new TextRun({ text: 'This document is generated for clinical reference only and must be correlated with physician examination. | Page ', size: 17, color: '888888' }),
new TextRun({ children: [PageNumber.CURRENT], size: 17, color: '888888' }),
],
alignment: AlignmentType.CENTER,
border: { top: { style: BorderStyle.SINGLE, size: 4, color: 'CCCCCC' } },
}),
],
}),
},
children: [
// ═══════════════════════════════════════════════
// COVER BLOCK
// ═══════════════════════════════════════════════
new Paragraph({
children: [new TextRun({ text: 'CLINICAL SUMMARY & EVIDENCE-BASED TREATMENT PLAN', bold: true, size: 36, color: WHITE })],
shading: { type: ShadingType.SOLID, color: BLUE },
alignment: AlignmentType.CENTER,
spacing: { before: 240, after: 60 },
indent: { left: 100, right: 100 },
}),
new Paragraph({
children: [new TextRun({ text: 'Ejaculatory Duct Obstruction with Subclinical Hypothyroidism', bold: true, size: 24, color: BLUE_LITE })],
shading: { type: ShadingType.SOLID, color: BLUE },
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 240 },
indent: { left: 100, right: 100 },
}),
// patient card
makeTable(
['PATIENT DETAILS', ''],
[
['Patient Name', 'Mr. Imtiaz'],
['Age / Sex', '28-29 Years / Male'],
['Report Date', 'July 11-12, 2026'],
['Referring Concern', 'Lower abdominal pain (episodic) + Infertility (7-8 years)'],
['Prepared By', 'Orris AI Clinical Assistant | July 13, 2026'],
],
BLUE
),
spacer(200),
// ═══════════════════════════════════════════════
// SECTION 1 — PRESENTING COMPLAINTS
// ═══════════════════════════════════════════════
heading1('1. PRESENTING COMPLAINTS'),
spacer(80),
makeTable(
['Symptom', 'Description', 'Duration'],
[
['Lower abdominal pain', 'Localized, high-intensity, crampy — resolves spontaneously', '15-30 minutes per episode'],
['Pattern', 'Episodic; pain is post-orgasmic/post-ejaculatory in nature', '7-8 years ongoing'],
['Ejaculate appearance', 'Very watery / thin — no visible sperm output', '7-8 years ongoing'],
['Semen volume', 'Severely reduced (0.5 mL; normal >1.5 mL)', 'Consistent finding'],
['Erectile function', 'Normal', 'No complaints'],
['Ejaculation', 'Present (not anejaculation)', 'Orgasm sensation intact'],
]
),
spacer(160),
// ═══════════════════════════════════════════════
// SECTION 2 — INVESTIGATIONS SUMMARY
// ═══════════════════════════════════════════════
heading1('2. INVESTIGATIONS SUMMARY'),
spacer(80),
sectionLabel('2a. Hormonal Profile (Serum — July 11, 2026)'),
spacer(60),
makeTable(
['Test', 'Result', 'Reference Range', 'Interpretation'],
[
['Testosterone (Total)', '510 ng/dL', '164-753 ng/dL (<50 yr)', { text: 'NORMAL', bg: GREEN_LITE, color: '375623', bold: true }],
['TSH (Ultrasensitive)', '5.119 µIU/mL', '0.55-4.78 µIU/mL', { text: 'ELEVATED ⚠', bg: YELLOW, color: '7F5600', bold: true }],
['T3 (Total)', '1.47 ng/mL', '0.60-1.81 ng/mL', { text: 'NORMAL', bg: GREEN_LITE, color: '375623', bold: true }],
['T4 (Total)', '10.70 µg/dL', '3.2-12.6 µg/dL', { text: 'NORMAL', bg: GREEN_LITE, color: '375623', bold: true }],
['LH', '4.26 mIU/mL', '1.5-9.3 mIU/mL', { text: 'NORMAL', bg: GREEN_LITE, color: '375623', bold: true }],
['FSH', '3.41 mIU/mL', '1.4-18.1 mIU/mL', { text: 'NORMAL', bg: GREEN_LITE, color: '375623', bold: true }],
['Prolactin', '12.45 ng/mL', '2.1-17.7 ng/mL', { text: 'NORMAL', bg: GREEN_LITE, color: '375623', bold: true }],
]
),
spacer(160),
sectionLabel('2b. Semen Analysis (July 10, 2026)'),
spacer(60),
makeTable(
['Parameter', 'Result', 'Reference (WHO)', 'Status'],
[
['Volume', '0.5 mL', '>1.5 mL', { text: 'CRITICALLY LOW ✗', bg: RED_LITE, color: '9C0006', bold: true }],
['Sperm Count', 'AZOOSPERMIA', '>16 million/mL', { text: 'ABSENT ✗', bg: RED_LITE, color: '9C0006', bold: true }],
['Liquefaction', '30 minutes', 'Complete in 30 min', { text: 'BORDERLINE', bg: YELLOW, color: '7F5600', bold: true }],
['pH', '8.0', '>7.2', { text: 'NORMAL', bg: GREEN_LITE, color: '375623', bold: true }],
['Colour', 'Whitish', 'Whitish/grey', { text: 'NORMAL', bg: GREEN_LITE, color: '375623', bold: true }],
]
),
spacer(160),
sectionLabel('2c. Uroflowmetry'),
spacer(60),
makeTable(
['Parameter', 'Result', 'Normal', 'Status'],
[
['Maximum Flow Rate (Qmax)', '21 mL/sec', '>15 mL/sec', { text: 'NORMAL', bg: GREEN_LITE, color: '375623', bold: true }],
['Voided Volume', '177 mL', 'Adequate', { text: 'NORMAL', bg: GREEN_LITE, color: '375623', bold: true }],
['Average Flow Rate', '3.0 mL/sec', 'Varies', { text: 'NOTE: Low average vs. Qmax', bg: YELLOW, color: '7F5600', bold: true }],
]
),
spacer(160),
sectionLabel('2d. Ultrasound Abdomen & Pelvis'),
spacer(60),
makeTable(
['Organ', 'Finding'],
[
['Liver', 'Enlarged with bright echopattern — Grade 2 Fatty Liver (NAFLD)'],
['Gall Bladder / CBD', 'Not significantly abnormal'],
['Pancreas / Spleen', 'Normal'],
['Kidneys', 'Reported (details partially legible on scan)'],
['Urinary Bladder', 'Normal outline, wall thickness normal'],
['Prostate', 'Measured (dimensions partially legible) — further correlation needed'],
]
),
spacer(200),
// ═══════════════════════════════════════════════
// SECTION 3 — DIAGNOSIS
// ═══════════════════════════════════════════════
heading1('3. DIAGNOSIS'),
spacer(80),
heading2('Primary Diagnosis'),
spacer(60),
new Paragraph({
children: [
new TextRun({ text: 'Ejaculatory Duct Obstruction (EDO)', bold: true, size: 26, color: BLUE }),
new TextRun({ text: ' — Obstructive Azoospermia', size: 22, color: BLUE_MID }),
],
spacing: { before: 100, after: 100 },
indent: { left: 100 },
}),
infoBox([
'Clinical basis: Azoospermia + severely low semen volume (0.5 mL) + normal LH/FSH/Testosterone + episodic',
'post-orgasmic lower abdominal pain lasting 15-30 minutes = CLASSIC triad of Ejaculatory Duct Obstruction.',
'',
'Seminal vesicles contribute ~80% of semen volume. In EDO, this fructose-rich fluid cannot exit, producing a',
'thin, watery, low-volume azoospermic ejaculate. Pressure build-up causes post-ejaculatory pelvic/abdominal pain.',
'',
'Normal gonadotropins (LH/FSH) and testosterone confirm intact testicular function — the obstruction is',
'mechanical/structural, NOT hormonal or testicular in origin.',
]),
spacer(120),
sectionLabel('Pathophysiology'),
spacer(80),
makeTable(
['Finding', 'Explanation', 'Significance'],
[
['Low semen volume (0.5 mL)', 'Seminal vesicle secretions blocked by obstruction', 'Pathognomonic of EDO'],
['Azoospermia', 'Sperm trapped proximal to obstruction', 'Obstructive — testes produce sperm normally'],
['Normal LH/FSH', 'Pituitary-gonadal axis intact', 'Rules out hypogonadism/primary testicular failure'],
['Post-orgasmic abdominal pain', 'Seminal vesicle contraction against blocked duct → pressure', 'Confirms functional obstruction'],
['7-8 year duration', 'Structural/anatomical cause (congenital cyst, calculus, scar)', 'Not an acute/infective cause'],
['Normal erections', 'Erectile function independent of ejaculatory ducts', 'Consistent with pure obstruction'],
]
),
spacer(140),
sectionLabel('Possible Aetiology of EDO'),
spacer(80),
makeTable(
['Cause', 'Likelihood', 'Notes'],
[
['Mullerian duct cyst / midline prostatic cyst', { text: 'HIGH', bg: RED_LITE, color: '9C0006', bold: true }, 'Congenital; most common cause; seen on TRUS as midline cyst'],
['Ejaculatory duct calculus', { text: 'MODERATE', bg: YELLOW, color: '7F5600', bold: true }, 'Can cause intermittent obstruction and pain'],
['Seminal vesicle cyst', { text: 'MODERATE', bg: YELLOW, color: '7F5600', bold: true }, 'Causes pain + low volume; detectable on TRUS/MRI'],
['Post-infective scarring (Chlamydia, Gonorrhoea, TB)', { text: 'MODERATE', bg: YELLOW, color: '7F5600', bold: true }, '7-8 year history; prior STI cannot be excluded'],
['Wolffian duct anomaly (congenital)', { text: 'POSSIBLE', bg: GREY, color: DARK, bold: false }, 'If bilateral vas absent on examination'],
]
),
spacer(160),
heading2('Secondary / Contributing Diagnosis'),
spacer(60),
new Paragraph({
children: [
new TextRun({ text: 'Subclinical Hypothyroidism', bold: true, size: 22, color: BLUE_MID }),
new TextRun({ text: ' (TSH 5.119 µIU/mL — above range of 0.55-4.78)', size: 20, color: DARK }),
],
spacing: { before: 80, after: 80 },
indent: { left: 100 },
}),
alertBox([
'TSH is elevated while T3 and T4 remain within normal limits = Subclinical Hypothyroidism.',
'Thyroid dysfunction is a recognised cause of impaired spermatogenesis even at subclinical levels.',
'Smith & Tanagho General Urology: "Thyroid abnormalities impact spermatogenesis at the level of both',
'the pituitary and testis. Euthyroidism is important for normal hypothalamic-pituitary-gonadal function."',
'This requires treatment independently of the EDO.',
], YELLOW, 'C9A227'),
spacer(160),
heading2('Incidental Finding'),
spacer(60),
new Paragraph({
children: [
new TextRun({ text: 'Hepatic Steatosis — Grade 2 (Non-Alcoholic Fatty Liver Disease)', bold: true, size: 22, color: BLUE_MID }),
],
spacing: { before: 80, after: 80 },
indent: { left: 100 },
}),
para('Detected on ultrasound. Clinically relevant as it may impair hepatic testosterone metabolism. Requires dietary intervention and metabolic review.', 19, 60),
spacer(160),
sectionLabel('Differential Diagnoses Considered & Excluded'),
spacer(80),
makeTable(
['Diagnosis', 'For', 'Against', 'Verdict'],
[
['Ejaculatory Duct Obstruction', 'Entire symptom triad', '—', { text: 'PRIMARY DX', bg: BLUE_LITE, color: BLUE, bold: true }],
['Non-obstructive azoospermia', 'Azoospermia', 'Normal FSH/LH/testosterone; normal semen pH', { text: 'EXCLUDED', bg: RED_LITE, color: '9C0006', bold: true }],
['Bilateral vas deferens absence', 'Low volume azoospermia', 'Normal volume semen in CBAVD; no examination finding mentioned', { text: 'UNLIKELY', bg: YELLOW, color: '7F5600', bold: true }],
['Retrograde ejaculation', 'Azoospermia', 'Volume is 0.5 mL (not zero); normal uroflow', { text: 'UNLIKELY', bg: YELLOW, color: '7F5600', bold: true }],
['Primary hypogonadism', 'Infertility', 'FSH/LH normal; testosterone normal', { text: 'EXCLUDED', bg: RED_LITE, color: '9C0006', bold: true }],
['Idiopathic male infertility', 'Azoospermia', 'Structural signs (low volume, pain) present', { text: 'EXCLUDED', bg: RED_LITE, color: '9C0006', bold: true }],
]
),
spacer(200),
// ═══════════════════════════════════════════════
// SECTION 4 — INVESTIGATIONS REQUIRED
// ═══════════════════════════════════════════════
heading1('4. INVESTIGATIONS REQUIRED (In Order of Priority)'),
spacer(80),
makeTable(
['Priority', 'Investigation', 'Purpose', 'Expected Finding in EDO'],
[
[{ text: '1 — URGENT', bg: RED_LITE, color: '9C0006', bold: true }, 'Transrectal Ultrasound (TRUS)', 'First-line structural imaging for EDO', 'Dilated seminal vesicles (>1.5 cm), midline prostatic cyst, duct calculi'],
[{ text: '2 — URGENT', bg: RED_LITE, color: '9C0006', bold: true }, 'Post-ejaculate Urinalysis', 'Rule out retrograde ejaculation', 'No sperm in urine confirms antegrade obstruction'],
[{ text: '3 — HIGH', bg: YELLOW, color: '7F5600', bold: true }, 'Semen Fructose Level', 'Confirm seminal vesicle secretion blockage', 'Absent or very low fructose = confirms EDO'],
[{ text: '4 — HIGH', bg: YELLOW, color: '7F5600', bold: true }, 'MRI Pelvis (endorectal coil)', 'Detailed anatomy if TRUS inconclusive', 'Dilated SV, prostatic cyst, duct anatomy'],
[{ text: '5 — HIGH', bg: YELLOW, color: '7F5600', bold: true }, 'Thyroid review / Endocrinology referral', 'Manage subclinical hypothyroidism', 'Confirm need for levothyroxine'],
[{ text: '6 — ROUTINE', bg: GREEN_LITE, color: '375623', bold: true }, 'Testicular Biopsy (if TRUS confirms obstruction)', 'Confirm spermatogenesis is normal', 'Normal spermatogenesis = correctable surgically'],
[{ text: '7 — ROUTINE', bg: GREEN_LITE, color: '375623', bold: true }, 'Physical Examination — Vas Deferens & Testes', 'Rule out CBAVD; assess testicular size', 'Palpable vas; normal testicular volume'],
[{ text: '8 — ROUTINE', bg: GREEN_LITE, color: '375623', bold: true }, 'Liver Function Tests + Lipid Profile', 'Assess severity of NAFLD', 'Elevated ALT/AST; dyslipidaemia'],
]
),
spacer(200),
// ═══════════════════════════════════════════════
// SECTION 5 — TREATMENT PLAN
// ═══════════════════════════════════════════════
heading1('5. EVIDENCE-BASED TREATMENT PLAN'),
spacer(80),
heading2('5a. Definitive Treatment — Ejaculatory Duct Obstruction'),
spacer(80),
sectionLabel('Step 1: Confirm Obstruction (TRUS / MRI)'),
spacer(60),
para('Before any intervention, transrectal ultrasound must confirm the presence and level of obstruction. TRUS is the standard first-line imaging modality as per Campbell Walsh Wein Urology. If inconclusive, MRI pelvis with endorectal coil provides superior anatomical resolution.', 19),
spacer(120),
sectionLabel('Step 2: Transurethral Resection of Ejaculatory Ducts (TURED)'),
spacer(60),
infoBox([
'TURED is the standard surgical treatment for confirmed ejaculatory duct obstruction.',
'',
'Procedure: A cystoscope with resecting loop removes the verumontanum and unroofs any obstructing',
'cyst compressing the ejaculatory ducts. Real-time TRUS guidance improves accuracy.',
'',
'Evidence (Smith & Tanagho General Urology, 19th Ed):',
' • 65-70% of men show significant improvement in semen quality post-TURED',
' • 30% natural pregnancy rate expected',
' • Minimally invasive, cystoscopic procedure',
'',
'Complications (~20%, mostly self-limited): hematospermia, hematuria, UTI, epididymitis.',
'Rare: retrograde ejaculation, rectal perforation, urinary incontinence.',
]),
spacer(140),
sectionLabel('Step 3: If TURED Fails or is Not Suitable'),
spacer(60),
makeTable(
['Option', 'Description', 'Indication'],
[
['Surgical Sperm Aspiration (PESA/TESA)', 'Percutaneous or testicular sperm extraction', 'If TURED fails; sperm obtained for ART'],
['ICSI (Intracytoplasmic Sperm Injection)', 'Single sperm injected directly into oocyte', 'Used with extracted sperm when natural conception not possible'],
['IVF + ICSI', 'Full IVF cycle with surgically retrieved sperm', 'If female partner also has fertility factors'],
]
),
spacer(160),
heading2('5b. Subclinical Hypothyroidism Treatment'),
spacer(80),
makeTable(
['Aspect', 'Recommendation'],
[
['Drug', 'Levothyroxine (L-T4)'],
['Starting dose', '25-50 mcg once daily (morning, fasting)'],
['Target TSH', '0.5-2.5 µIU/mL (optimise for fertility)'],
['Follow-up', 'Repeat TSH in 6-8 weeks; adjust dose accordingly'],
['Rationale', 'Euthyroidism required for normal spermatogenesis (Campbell Walsh Wein Urology)'],
['Specialist', 'Endocrinology referral recommended'],
]
),
spacer(160),
heading2('5c. Current Prescription — Spercus (L-Carnitine + CoQ10 + Lycopene + Zinc)'),
spacer(80),
alertBox([
'⚠ IMPORTANT ASSESSMENT OF CURRENT PRESCRIPTION',
'',
'Spercus is a nutraceutical antioxidant supplement. It is NOT a treatment for obstructive azoospermia.',
'',
'Evidence (Cochrane Review 2022, PMID 35506389 — 90 RCTs, 10,303 men):',
'Antioxidants may improve sperm motility and morphology in men with EXISTING sperm (idiopathic subfertility).',
'When high-bias studies are removed, live birth benefit is NOT statistically significant.',
'',
'Evidence (Meta-Analysis 2020, PMID 35128424 — L-Carnitine):',
'L-Carnitine improves sperm motility and morphology but shows no effect on sperm CONCENTRATION',
'and no demonstrable improvement in clinical pregnancy rates.',
'',
'CLINICAL CONCLUSION:',
'In this patient, azoospermia is OBSTRUCTIVE — there are no sperm in the ejaculate to improve.',
'Spercus cannot dissolve a mechanical block. It WILL NOT resolve the underlying cause.',
'Spercus is safe and may be continued alongside definitive treatment but SHOULD NOT REPLACE surgery.',
'',
'ACTION REQUIRED: Request TRUS from urologist before concluding medical management alone is sufficient.',
], YELLOW, 'C9A227'),
spacer(160),
heading2('5d. Fatty Liver (NAFLD Grade 2) Management'),
spacer(80),
makeTable(
['Intervention', 'Details'],
[
['Dietary modification', 'Reduce refined carbohydrates, sugar, saturated fats; Mediterranean diet'],
['Exercise', 'Aerobic exercise 150 min/week; reduces hepatic fat'],
['Weight management', 'Target BMI <25; even 5-10% weight loss reduces liver fat significantly'],
['Alcohol', 'Complete avoidance'],
['LFT + Lipid panel', 'Baseline and 3-monthly monitoring'],
['Gastroenterology referral', 'If ALT persistently elevated or Grade 3 on follow-up USG'],
]
),
spacer(200),
// ═══════════════════════════════════════════════
// SECTION 6 — FOLLOW-UP PLAN
// ═══════════════════════════════════════════════
heading1('6. FOLLOW-UP PLAN'),
spacer(80),
makeTable(
['Timeline', 'Action'],
[
['IMMEDIATELY', 'TRUS pelvis — confirm/exclude ejaculatory duct obstruction'],
['IMMEDIATELY', 'Post-ejaculate urinalysis — rule out retrograde ejaculation'],
['IMMEDIATELY', 'Semen fructose — confirm absence of seminal vesicle contribution'],
['Within 2 weeks', 'Endocrinology referral — commence levothyroxine for subclinical hypothyroidism'],
['Within 4 weeks', 'Urology review with TRUS results — plan TURED if confirmed'],
['3 months post-TURED', 'Repeat semen analysis — assess surgical outcome'],
['6 months', 'Repeat TSH — confirm euthyroidism; reassess fertility status'],
['Ongoing', 'Liver function monitoring; dietary compliance review'],
]
),
spacer(200),
// ═══════════════════════════════════════════════
// SECTION 7 — SUMMARY
// ═══════════════════════════════════════════════
heading1('7. CLINICAL SUMMARY'),
spacer(80),
infoBox([
'Mr. Imtiaz, 28-year-old male, presents with a 7-8 year history of:',
' (1) Episodic, high-intensity lower abdominal pain lasting 15-30 minutes (post-ejaculatory in nature)',
' (2) Azoospermia with severely reduced semen volume (0.5 mL)',
' (3) Watery/thin ejaculate with no visible sperm',
' (4) Normal erectile function and orgasm',
'',
'Laboratory findings confirm:',
' • Azoospermia with low semen volume — obstructive pattern',
' • Normal testosterone, LH, FSH, prolactin — ruling out hormonal/testicular failure',
' • Elevated TSH (5.119 µIU/mL) — subclinical hypothyroidism',
' • Grade 2 fatty liver on ultrasound',
'',
'PRIMARY DIAGNOSIS: Ejaculatory Duct Obstruction (EDO) — Obstructive Azoospermia',
'SECONDARY: Subclinical Hypothyroidism',
'INCIDENTAL: Non-Alcoholic Fatty Liver Disease (NAFLD), Grade 2',
'',
'IMMEDIATE PRIORITY: TRUS pelvis to confirm EDO → TURED if confirmed.',
'Levothyroxine for TSH normalisation. Current prescription (Spercus) is insufficient as sole treatment.',
], BLUE_LITE),
spacer(200),
// ═══════════════════════════════════════════════
// SECTION 8 — REFERENCES
// ═══════════════════════════════════════════════
heading1('8. EVIDENCE REFERENCES'),
spacer(80),
bullet('Campbell Walsh Wein Urology, 3-Volume Set — Ejaculatory Duct Obstruction, Chapter 66'),
bullet('Smith and Tanagho\'s General Urology, 19th Edition — Ejaculatory Duct Obstruction & TURED'),
bullet('Smith and Tanagho\'s General Urology — Thyroid Abnormalities in Male Infertility (0.5% of cases)'),
bullet('de Ligny W, et al. Antioxidants for male subfertility. Cochrane Database Syst Rev. 2022 (PMID: 35506389)'),
bullet('Khaw SC, et al. L-carnitine and L-acetylcarnitine supplementation for idiopathic male infertility. Reprod Fertil. 2020 (PMID: 35128424)'),
bullet('WHO Laboratory Manual for Examination and Processing of Human Semen, 6th Edition — Reference values'),
bullet('American Thyroid Association Guidelines — Subclinical Hypothyroidism Management'),
spacer(200),
// disclaimer
new Paragraph({
children: [
new TextRun({ text: 'DISCLAIMER: ', bold: true, size: 18, color: '9C0006' }),
new TextRun({
text: 'This clinical summary has been generated by Orris AI for informational and reference purposes only. It is not a substitute for in-person clinical examination, diagnostic workup, or professional medical advice. All findings, diagnoses, and treatment recommendations must be reviewed and validated by a qualified medical practitioner before any clinical decision is made. The treating physician bears full clinical responsibility.',
size: 17, color: '666666', italics: true,
}),
],
shading: { type: ShadingType.SOLID, color: 'FFF0F0' },
border: { left: { style: BorderStyle.THICK, size: 12, color: '9C0006' } },
spacing: { before: 120, after: 120 },
indent: { left: 150, right: 150 },
}),
],
}],
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync('/home/daytona/workspace/imtiaz-clinical/Imtiaz_Clinical_Summary.docx', buffer);
console.log('SUCCESS: Document written.');
}).catch(err => {
console.error('ERROR:', err);
process.exit(1);
});
cd /home/daytona/workspace/imtiaz-clinical && node generate.js 2>&1
python3 /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/workspace/imtiaz-clinical/Imtiaz_Clinical_Summary.docx 2>&1
python3 -c " from pypdf import PdfReader # Check the docx is valid by opening it from docx import Document doc = Document('/home/daytona/workspace/imtiaz-clinical/Imtiaz_Clinical_Summary.docx') print(f'Paragraphs: {len(doc.paragraphs)}') print(f'Tables: {len(doc.tables)}') import os size = os.path.getsize('/home/daytona/workspace/imtiaz-clinical/Imtiaz_Clinical_Summary.docx') print(f'File size: {size:,} bytes ({size/1024:.1f} KB)') print('Document is VALID.') "
# Quick structural check — unzip and verify XML is well-formed cd /home/daytona/workspace/imtiaz-clinical && \ python3 -c " import zipfile, os f = 'Imtiaz_Clinical_Summary.docx' size = os.path.getsize(f) print(f'File size: {size:,} bytes ({size/1024:.1f} KB)') with zipfile.ZipFile(f) as z: names = z.namelist() print(f'ZIP entries: {len(names)}') # Check document.xml parses import xml.etree.ElementTree as ET doc_xml = z.read('word/document.xml') ET.fromstring(doc_xml) print('word/document.xml: VALID XML') print('Key files:', [n for n in names if n.endswith('.xml')][:8]) print('DOCUMENT VALIDATION PASSED.') "
Imtiaz Clinical Summary
Word Document · DOCX
| Section | Contents |
|---|---|
| 1. Presenting Complaints | Full symptom table — pain, ejaculate, duration, erectile status |
| 2. Investigations Summary | Hormonal profile, semen analysis, uroflowmetry, ultrasound — all colour-coded Normal / Elevated / Critical |
| 3. Diagnosis | Primary (EDO), secondary (subclinical hypothyroidism), incidental (NAFLD); pathophysiology table; aetiology table; differential diagnoses with exclusion rationale |
| 4. Investigations Required | 8 investigations in priority order with purpose and expected findings |
| 5. Evidence-Based Treatment Plan | TURED (65-70% success rate), fallback ART/ICSI, levothyroxine dosing, Spercus assessment with Cochrane 2022 evidence, NAFLD management |
| 6. Follow-Up Plan | Timeline from immediate to 6 months |
| 7. Clinical Summary | Concise one-page narrative of the full case |
| 8. References | Campbell Walsh Wein, Smith & Tanagho, Cochrane 2022 (PMID 35506389), L-Carnitine meta-analysis (PMID 35128424), WHO semen standards |
is it treatable
| What | Outcome |
|---|---|
| Semen quality improvement after TURED surgery | 65-70% of men |
| Natural pregnancy rate after TURED | ~30% |
| Sperm available for IVF/ICSI if surgery fails | Near 100% (extracted directly from testes) |
| Overall chance of fathering a child | Very high with the right treatment pathway |
The, the urologist is saying there is no obstruction. The surgeon and the urologist, both of them are saying that there is no obstruction, uh, which... Explain. Hmm, all these things. Uh, mostly the reason is that the sperm is not... Being able to form. So, the production is not happening of the sperm. That is the all, uh, cause. Uh, there is no obstruction to be seen in the ultrasound and the test doesn't, uh, and the symptoms also. The patient is not having any other symptoms other sometimes lower abdominal pain for 10 to 15 or 20 minutes. So, no other symptoms like infection or some other stuff which ha- stuff which happens due to the obstruction. And he's expe- experiencing all these from a very long time and no other... Symptom was recorded, only pain sometimes in the lower abdomen. Uh, after... Being, um, a rozzel. So, the urologist has suggested the medicine for three months, and he's saying there is no obstruction mostly. Uh, and your body will, uh, this medicine will help to create sperm and you will feel fine.
non-obstructive azoospermia treatment antioxidant empirical
| Feature | Points toward OBSTRUCTION | Points toward NON-OBSTRUCTIVE |
|---|---|---|
| Semen volume (0.5 mL) | Very low volume is classic for EDO | Low volume can also occur with partial failure |
| FSH (3.41 mIU/mL) | Normal FSH often seen in obstruction | Normal FSH also seen in early/mild spermatogenic failure |
| LH & testosterone | Normal (consistent with obstruction) | Normal (also seen in some NOA cases) |
| No obstruction on ultrasound | Against obstruction | Supports NOA |
| No infection symptoms | Against infective obstruction | Supports NOA |
| Post-ejaculatory pain | Classic for obstruction | Can be functional/pelvic floor pain in NOA too |
| 7-8 years unchanged | Structural cause | Also consistent with genetic/developmental failure |
| Cause | Details |
|---|---|
| Oxidative stress / idiopathic | Most common — no structural cause found; sperm production impaired at cellular level |
| Subclinical hypothyroidism | TSH 5.119 is elevated — thyroid hormone directly regulates spermatogenesis in the testis |
| Genetic cause (Y-chromosome microdeletion / Klinefelter mosaic) | Cannot be excluded without karyotype and Y-deletion studies |
| Sertoli-cell only syndrome | Testes produce hormones but no sperm — normal volume sometimes |
| Maturation arrest | Sperm start forming but stop at an early stage |
| Varicocele (subclinical) | Can impair spermatogenesis even if not palpable |
| Test | Why It Matters | Status |
|---|---|---|
| Testicular biopsy | Gold standard — tells exactly what is happening inside the testes (maturation arrest vs Sertoli-only vs active spermatogenesis) | Not done |
| Karyotype (chromosomal analysis) | Rules out Klinefelter syndrome (47,XXY) and other genetic causes | Not done |
| Y-chromosome microdeletion study | 15% of NOA has Y-deletions — if present, sperm can still be extracted surgically but natural pregnancy impossible | Not done |
| Thyroid treatment (Levothyroxine) | TSH 5.119 is elevated — this alone can impair spermatogenesis and is easily fixed | Not prescribed |
| Semen fructose test | Cheap test — distinguishes obstruction from failure definitively | Not done |
"Can we also treat the elevated TSH, and should we do a karyotype and Y-deletion test before concluding this is purely idiopathic?"