Enumerate the uses of ultrasonography by surgeons-from standard literature like sabiston/bailey , if possible in an easy memorable format/Table in a downloadable one page pdf/image.
mkdir -p /tmp/workspace/surgical-us && ls /tmp/workspace/
~/surgical-us/generate_us_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.platypus import (
SimpleDocTemplate, Table, TableStyle, Paragraph, Spacer
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT
# ── page setup ──────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
"/tmp/workspace/surgical-us/Surgical_Ultrasonography_Uses.pdf",
pagesize=A4,
leftMargin=1.2*cm, rightMargin=1.2*cm,
topMargin=1.2*cm, bottomMargin=1.2*cm,
)
styles = getSampleStyleSheet()
# colour palette
DARK_NAVY = colors.HexColor("#1a2b4a")
MID_BLUE = colors.HexColor("#2563eb")
LIGHT_BLUE = colors.HexColor("#dbeafe")
ACCENT = colors.HexColor("#f59e0b")
ROW_ALT = colors.HexColor("#f0f7ff")
WHITE = colors.white
TEXT_DARK = colors.HexColor("#1e293b")
# ── custom paragraph styles ──────────────────────────────────────────────────
title_style = ParagraphStyle(
"Title", parent=styles["Normal"],
fontSize=15, fontName="Helvetica-Bold",
textColor=WHITE, alignment=TA_CENTER, leading=18,
)
subtitle_style = ParagraphStyle(
"Sub", parent=styles["Normal"],
fontSize=8.5, fontName="Helvetica-Oblique",
textColor=colors.HexColor("#93c5fd"), alignment=TA_CENTER, leading=11,
)
header_style = ParagraphStyle(
"Hdr", parent=styles["Normal"],
fontSize=8, fontName="Helvetica-Bold",
textColor=WHITE, alignment=TA_CENTER, leading=10,
)
cat_style = ParagraphStyle(
"Cat", parent=styles["Normal"],
fontSize=8, fontName="Helvetica-Bold",
textColor=DARK_NAVY, alignment=TA_LEFT, leading=10,
)
body_style = ParagraphStyle(
"Body", parent=styles["Normal"],
fontSize=7.2, fontName="Helvetica",
textColor=TEXT_DARK, alignment=TA_LEFT, leading=9.5,
)
bullet_style = ParagraphStyle(
"Bullet", parent=styles["Normal"],
fontSize=7.2, fontName="Helvetica",
textColor=TEXT_DARK, alignment=TA_LEFT, leading=9.5,
leftIndent=6, bulletIndent=0,
)
mnemonic_style = ParagraphStyle(
"Mnemo", parent=styles["Normal"],
fontSize=8, fontName="Helvetica-Bold",
textColor=DARK_NAVY, alignment=TA_CENTER, leading=12,
)
footer_style = ParagraphStyle(
"Footer", parent=styles["Normal"],
fontSize=6.5, fontName="Helvetica-Oblique",
textColor=colors.HexColor("#64748b"), alignment=TA_CENTER, leading=9,
)
def B(txt): return Paragraph(txt, body_style)
def BUL(txt): return Paragraph(f"• {txt}", bullet_style)
def CAT(txt): return Paragraph(txt, cat_style)
# ═══════════════════════════════════════════════════════════════════════════
# TABLE DATA
# ═══════════════════════════════════════════════════════════════════════════
# Columns: Category | Specific Uses | Key Points / Mnemonics
# ─────────────────────────────────────────────────────────────────────────
data = [
# ── HEADER ROW ──
[
Paragraph("CATEGORY", header_style),
Paragraph("SPECIFIC USES", header_style),
Paragraph("KEY NOTES / PEARLS", header_style),
],
# 1 DIAGNOSTIC ABDOMINAL
[
CAT("1. DIAGNOSTIC\n(Abdomen)"),
[
BUL("Gallstones & cholecystitis (1st-line >95% sensitivity)"),
BUL("CBD dilation / choledocholithiasis / cholangitis"),
BUL("Liver lesions: metastasis, HCC, cysts, abscess"),
BUL("Liver fibrosis / cirrhosis (elastography)"),
BUL("Pancreatic pathology (dilated PD, fluid collection)"),
BUL("Renal / ureteric pathology, hydronephrosis"),
BUL("Spleen: size, injury, abscess"),
BUL("Ascites, free fluid, bowel obstruction"),
BUL("Aortic aneurysm (screening & monitoring)"),
BUL("Appendicitis (initial modality, no radiation)"),
],
[
B("Bailey & Love 28e (Ch 8): US = 1st-line for liver,"),
B("biliary, renal tract. Gallstones: echogenic focus +"),
B("posterior acoustic shadow ± moves with position."),
B("Sabiston 21e: sensitivity >95% gallstones; CBD"),
B("dilation → obstruction. Contrast-US improves lesion"),
B("characterisation with microbubble agents."),
],
],
# 2 TRAUMA / FAST
[
CAT("2. TRAUMA\n(FAST / eFAST)"),
[
BUL("Intraperitoneal free fluid / haemoperitoneum"),
BUL("Haemopericardium / cardiac tamponade"),
BUL("Haemothorax"),
BUL("Pneumothorax (eFAST: loss of pleural sliding)"),
BUL("Guides decision: direct laparotomy vs CT in unstable"),
],
[
B("Bailey & Love 28e (Ch 8 trauma): Replaces DPL."),
B("Unstable + free fluid → theatre; stable → CT."),
B("Schwartz 11e: FAST – 4 windows (pericardial,"),
B("hepatorenal, splenorenal, pelvis)."),
B("Sabiston: early-adopter tool for trauma surgeons."),
],
],
# 3 INTRAOPERATIVE
[
CAT("3. INTRA-\nOPERATIVE"),
[
BUL("Liver surgery: GOLD STANDARD for lesion detection"),
BUL("(finds 20–30% more lesions than preop imaging)"),
BUL("Alters management in ~50% of hepatic resections"),
BUL("Tumour staging, vascular anatomy, resection plane"),
BUL("Choledochoscopy / bile duct stone confirmation"),
BUL("Parathyroid localisation (neck surgery)"),
BUL("Pancreatic surgery: insulinoma localisation"),
BUL("Laparoscopic US during minimally invasive HPB"),
BUL("Tumour ablation guidance (RFA, MWA)"),
],
[
B("Schwartz 11e: IOuS = gold standard, liver lesions;"),
B("influences surgical plan in 50% of resections."),
B("Sabiston 21e: real-time vascular + parenchymal info"),
B("during hepatic, pancreatic, parathyroid surgery."),
B("Fischer's Mastery 8e: HPB surgical US entrustment"),
B("competency framework."),
],
],
# 4 ENDOSCOPIC US
[
CAT("4. ENDOSCOPIC\nULTRASOUND\n(EUS)"),
[
BUL("Staging: oesophageal, gastric, pancreatic Ca (T/N)"),
BUL("Bile duct & pancreatic duct evaluation"),
BUL("FNA of pancreatic / lymph node lesions"),
BUL("Submucosal tumour characterisation (GIST, lipoma)"),
BUL("Chronic pancreatitis diagnosis (Rosemont criteria)"),
BUL("Rectal cancer: depth of invasion (T-staging)"),
BUL("Anal sphincter assessment (faecal incontinence)"),
],
[
B("Bailey & Love 28e Table 9.6: EUS indications."),
B("Schwartz/Sabiston: Rosemont consensus criteria for"),
B("chronic pancreatitis via EUS features."),
B("EUS-FNA: sensitivity ~85% for pancreatic Ca."),
],
],
# 5 VASCULAR
[
CAT("5. VASCULAR\n(Doppler US)"),
[
BUL("Carotid duplex: stenosis screening & follow-up"),
BUL("Peripheral arterial disease: ankle-brachial / PVD"),
BUL("DVT: compressibility, flow assessment"),
BUL("AAA: surveillance & diameter measurement"),
BUL("Renal artery stenosis, transplant vasculature"),
BUL("Varicose veins: saphenofemoral / SFJ incompetence"),
BUL("Portal hypertension: portal vein flow direction"),
],
[
B("Sabiston 21e: Carotid duplex – standard surveillance"),
B("tool. Doppler: direction + velocity of blood flow."),
B("Bailey & Love 28e (Ch): Doppler in arterial &"),
B("venous disease. Stenosis → altered velocity pattern."),
],
],
# 6 SUPERFICIAL / ORGAN-SPECIFIC
[
CAT("6. SUPERFICIAL\nSTRUCTURES"),
[
BUL("Thyroid: nodule characterisation, FNAC guidance"),
BUL("Parathyroid: pre-op localisation of adenoma"),
BUL("Breast: solid vs cystic, FNAC / core biopsy guide"),
BUL("Testicular: torsion, tumour, epididymo-orchitis"),
BUL("Soft tissue: lipoma, abscess, foreign body"),
BUL("Musculoskeletal: ligament, tendon, muscle injury"),
BUL("Hernias: inguinal, femoral, abdominal wall"),
],
[
B("Bailey & Love 28e: thyroid + testicular – best initial"),
B("modality (high-freq linear probe)."),
B("Sabiston 21e: thyroid nodule US + FNAC combined."),
B("High-freq probes (7–15 MHz) for superficial work."),
],
],
# 7 PROCEDURAL GUIDANCE
[
CAT("7. PROCEDURAL\nGUIDANCE"),
[
BUL("Central venous access (IJV, subclavian, femoral)"),
BUL("Arterial line placement"),
BUL("Peripheral venous access (difficult veins)"),
BUL("US-guided nerve blocks (regional anaesthesia)"),
BUL("Abscess / fluid collection aspiration & drainage"),
BUL("Liver / renal / thyroid / lymph node biopsy"),
BUL("Thoracocentesis / paracentesis guidance"),
BUL("Percutaneous biliary drain / nephrostomy"),
],
[
B("Bailey & Love 28e: US guides needle placement with"),
B("real-time direct visualisation; key in shocked pts"),
B("for central access. Sabiston: POCUS in OR for"),
B("airway, cardiac, gastric content assessment."),
],
],
# 8 POINT-OF-CARE / PERIOPERATIVE
[
CAT("8. POINT-OF-CARE\n(POCUS)"),
[
BUL("Confirmation of endotracheal tube position"),
BUL("Gastric content / full stomach assessment pre-op"),
BUL("Cardiac function: LV/RV, wall motion, pericardium"),
BUL("Lung: B-lines (pulmonary oedema), consolidation"),
BUL("Septic shock: resuscitation monitoring"),
BUL("IVC collapsibility: volume status assessment"),
],
[
B("Sabiston 21e: POCUS in operating room – airway,"),
B("cardiac, pulmonary, gastric content. Influences"),
B("resuscitation in septic shock. Anaesthesiologists &"),
B("surgeons both use perioperative POCUS."),
],
],
]
# ── TABLE STYLE ─────────────────────────────────────────────────────────────
col_widths = [3.0*cm, 9.2*cm, 6.2*cm]
table_style = TableStyle([
# header
("BACKGROUND", (0,0), (-1,0), MID_BLUE),
("TEXTCOLOR", (0,0), (-1,0), WHITE),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,0), 8),
("ALIGN", (0,0), (-1,0), "CENTER"),
("ROWBACKGROUNDS",(0,1),(-1,-1), [WHITE, ROW_ALT]),
# category column highlight
("BACKGROUND", (0,1), (0,-1), LIGHT_BLUE),
# grid
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#cbd5e1")),
("LINEBELOW", (0,0), (-1,0), 1.0, MID_BLUE),
# padding
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 5),
("RIGHTPADDING", (0,0), (-1,-1), 5),
# vertical align
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
])
table = Table(data, colWidths=col_widths, repeatRows=1)
table.setStyle(table_style)
# ── MNEMONIC BOX ────────────────────────────────────────────────────────────
mnemonic_data = [[
Paragraph(
'<b>MNEMONIC – "DIVE PPS"</b> | '
'<b>D</b>iagnostic (abdomen) · '
'<b>I</b>ntraoperative · '
'<b>V</b>ascular (Doppler) · '
'<b>E</b>ndoscopic (EUS) · '
'<b>P</b>rocedural guidance · '
'<b>P</b>OCUS (perioperative) · '
'<b>S</b>uperficial structures | '
'+ Trauma / FAST',
mnemonic_style,
)
]]
mnemonic_table = Table(mnemonic_data, colWidths=[18.4*cm])
mnemonic_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), ACCENT),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING", (0,0), (-1,-1), 8),
("ROUNDEDCORNERS", [3]),
]))
# ── TITLE BANNER ────────────────────────────────────────────────────────────
title_data = [[
Paragraph("ULTRASONOGRAPHY IN SURGERY", title_style),
Paragraph(
"Sources: Bailey & Love 28e · Sabiston 21e · Schwartz 11e · Fischer's Mastery 8e",
subtitle_style,
),
]]
title_table = Table(title_data, colWidths=[18.4*cm])
title_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), DARK_NAVY),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 10),
("RIGHTPADDING", (0,0), (-1,-1), 10),
]))
footer = Paragraph(
"Compiled by Orris AI · For educational use only · August 2026",
footer_style,
)
# ── BUILD ────────────────────────────────────────────────────────────────────
elements = [
title_table,
Spacer(1, 0.25*cm),
mnemonic_table,
Spacer(1, 0.25*cm),
table,
Spacer(1, 0.2*cm),
footer,
]
doc.build(elements)
print("PDF created OK")
cd /tmp/workspace/surgical-us && python generate_us_pdf.py 2>&1
ls -lh /tmp/workspace/surgical-us/