Provide in handwritten style notes on General surgical, principles & instruments.
ls /home/daytona/workspace/ && python3 -c "import reportlab; print('reportlab ok')" && fc-list | grep -i "caveat\|patrick\|handwrite\|kalam\|indie" | head -10
fc-list | grep -i "caveat\|patrick\|handwrit\|kalam\|indie\|chalk\|note\|cursive\|comic\|pecita" | head -20; echo "---"; fc-list --format="%{family}\n" | sort | head -60
pip install --quiet --user google-fonts 2>/dev/null; python3 -c " import urllib.request, os os.makedirs('/home/daytona/workspace/fonts', exist_ok=True) # Download Caveat (handwriting font) from Google Fonts urls = [ ('https://fonts.gstatic.com/s/caveat/v17/WnznHAc5bAfYB2QRah7pcpNvOx-pjcB9eIWpZA.woff2', 'Caveat-Regular.woff2'), ('https://fonts.gstatic.com/s/caveat/v17/WnznHAc5bAfYB2QRSh_pcpNvOx-pjfB9eIWpZA.woff2', 'Caveat-Bold.woff2'), ] for url, name in urls: try: urllib.request.urlretrieve(url, f'/home/daytona/workspace/fonts/{name}') print(f'Downloaded {name}') except Exception as e: print(f'Failed {name}: {e}') "
python3 -c " import urllib.request, os os.makedirs('/home/daytona/workspace/fonts', exist_ok=True) # Try downloading Caveat TTF url = 'https://github.com/googlefonts/caveat/raw/main/fonts/ttf/Caveat-Regular.ttf' try: urllib.request.urlretrieve(url, '/home/daytona/workspace/fonts/Caveat-Regular.ttf') print('Downloaded Caveat-Regular.ttf') except Exception as e: print(f'Failed: {e}') url2 = 'https://github.com/googlefonts/caveat/raw/main/fonts/ttf/Caveat-Bold.ttf' try: urllib.request.urlretrieve(url2, '/home/daytona/workspace/fonts/Caveat-Bold.ttf') print('Downloaded Caveat-Bold.ttf') except Exception as e: print(f'Failed: {e}') "
~/surgery-notes/generate_notes.py
#!/usr/bin/env python3
"""
Handwritten-style PDF notes: General Surgery - Principles & Instruments
Uses Caveat font (Google Fonts handwriting) + reportlab
"""
import os
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm, mm
from reportlab.lib import colors
from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
# ── Paths ──────────────────────────────────────────────────────────────────
FONT_DIR = "/home/daytona/workspace/fonts"
OUT_DIR = "/home/daytona/workspace/surgery-notes"
OUT_FILE = os.path.join(OUT_DIR, "General_Surgery_Principles_Instruments.pdf")
os.makedirs(OUT_DIR, exist_ok=True)
# ── Register Caveat ────────────────────────────────────────────────────────
pdfmetrics.registerFont(TTFont("Caveat", os.path.join(FONT_DIR, "Caveat-Regular.ttf")))
pdfmetrics.registerFont(TTFont("CaveatBold", os.path.join(FONT_DIR, "Caveat-Bold.ttf")))
# ── Palette ────────────────────────────────────────────────────────────────
BG = colors.HexColor("#FEFDF6") # warm cream
LINE = colors.HexColor("#C8D8E8") # faint ruled-line blue
MARGIN_L = colors.HexColor("#F5B8B8") # red margin line
INK = colors.HexColor("#1A1A2E") # dark navy ink
HEADING = colors.HexColor("#1B3A6B") # deep blue heading
SUB_H = colors.HexColor("#8B1A1A") # dark-red subheading
BULLET = colors.HexColor("#2E6B2E") # green bullet
STAR = colors.HexColor("#B8860B") # gold star/key-point
HIGHLIGHT = colors.HexColor("#FFF176") # yellow highlight
BOX_BG = colors.HexColor("#EAF4FB") # light blue box
BOX_BORD = colors.HexColor("#2196F3") # blue border
W, H = A4 # 595.27 x 841.89 pts
LM = 2.5 * cm # left margin (after red line)
RM = W - 1.6*cm # right margin
TM = H - 1.8*cm # top margin
BM = 1.5 * cm # bottom margin
LINE_SPACING = 24 # pts between ruled lines
RED_X = 1.8 * cm # x of red margin line
# ── Canvas helper ──────────────────────────────────────────────────────────
class NoteWriter:
def __init__(self, filename):
self.c = canvas.Canvas(filename, pagesize=A4)
self.page_num = 0
self._new_page()
# ── Background & ruled lines ─────────────────────────────────────────
def _draw_bg(self):
c = self.c
# cream background
c.setFillColor(BG)
c.rect(0, 0, W, H, fill=1, stroke=0)
# ruled lines
c.setStrokeColor(LINE)
c.setLineWidth(0.4)
y = TM
while y > BM:
c.line(0, y, W, y)
y -= LINE_SPACING
# red margin line
c.setStrokeColor(MARGIN_L)
c.setLineWidth(1.0)
c.line(RED_X, TM + 10, RED_X, BM - 5)
# page number
c.setFont("Caveat", 11)
c.setFillColor(INK)
c.drawCentredString(W/2, BM - 8, f"— {self.page_num} —")
def _new_page(self):
if self.page_num > 0:
self.c.showPage()
self.page_num += 1
self.y = TM - 6
self._draw_bg()
def _check_space(self, needed=26):
if self.y - needed < BM + 5:
self._new_page()
# ── Layout helpers ───────────────────────────────────────────────────
def skip(self, pts=8):
self.y -= pts
if self.y < BM + 5:
self._new_page()
def draw_title(self, text):
"""Big centred title with underline box"""
self._check_space(52)
c = self.c
# title box
bh = 38
c.setFillColor(HEADING)
c.roundRect(LM - 4, self.y - bh + 6, RM - LM + 8, bh, 6, fill=1, stroke=0)
c.setFillColor(colors.white)
c.setFont("CaveatBold", 26)
c.drawCentredString(W/2, self.y - 22, text)
self.y -= bh + 8
def draw_section(self, text, number=None):
"""Major section heading"""
self._check_space(36)
c = self.c
self.y -= 6
# underline bar
c.setFillColor(HEADING)
c.rect(LM - 4, self.y - 18, RM - LM + 8, 24, fill=1, stroke=0)
label = f" {number} {text}" if number else f" {text}"
c.setFillColor(colors.white)
c.setFont("CaveatBold", 18)
c.drawString(LM + 2, self.y - 12, label)
self.y -= 30
def draw_subsection(self, text):
"""Sub-heading (dark red, underline)"""
self._check_space(28)
c = self.c
self.y -= 4
c.setFont("CaveatBold", 15)
c.setFillColor(SUB_H)
c.drawString(LM, self.y, text)
# underline
tw = c.stringWidth(text, "CaveatBold", 15)
c.setStrokeColor(SUB_H)
c.setLineWidth(1.0)
c.line(LM, self.y - 2, LM + tw, self.y - 2)
self.y -= 20
def draw_para(self, text, indent=0, size=13, color=None):
"""Normal paragraph with auto-wrap"""
c = self.c
col = color or INK
c.setFont("Caveat", size)
c.setFillColor(col)
max_w = RM - LM - indent - 4
# naive word-wrap
words = text.split()
lines = []
cur = ""
for w in words:
test = (cur + " " + w).strip()
if c.stringWidth(test, "Caveat", size) <= max_w:
cur = test
else:
if cur:
lines.append(cur)
cur = w
if cur:
lines.append(cur)
for line in lines:
self._check_space(LINE_SPACING)
c.drawString(LM + indent, self.y, line)
self.y -= LINE_SPACING
def draw_bullet(self, text, level=0, key=False):
"""Bullet point; key=True → gold star"""
sym = "★" if key else ("•" if level == 0 else "◦")
sym_c = STAR if key else BULLET
indent = 18 + level * 14
c = self.c
c.setFont("CaveatBold" if key else "Caveat", 13 if not key else 13)
c.setFillColor(sym_c)
self._check_space(LINE_SPACING)
c.drawString(LM + indent - 14, self.y, sym)
c.setFillColor(INK)
c.setFont("Caveat", 13)
# wrap
max_w = RM - LM - indent - 4
words = text.split()
lines = []
cur = ""
for w in words:
test = (cur + " " + w).strip()
if c.stringWidth(test, "Caveat", 13) <= max_w:
cur = test
else:
if cur:
lines.append(cur)
cur = w
if cur:
lines.append(cur)
for i, line in enumerate(lines):
self._check_space(LINE_SPACING)
x = LM + indent if i == 0 else LM + indent + 4
c.drawString(x, self.y, line)
self.y -= LINE_SPACING
def draw_highlight_box(self, title, lines_list):
"""Highlighted blue info box"""
c = self.c
nlines = len(lines_list) + 1
bh = 22 + nlines * LINE_SPACING
self._check_space(bh + 10)
# box
c.setFillColor(BOX_BG)
c.setStrokeColor(BOX_BORD)
c.setLineWidth(1.5)
c.roundRect(LM - 4, self.y - bh + 14, RM - LM + 8, bh, 5, fill=1, stroke=1)
# title
c.setFont("CaveatBold", 14)
c.setFillColor(BOX_BORD)
c.drawString(LM + 4, self.y + 2, title)
self.y -= 18
for line in lines_list:
self._check_space(LINE_SPACING)
c.setFont("Caveat", 12)
c.setFillColor(INK)
c.drawString(LM + 8, self.y, line)
self.y -= LINE_SPACING
self.y -= 8
def draw_two_col_table(self, rows, col1w_frac=0.45):
"""Simple two-column table"""
c = self.c
tw = RM - LM
c1 = int(tw * col1w_frac)
c2 = tw - c1
row_h = LINE_SPACING + 4
total_h = row_h * len(rows) + 10
self._check_space(total_h + 20)
# header bg
hdr = rows[0]
c.setFillColor(HEADING)
c.rect(LM - 2, self.y - row_h + 8, tw + 4, row_h, fill=1, stroke=0)
c.setFillColor(colors.white)
c.setFont("CaveatBold", 13)
c.drawString(LM + 4, self.y - 6, hdr[0])
c.drawString(LM + c1 + 4, self.y - 6, hdr[1])
self.y -= row_h
# data rows
for i, row in enumerate(rows[1:]):
self._check_space(row_h + 4)
bg = colors.HexColor("#EAF4FB") if i % 2 == 0 else colors.white
c.setFillColor(bg)
c.rect(LM - 2, self.y - row_h + 8, tw + 4, row_h, fill=1, stroke=0)
c.setStrokeColor(LINE)
c.setLineWidth(0.4)
c.line(LM - 2, self.y - row_h + 8, RM + 2, self.y - row_h + 8)
c.setFont("CaveatBold", 12)
c.setFillColor(SUB_H)
c.drawString(LM + 4, self.y - 6, str(row[0]))
c.setFont("Caveat", 12)
c.setFillColor(INK)
# wrap col 2
c.drawString(LM + c1 + 4, self.y - 6, str(row[1]))
self.y -= row_h
self.y -= 6
def save(self):
self.c.save()
print(f"Saved → {OUT_FILE}")
# ═══════════════════════════════════════════════════════════════════════════
# CONTENT
# ═══════════════════════════════════════════════════════════════════════════
def build(nw: NoteWriter):
# ── COVER / TITLE ────────────────────────────────────────────────────
nw.skip(20)
nw.draw_title("General Surgery")
nw.draw_title("Principles & Instruments")
nw.skip(4)
nw.draw_para("★ Comprehensive Exam Notes ★", color=STAR, size=14)
nw.skip(6)
nw.draw_para("Based on: Sabiston Textbook of Surgery • Schwartz's Principles of Surgery", size=11, color=colors.HexColor("#555555"))
nw.skip(20)
# ════════════════════════════════════════════════════════
# SECTION 1 — ASEPSIS & STERILISATION
# ════════════════════════════════════════════════════════
nw.draw_section("ASEPSIS, STERILISATION & ANTISEPSIS", number="1")
nw.draw_subsection("Key Definitions")
nw.draw_bullet("Asepsis: absence of pathogenic micro-organisms from the surgical field")
nw.draw_bullet("Antisepsis: killing/inhibiting micro-organisms on LIVING tissue")
nw.draw_bullet("Disinfection: killing micro-organisms on INANIMATE surfaces (not all spores)")
nw.draw_bullet("Sterilisation: destruction of ALL micro-organisms including spores")
nw.skip(4)
nw.draw_subsection("Methods of Sterilisation")
nw.draw_two_col_table([
("Method", "Details / Used for"),
("Steam Autoclave (moist heat)", "121°C/15 psi × 15 min OR 134°C × 3 min — GOLD standard"),
("Dry Heat", "170°C × 1 hr — glassware, oils, powders"),
("Ethylene Oxide (ETO)", "Low temp; instruments damaged by heat/moisture"),
("Gamma / E-beam irradiation", "Disposable items, sutures, implants"),
("Formaldehyde gas", "Optical instruments"),
("Plasma (H₂O₂)", "Endoscopes, electronic equipment — no toxic residue"),
])
nw.draw_subsection("Common Antiseptics")
nw.draw_bullet("Povidone-iodine (Betadine) — broad spectrum, bactericidal, sporicidal")
nw.draw_bullet("Chlorhexidine gluconate — persistent residual activity, NOT sporicidal")
nw.draw_bullet("Alcohol (70% isopropyl) — rapid action, no residual, flammable")
nw.draw_bullet("Hydrogen peroxide 3% — wound irrigation, do NOT use in closed cavities")
nw.draw_bullet("Hexachlorophene — gram-positive organisms; neurotoxic in infants", key=True)
nw.skip(6)
nw.draw_highlight_box("⚠ Key Principle",
["Surgical scrub = mechanical scrub (2-5 min) + antiseptic solution",
"Chlorhexidine preferred over povidone-iodine for surgical hand rub",
"Sterile gloves do NOT replace thorough scrub technique"])
# ════════════════════════════════════════════════════════
# SECTION 2 — WOUND HEALING
# ════════════════════════════════════════════════════════
nw.draw_section("WOUND HEALING", number="2")
nw.draw_subsection("Phases of Wound Healing")
nw.draw_bullet("① Haemostasis (0-minutes):", level=0, key=True)
nw.draw_bullet("Platelet aggregation → thrombus; vascular spasm; coagulation cascade", level=1)
nw.draw_bullet("② Inflammatory Phase (0-4 days):", level=0, key=True)
nw.draw_bullet("Neutrophils (0-2 days) → débridement; Macrophages (2-4 days) → orchestrate repair", level=1)
nw.draw_bullet("Growth factors: PDGF, TGF-β, EGF released by platelets & macrophages", level=1)
nw.draw_bullet("③ Proliferative Phase (4-21 days):", level=0, key=True)
nw.draw_bullet("Fibroblasts → collagen III synthesis; angiogenesis; re-epithelialisation", level=1)
nw.draw_bullet("Wound contraction: myofibroblasts (peak day 10-14)", level=1)
nw.draw_bullet("④ Remodelling / Maturation (21 days – 2 years):", level=0, key=True)
nw.draw_bullet("Collagen III → Collagen I (type I = 80%); tensile strength increases", level=1)
nw.draw_bullet("Max tensile strength = ~80% of original at ~6-12 months", level=1)
nw.skip(4)
nw.draw_subsection("Types of Wound Closure")
nw.draw_two_col_table([
("Type", "Description"),
("Primary (1st intention)", "Wound edges approximated immediately; minimal scar"),
("Secondary (2nd intention)", "Wound left open; heals by granulation/contraction; larger scar"),
("Tertiary / Delayed 1°", "Wound left open 3-5 days then closed; contaminated wounds"),
])
nw.draw_subsection("Factors Impairing Healing")
nw.draw_bullet("Local: infection, ischaemia, foreign body, haematoma, dead space, radiation")
nw.draw_bullet("Systemic: diabetes, malnutrition (esp. vitamin C, zinc, protein), steroids")
nw.draw_bullet("Anaemia, uraemia, chemotherapy, jaundice")
nw.draw_bullet("AGE: elderly → ↓ collagen synthesis, ↓ angiogenesis")
nw.skip(4)
nw.draw_subsection("Abnormal Scarring")
nw.draw_bullet("Hypertrophic scar: raised, within wound boundary, regresses over time")
nw.draw_bullet("Keloid: extends BEYOND wound boundaries; more common in dark-skinned individuals", key=True)
nw.draw_bullet("Keloid Rx: intralesional triamcinolone, silicone gel, pressure, excision + adjuvant")
# ════════════════════════════════════════════════════════
# SECTION 3 — HAEMOSTASIS
# ════════════════════════════════════════════════════════
nw.draw_section("HAEMOSTASIS IN SURGERY", number="3")
nw.draw_subsection("Mechanical Methods")
nw.draw_bullet("Direct pressure — first line; most effective initial step")
nw.draw_bullet("Ligature / suture ligation — vessels < 3 mm can be ligated")
nw.draw_bullet("Clips (metal/titanium) — laparoscopic surgery; e.g. cystic duct")
nw.draw_bullet("Tourniquet — limb surgery; max 2 hrs upper limb, 1.5 hrs lower limb")
nw.draw_bullet("Packing — damage control surgery; large cavities (liver lacerations)")
nw.skip(4)
nw.draw_subsection("Thermal Methods")
nw.draw_bullet("Monopolar diathermy: circuit passes through body → concentrate at tip; CAUTION near pacemakers")
nw.draw_bullet("Bipolar diathermy: current only between two tips → safer near nerves & implants", key=True)
nw.draw_bullet("Harmonic scalpel (ultrasonic): 55,500 Hz; coagulates & cuts; minimal lateral thermal spread")
nw.draw_bullet("LigaSure (vessel sealing): fuses vessel walls with collagen/elastin; vessels up to 7 mm")
nw.draw_bullet("Argon beam coagulator — superficial haemostasis; liver, spleen")
nw.skip(4)
nw.draw_subsection("Topical Haemostatic Agents")
nw.draw_two_col_table([
("Agent", "Mechanism / Notes"),
("Gelatin sponge (Gelfoam)", "Scaffold for clot; absorbed in 4-6 wks"),
("Oxidised cellulose", "Lowers local pH → denatured Hb forms clot; bactericidal"),
("Thrombin (bovine/recombinant)", "Converts fibrinogen → fibrin; use with gelfoam"),
("Fibrin glue (sealant)", "Thrombin + fibrinogen; anastomotic leaks, parenchymal bleeding"),
("Bone wax", "Mechanical occlusion; sternal / skull bleeding"),
("Chitosan dressings", "Haemostatic; battlefield / trauma use"),
])
# ════════════════════════════════════════════════════════
# SECTION 4 — SUTURES & KNOTS
# ════════════════════════════════════════════════════════
nw.draw_section("SUTURES & KNOTS", number="4")
nw.draw_subsection("Classification of Sutures")
nw.draw_bullet("By absorption:")
nw.draw_bullet("Absorbable — hydrolysis or proteolysis; e.g. Vicryl, PDS, Monocryl, catgut", level=1)
nw.draw_bullet("Non-absorbable — permanent; e.g. Prolene, Nylon, Silk, Steel", level=1)
nw.draw_bullet("By structure:")
nw.draw_bullet("Monofilament — less bacteria harbourage, ↓ infection risk; e.g. PDS, Prolene", level=1)
nw.draw_bullet("Multifilament (braided) — easier handling, ↑ tissue drag; e.g. Vicryl, Silk", level=1)
nw.skip(4)
nw.draw_two_col_table([
("Suture", "Type / Key Property / Uses"),
("Catgut (plain)", "Absorbable; absorbed 5-7 days; rarely used now"),
("Chromic catgut", "Absorbable; absorbed 10-21 days; mucosa"),
("Vicryl (polyglactin 910)", "Braided absorbable; lost by 60 days; bowel, skin subcuticular"),
("Monocryl (poliglecaprone)", "Monofilament absorbable; 90-120 days; skin, bowel"),
("PDS (polydioxanone)", "Monofilament absorbable; 180 days; fascia, paediatric cardiac"),
("Prolene (polypropylene)", "Non-absorbable monofilament; vascular anastomosis"),
("Nylon (Ethilon)", "Non-absorbable monofilament; skin, tendons"),
("Silk", "Non-absorbable braided; ties, bile duct"),
("Stainless steel", "Non-absorbable; sternal closure, orthopaedics"),
])
nw.draw_subsection("Suture Sizes")
nw.draw_bullet("USP scale: 10-0 (finest) → 5 (thickest) [metric: 0.2 – 7 mm]")
nw.draw_bullet("Skin: 2-0 to 3-0 (trunk) | 4-0 to 5-0 (face) | 0 (fascia)")
nw.draw_bullet("Vascular: 4-0 (aorta) → 6-0 to 8-0 (coronary / micro)")
nw.skip(4)
nw.draw_subsection("Types of Suture Technique")
nw.draw_bullet("Interrupted: each stitch tied separately; preferred for contaminated wounds")
nw.draw_bullet("Continuous/running: quicker; even tension; anastomoses")
nw.draw_bullet("Subcuticular: cosmetic closure; absorbable or non-absorbable pull-out")
nw.draw_bullet("Mattress (horizontal/vertical): tension-relieving; everting skin edges")
nw.draw_bullet("Purse-string: appendix stump, colostomy, trocar port sites")
nw.skip(4)
nw.draw_subsection("Surgical Knots")
nw.draw_bullet("Square knot = 2 throws in opposite directions (1F-1B) — standard reef knot")
nw.draw_bullet("Surgeon's knot: first throw x2 → extra friction; slips less during 2nd throw", key=True)
nw.draw_bullet("Granny knot: both throws SAME direction — WEAK, avoid")
nw.draw_bullet("Half-hitch: single throw; multiple half-hitches = slip knot risk")
nw.draw_bullet("Aberdeen knot: finishing knot for continuous sutures")
nw.draw_highlight_box("Remember!",
["Minimum 3 throws for monofilament sutures (PDS, Prolene, Nylon)",
"Minimum 2 throws (square knot) sufficient for braided material",
"Knot security: Vicryl > Silk > Prolene for synthetic sutures"])
# ════════════════════════════════════════════════════════
# SECTION 5 — SURGICAL INSTRUMENTS
# ════════════════════════════════════════════════════════
nw.draw_section("SURGICAL INSTRUMENTS", number="5")
nw.draw_subsection("A. Cutting & Dissecting Instruments")
nw.draw_two_col_table([
("Instrument", "Use / Notes"),
("Scalpel (Bard-Parker)", "#10 – large incisions | #11 – stab/abscess | #15 – delicate | #22 – large body"),
("Metzenbaum scissors", "Tissue dissection — delicate; long handle, short blade"),
("Mayo scissors", "Cutting sutures & fascia — robust, curved/straight"),
("Iris scissors", "Fine ophthalmology / vascular work"),
("Tissue/Bandage scissors", "Cutting dressings"),
("Diathermy scissors", "Combined cutting + coagulation"),
])
nw.draw_subsection("B. Grasping & Holding Instruments")
nw.draw_two_col_table([
("Instrument", "Use / Notes"),
("Tissue forceps (toothed)", "Adson, rat-tooth — grip skin/tough tissue; traumatic"),
("Non-toothed (smooth)", "Dissecting forceps — bowel, delicate tissue; less trauma"),
("Babcock forceps", "Non-crushing; bowel, appendix, fallopian tube"),
("Allis forceps", "Toothed; grasping fascia/tumour edge — slightly traumatic"),
("Kocher forceps", "Toothed crushing clamp; thyroid, fascia"),
("Sponge-holding forceps", "Ring forceps; hold swabs, apply antiseptic"),
])
nw.draw_subsection("C. Haemostatic Clamps (Artery Forceps)")
nw.draw_two_col_table([
("Instrument", "Use / Notes"),
("Mosquito (Halstead)", "Fine vessels; delicate tissue — curved/straight"),
("Crile forceps", "Medium vessels"),
("Kelly forceps", "Larger vessels, general clamping"),
("Rochester-Pean", "Heavy clamping; large vascular pedicles"),
("Satinsky clamp", "Partial occlusion of major vessels (aorta, IVC)"),
("Bulldog clamp", "Temporary occlusion; vascular anastomosis"),
])
nw.draw_subsection("D. Retractors")
nw.draw_two_col_table([
("Retractor", "Type / Use"),
("Langenbeck", "Hand-held; laparotomy wound edges"),
("Deaver", "Hand-held; deep retraction — liver, bile duct surgery"),
("Army-Navy (US Army)", "Hand-held; superficial wound retraction"),
("Weitlaner", "Self-retaining; small incisions"),
("Gelpi", "Self-retaining; spinal, orthopaedic"),
("Balfour", "Self-retaining; laparotomy — lateral blades + central blade"),
("Bookwalter", "Self-retaining; versatile laparotomy system — fixed to table"),
("O'Sullivan-O'Connor", "Self-retaining; gynaecological pelvic surgery"),
("Finochietto", "Self-retaining; thoracotomy — rib spreader"),
])
nw.draw_subsection("E. Needle Holders")
nw.draw_bullet("Mayo-Hegar: most common; thick jaws — general closure")
nw.draw_bullet("Crile-Wood: lighter; precision suturing")
nw.draw_bullet("Castroviejo: ophthalmic / microsurgery — spring-loaded")
nw.draw_bullet("Mathieu: ratchet with curved handle — perineal surgery")
nw.skip(6)
nw.draw_subsection("F. Bowel / GI Instruments")
nw.draw_two_col_table([
("Instrument", "Use"),
("Doyen intestinal clamp", "Non-crushing; occlude bowel lumen (soft jaws)"),
("Parker-Kerr clamp", "Occlude colon — crushing"),
("GIA stapler", "Gastrointestinal anastomosis — staple + cut simultaneously"),
("TA stapler", "Thoraco-abdominal; staple without cutting"),
("EEA (circular)", "End-to-end anastomosis — oesophagus, colon, rectum"),
("Ligaclip", "Metal clip applicator — vessels, cystic duct"),
])
nw.draw_subsection("G. Laparoscopic Instruments")
nw.draw_bullet("Veress needle — closed pneumoperitoneum; angled bevel; spring-loaded safety tip")
nw.draw_bullet("Trocar & cannula — ports (5, 10, 12 mm); bladed (sharp) or bladeless")
nw.draw_bullet("Laparoscope — 0° (straight) or 30° (angled viewing)")
nw.draw_bullet("Laparoscopic scissors, graspers, dissectors — same functions, longer shafts")
nw.draw_bullet("Clip applicators — titanium or absorbable polymer (Hem-o-Lok)")
nw.draw_bullet("Morcellator — tissue removal; endometriosis, myomata", key=True)
nw.skip(6)
nw.draw_subsection("H. Suction & Irrigation")
nw.draw_bullet("Yankauer — oropharyngeal; large bore suction")
nw.draw_bullet("Poole suction — abdominal cavity; fenestrated shield prevents clogging")
nw.draw_bullet("Frazier — neurosurgery / ENT; angled fine suction")
# ════════════════════════════════════════════════════════
# SECTION 6 — ANAESTHESIA IN SURGERY (overview)
# ════════════════════════════════════════════════════════
nw.draw_section("ANAESTHESIA OVERVIEW", number="6")
nw.draw_subsection("Types")
nw.draw_bullet("General anaesthesia (GA): unconscious; airway secured (LMA / ETT)")
nw.draw_bullet("Regional: spinal (subarachnoid), epidural, nerve blocks")
nw.draw_bullet("Local infiltration: lidocaine, bupivacaine ± adrenaline")
nw.draw_bullet("Monitored anaesthesia care (MAC): sedation + local")
nw.skip(4)
nw.draw_subsection("Local Anaesthetics — Key Facts")
nw.draw_two_col_table([
("Agent", "Max Dose (without / with adrenaline) | Duration"),
("Lidocaine", "3 mg/kg / 7 mg/kg | 1-2 hrs"),
("Bupivacaine", "2 mg/kg / 3 mg/kg | 4-8 hrs — cardiotoxic in excess"),
("Ropivacaine", "3 mg/kg | 4-8 hrs — less cardiotoxic than bupivacaine"),
("Prilocaine", "6 mg/kg / 8.5 mg/kg | methaemoglobinaemia risk"),
("Cocaine", "3 mg/kg — ENT only; vasoconstriction; ONLY LA that is vasoconstrictor"),
])
nw.draw_bullet("Adrenaline (1:200,000) → vasoconstriction → prolongs LA + reduces systemic absorption")
nw.draw_bullet("NEVER use adrenaline-containing LA in: fingers, toes, penis, nose, ears (end arteries!)", key=True)
# ════════════════════════════════════════════════════════
# SECTION 7 — SURGICAL INCISIONS
# ════════════════════════════════════════════════════════
nw.draw_section("SURGICAL INCISIONS", number="7")
nw.draw_two_col_table([
("Incision", "Access / Use"),
("Midline (linea alba)", "Universal access; fast; no muscle cut; most common laparotomy"),
("Paramedian", "One side of midline; stronger closure; less used now"),
("Kocher (right subcostal)", "Biliary surgery: cholecystectomy, bile duct"),
("Rooftop (bilateral Kocher)", "Liver, pancreas, spleen, bariatric"),
("McBurney's (grid-iron)", "Open appendicectomy — right iliac fossa"),
("Lanz incision", "Cosmetic appendicectomy — Langer's lines"),
("Pfannenstiel", "Pelvis — Caesarean section, hysterectomy; cosmetic (above pubis)"),
("Chevron", "Gastro-oesophageal junction, total gastrectomy"),
("Thoraco-abdominal", "Oesophagus, stomach, left lobe liver"),
("Posterolateral thoracotomy", "Lung resections, oesophagus"),
])
nw.skip(4)
nw.draw_highlight_box("Incision Closure Principles (Jenkins Rule)",
["Mass closure: all layers in one continuous suture",
"Suture length : wound length ratio = 4:1 (prevents dehiscence)",
"Bites 1 cm from edge, 1 cm apart",
"Use slowly absorbable (PDS) or non-absorbable for fascial closure"])
# ════════════════════════════════════════════════════════
# SECTION 8 — DRAINS
# ════════════════════════════════════════════════════════
nw.draw_section("SURGICAL DRAINS", number="8")
nw.draw_subsection("Classification")
nw.draw_bullet("Active (closed-suction): Redivac, Blake, Jackson-Pratt — negative pressure")
nw.draw_bullet("Passive (open/gravity): Corrugated rubber/silicone, Penrose drain")
nw.draw_bullet("Sump drain: double-lumen; irrigation + drainage simultaneously")
nw.skip(4)
nw.draw_subsection("Specific Drains")
nw.draw_two_col_table([
("Drain", "Use"),
("Redivac / Hemovac", "Post-op wounds, haematoma prevention (breast, ortho)"),
("Jackson-Pratt (JP)", "Abdominal, thoracic — bulb suction"),
("Intercostal drain", "Pneumothorax, haemothorax, pleural effusion"),
("T-tube", "Common bile duct post-choledochotomy; removed 6-8 wks"),
("Foley catheter", "Urinary drainage; post-pelvic surgery"),
("Penrose", "Passive; infections, abscess cavities"),
])
nw.draw_subsection("When to Remove Drains")
nw.draw_bullet("< 30–50 mL/day output (for serous/blood drainage)")
nw.draw_bullet("No evidence of anastomotic leak (drain amylase if bowel anastomosis)")
nw.draw_bullet("Typically 24-72 hrs post-op for prophylactic drains")
nw.draw_bullet("Risks of prolonged drainage: infection, erosion into vessels, herniation")
# ════════════════════════════════════════════════════════
# SECTION 9 — DIATHERMY / ELECTROSURGERY
# ════════════════════════════════════════════════════════
nw.draw_section("DIATHERMY (ELECTROSURGERY)", number="9")
nw.draw_subsection("Principles")
nw.draw_bullet("High-frequency AC current (300 kHz – 3 MHz) → heat via electrical resistance")
nw.draw_bullet("Frequency too high to stimulate nerves/muscles (tetany threshold ~100 kHz)")
nw.draw_bullet("Two modes: CUT (continuous sine wave → vaporises cells) | COAGULATE (pulsed → desiccates)")
nw.draw_bullet("BLEND = mix of cut + coag waveforms")
nw.skip(4)
nw.draw_subsection("Monopolar vs Bipolar")
nw.draw_two_col_table([
("Feature", "Monopolar", ),
("Circuit", "Tip → through patient → return plate"),
("Return plate", "Needed; must have full contact → burns if poor contact"),
("Use", "General cutting/coagulation; laparoscopic"),
("Hazards", "Capacitance coupling, insulation failure, pacemaker interference"),
("", ""),
("Feature", "Bipolar"),
("Circuit", "Current only between two forceps tips"),
("Return plate", "NOT needed"),
("Use", "Delicate work: nerves, vessels, eyes, pacemaker patients"),
("Hazards", "Limited coagulation of large vessels"),
])
nw.draw_bullet("Argon plasma coagulation (APC): non-contact; ionised argon gas conducts current → surface coag", key=True)
nw.draw_bullet("Ultrasonic dissectors (CUSA, Harmonic): mechanical vibration 55.5 kHz; minimal thermal spread")
# ════════════════════════════════════════════════════════
# SECTION 10 — POST-OP COMPLICATIONS
# ════════════════════════════════════════════════════════
nw.draw_section("POST-OP COMPLICATIONS", number="10")
nw.draw_subsection("Timing & Causes (the 5 W's of Fever)")
nw.draw_two_col_table([
("Day Post-op", "Cause"),
("1-2 (Wind)", "Atelectasis, aspiration pneumonia — deep breathing, physiotherapy"),
("3-5 (Water)", "Urinary tract infection — catheter-related"),
("5-7 (Wound)", "Surgical site infection (SSI) — wound inspection, Abx"),
("5-7 (Walking)","DVT / Pulmonary embolism — anticoagulation, ambulation"),
("7+ (Wonder drug)", "Drug fever — review all medications"),
])
nw.draw_subsection("Wound Complications")
nw.draw_bullet("Haematoma: collection of blood; Rx — evacuation if tense/infected")
nw.draw_bullet("Seroma: serous fluid; Rx — aspiration or observation")
nw.draw_bullet("Dehiscence: partial wound breakdown; Rx — secondary closure")
nw.draw_bullet("Burst abdomen (evisceration): complete dehiscence; bowels exposed → EMERGENCY", key=True)
nw.draw_bullet("Incisional hernia: long-term complication; risk factors: obesity, infection, steroid use")
nw.skip(4)
nw.draw_subsection("Surgical Site Infection (SSI) Classification")
nw.draw_bullet("Superficial incisional: skin/subcutaneous — within 30 days")
nw.draw_bullet("Deep incisional: fascia/muscle — within 30 days (90 days if implant)")
nw.draw_bullet("Organ/space SSI: cavity or organ involved — most serious")
nw.draw_bullet("Prevention: prophylactic Abx within 60 min of incision; hair clipping (not shaving); normothermia", key=True)
nw.draw_subsection("Wound Classification")
nw.draw_two_col_table([
("Class", "Definition / SSI Rate"),
("I — Clean", "No inflammation; no GI/GU/respiratory entry; elective → <2% SSI"),
("II — Clean-contaminated", "GI/respiratory/GU entry; no spillage → 2-10%"),
("III — Contaminated", "Gross spillage; open accidental wound; acute inflammation → 10-20%"),
("IV — Dirty/infected", "Old traumatic wound; pus/perforated viscus → >30% SSI"),
])
# ════════════════════════════════════════════════════════
# SECTION 11 — SURGICAL KNOT TYING SUMMARY
# ════════════════════════════════════════════════════════
nw.draw_section("QUICK REFERENCE SUMMARY", number="11")
nw.draw_highlight_box("High-Yield Mnemonics",
["WOUNDS: Wound class, Open/closed, Undo haematoma, Nutrition, Drains, Skin closure",
"HALVED: Haematoma, Anaemia, Ligation fail, Vasospasm, Electrolyte, Diathermy = intraop bleeding causes",
"VICRYL: Very Important Closure Really Yet Lasts = braided absorbable suture",
"5 W's of post-op fever: Wind, Water, Wound, Walking, Wonder drugs"])
nw.skip(4)
nw.draw_subsection("Instrument Identification Tips (OSCE)")
nw.draw_bullet("Artery forceps: box joint, ratchet, transverse serrations on jaws")
nw.draw_bullet("Tissue forceps: NO ratchet; sprung (tweezers design)")
nw.draw_bullet("Needle holder: DIAMOND-jaw pattern for grip (cross-hatched)")
nw.draw_bullet("Self-retaining retractor: has ratchet/locking mechanism")
nw.draw_bullet("Name → function → usage (inspection, use, complications)")
nw.skip(6)
nw.draw_subsection("Scalpel Blade Numbers (must know!)")
nw.draw_bullet("#10 — large curved; general skin incisions")
nw.draw_bullet("#11 — triangular, pointed; stab incisions, abscess drainage, arterial cut-down")
nw.draw_bullet("#12 — hooked; ENT, tonsillectomy")
nw.draw_bullet("#15 — small curved; delicate/facial work, paediatrics")
nw.draw_bullet("#22 — large curved; thoracic, large body incisions")
nw.draw_bullet("Fit on: #3 handle (small blades) | #4 handle (large blades)")
nw.skip(6)
nw.draw_para("— End of Notes — Good Luck! 🏆", color=HEADING, size=15)
# ═══════════════════════════════════════════════════════════════════════════
if __name__ == "__main__":
nw = NoteWriter(OUT_FILE)
build(nw)
nw.save()
print("Done.")
cd /home/daytona/workspace/surgery-notes && python3 generate_notes.py 2>&1