:Define obscure gastro intestinal bleed. Briefly discuss the etiology, clinical profile and currently available diagnostic modalities for its evaluation.(15) :Recent advances in endoscopy(10) :Surgical options in patients with chronic constipation.(10) :Mini gastric bypass metabolic surgery.(10) :Enumerate the types of wound in surgical practice and discuss the types of wound closure(15) :A 25 year old female patient presented to the emergency department after alleged history of road accident with the following vital parameters: BP80/60mmg, Pulse Rate: 132 beats/minute, rapid thready pulse, cold peripheries, respiratory rate of 28 cycles/minute. Pallor present. Emergency CBC suggestive of Hemoglobin 5.2gm/di. * Mention the clinical diagnosis of the above mentioned condition. * Define and classify shock. * Appropriate clinical management of the above mentioned condition. * Define massive blood transfusion. • Enumerate blood transfusion complications :Discuss lesser sac and its surgical impression.(10) Nutritional indices(10) :Blood supply and function of the skin(10) :Describe the surgical anatomy of triangle of neck. Describe the types and indications of neck dissection?(15) :A 35 years male diagnosed as a case of bilateral uncomplicated inguinal hernia has undergone TAPP repair. He came in follow-up with complaint of persistent dull aching pain in right groin area radiating to right side upper medial thigh and right hemiscrotum. This pain is associated with on and off tingling sensation. a) Describe abdominal anatomy seen during TAPP repair? 5 marks * Write the diagnosis of above patient and possible causes and management for this complication? * Discuss other complications of laparoscopic surgery for hernia repair? :Sterilization of laparoscopic instruments(10) :Surgical importance of space of Bogros(10) :Pleomorphic adenoma(10) :Enumerate the causes of perforation of small intestine, Describe pathophysiology, clinical presentation and diagnostic approach of typhoid ulcer perforation of small intestine. Outline the principles of surgical and postoperative management along with possible complications?(15)

Reading File
Your list is a broad general-surgery examination set. I can build an exam-oriented answer for one topic at a time, with definitions, headings, management algorithms, and mark-wise structure.
Asking for Preferences

Which topic should I cover in detail first?

Your list is a broad general-surgery examination set. I can build an exam-oriented answer for one topic at a time, with definitions, headings, management algorithms, and mark-wise structure.This is a large General Surgery question bank. Topics covered:
  1. Obscure GI bleeding: definition, causes, presentation, diagnostic work-up
  2. Recent advances in endoscopy
  3. Chronic constipation: surgical options
  4. Mini gastric bypass / metabolic surgery
  5. Wounds: classification and closure techniques
  6. Hemorrhagic shock, massive transfusion, and transfusion reactions
  7. Lesser sac and surgical relevance
  8. Nutritional indices
  9. Skin: vascular supply and functions
  10. Neck triangles and neck dissection
  11. TAPP anatomy, chronic postoperative inguinal pain, and complications
  12. Sterilization of laparoscopic instruments
  13. Space of Bogros
  14. Pleomorphic adenoma
  15. Small-bowel perforation, especially typhoid perforation
Tell me the one topic you want first, and I will provide a structured, exam-ready answer matched to the marks allotted.

Make a concise PDF study guide from these questions

Reading File
The requested PDF would cover an entire General Surgery revision set. Choose one section for a concise, exam-oriented PDF study guide first.
Asking for Preferences

Which section should I turn into the first concise PDF study guide?

Your list is a broad general-surgery examination set. I can build an exam-oriented answer for one topic at a time, with definitions, headings, management algorithms, and mark-wise structure.This is a large General Surgery question bank. Topics covered:
  1. Obscure GI bleeding: definition, causes, presentation, diagnostic work-up
  2. Recent advances in endoscopy
  3. Chronic constipation: surgical options
  4. Mini gastric bypass / metabolic surgery
  5. Wounds: classification and closure techniques
  6. Hemorrhagic shock, massive transfusion, and transfusion reactions
  7. Lesser sac and surgical relevance
  8. Nutritional indices
  9. Skin: vascular supply and functions
  10. Neck triangles and neck dissection
  11. TAPP anatomy, chronic postoperative inguinal pain, and complications
  12. Sterilization of laparoscopic instruments
  13. Space of Bogros
  14. Pleomorphic adenoma
  15. Small-bowel perforation, especially typhoid perforation
Tell me the one topic you want first, and I will provide a structured, exam-ready answer matched to the marks allotted.The requested PDF would cover an entire General Surgery revision set. Choose one section for a concise, exam-oriented PDF study guide first.
Reading File
Browsing Directory

~/

Finding Sources
Searching the Web

current guidelines obscure gastrointestinal bleeding small bowel bleeding endoscopy massive transfusion laparoscopic surgery sterilization metabolic surgery

Searching PubMed

"obscure gastrointestinal bleeding" AND endoscopy

Searching PubMed

"chronic constipation" AND surgery

Searching PubMed

"metabolic bariatric surgery" AND outcomes

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Running Command

mkdir -p "/tmp/workspace/general-surgery-study-guide/src" "/tmp/workspace/general-surgery-study-guide/output" && printf '%s\n' 'Project directories created.'

Browsing Directory

~/general-surgery-study-guide/

Writing File

~/general-surgery-study-guide/src/create_guide.py

from reportlab.lib import colors
from reportlab.lib.enums import TA_CENTER, TA_LEFT
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak, Table, TableStyle, KeepTogether
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase import pdfmetrics
from reportlab.lib.colors import HexColor
from reportlab.pdfbase.pdfmetrics import stringWidth

OUT='/tmp/workspace/general-surgery-study-guide/output/General_Surgery_Concise_Study_Guide.pdf'

NAVY=HexColor('#163A5F'); BLUE=HexColor('#2A6F97'); TEAL=HexColor('#147D80'); PALE=HexColor('#EAF3F7'); GREY=HexColor('#F4F6F7'); RED=HexColor('#9E2A2B')
styles=getSampleStyleSheet()
styles.add(ParagraphStyle(name='TitleX', parent=styles['Title'], fontName='Helvetica-Bold', fontSize=22, leading=27, alignment=TA_CENTER, textColor=NAVY, spaceAfter=10))
styles.add(ParagraphStyle(name='SubTitleX', parent=styles['Normal'], fontName='Helvetica', fontSize=10.5, leading=14, alignment=TA_CENTER, textColor=HexColor('#45616F'), spaceAfter=14))
styles.add(ParagraphStyle(name='H1X', parent=styles['Heading1'], fontName='Helvetica-Bold', fontSize=15, leading=18, textColor='white', backColor=NAVY, borderPadding=6, spaceBefore=10, spaceAfter=8))
styles.add(ParagraphStyle(name='H2X', parent=styles['Heading2'], fontName='Helvetica-Bold', fontSize=11.5, leading=14, textColor=TEAL, spaceBefore=8, spaceAfter=4))
styles.add(ParagraphStyle(name='BodyX', parent=styles['BodyText'], fontName='Helvetica', fontSize=8.6, leading=11.3, spaceAfter=3))
styles.add(ParagraphStyle(name='SmallX', parent=styles['BodyText'], fontName='Helvetica', fontSize=7.6, leading=9.5, textColor=HexColor('#34495E')))
styles.add(ParagraphStyle(name='CallX', parent=styles['BodyText'], fontName='Helvetica-Bold', fontSize=8.7, leading=11.5, textColor=RED, backColor=HexColor('#FCEDEC'), borderPadding=5, spaceBefore=4, spaceAfter=6))
styles.add(ParagraphStyle(name='FootX', parent=styles['BodyText'], fontName='Helvetica-Oblique', fontSize=7.4, leading=9, textColor=HexColor('#59666D')))


def P(s,style='BodyX'): return Paragraph(s,styles[style])
def bullets(items):
    return [P('• '+x) for x in items]
def table(rows, widths=None):
    data=[[P(c,'SmallX') for c in r] for r in rows]
    t=Table(data,colWidths=widths,repeatRows=1,hAlign='LEFT')
    t.setStyle(TableStyle([
        ('BACKGROUND',(0,0),(-1,0),NAVY),('TEXTCOLOR',(0,0),(-1,0),colors.white),
        ('FONTNAME',(0,0),(-1,0),'Helvetica-Bold'),('VALIGN',(0,0),(-1,-1),'TOP'),
        ('GRID',(0,0),(-1,-1),0.3,HexColor('#C9D6DC')),('ROWBACKGROUNDS',(0,1),(-1,-1),[colors.white,GREY]),
        ('LEFTPADDING',(0,0),(-1,-1),5),('RIGHTPADDING',(0,0),(-1,-1),5),('TOPPADDING',(0,0),(-1,-1),4),('BOTTOMPADDING',(0,0),(-1,-1),4)
    ]))
    return t

def header_footer(canvas,doc):
    canvas.saveState(); w,h=A4
    canvas.setStrokeColor(HexColor('#B7C9D3')); canvas.line(1.5*cm,h-1.1*cm,w-1.5*cm,h-1.1*cm)
    canvas.setFont('Helvetica',7.5); canvas.setFillColor(HexColor('#566B75'))
    canvas.drawString(1.5*cm,h-.85*cm,'GENERAL SURGERY | CONCISE EXAM REVISION')
    canvas.drawRightString(w-1.5*cm,.72*cm,f'Page {doc.page}')
    canvas.setStrokeColor(HexColor('#B7C9D3')); canvas.line(1.5*cm,1.0*cm,w-1.5*cm,1.0*cm)
    canvas.restoreState()

story=[]
story += [Spacer(1,2.3*cm),P('General Surgery', 'TitleX'),P('Concise Study Guide from the Question Set', 'TitleX'),P('High-yield, exam-structured notes for 10- and 15-mark answers. Use local institutional protocols for emergency care, antibiotics, transfusion and perioperative decisions.', 'SubTitleX')]
story += [P('<b>How to use:</b> Start each long answer with a definition/classification, use labelled subheadings, add a diagram where relevant, and end with complications or a management algorithm.', 'CallX')]
story += [P('<b>Contents:</b> GI bleeding and endoscopy | constipation and metabolic surgery | wounds, shock and transfusion | anatomy and neck | TAPP and laparoscopy | typhoid perforation | salivary gland tumor.', 'BodyX'),Spacer(1,8)]
story += [P('<b>Abbreviations:</b> OGIB = obscure GI bleeding; VCE = video capsule endoscopy; DAE = device-assisted enteroscopy; CTA = CT angiography; MTP = massive transfusion protocol; TAPP = transabdominal preperitoneal; CPIP = chronic postoperative inguinal pain.', 'SmallX'),PageBreak()]

# 1
story += [P('1. Obscure GI Bleeding and Recent Advances in Endoscopy','H1X')]
story += [P('Definition and clinical profile','H2X'),P('<b>Obscure GI bleeding (OGIB)</b> is recurrent or persistent bleeding, overt or occult, after an unrevealing, adequate oesophagogastroduodenoscopy and colonoscopy. The preferred contemporary term is <b>suspected small-bowel bleeding</b>, because a source is now found in most cases.', 'BodyX')]
story += bullets(['<b>Overt:</b> melena or hematochezia. <b>Occult:</b> iron-deficiency anaemia and/or positive faecal occult blood test without visible bleeding.', '<b>Clinical profile:</b> fatigue, dyspnoea, pallor, postural symptoms; quantify bleeding and assess haemodynamic instability. History: NSAIDs/anticoagulants, liver or renal disease, aortic stenosis, prior surgery/radiation, hereditary hemorrhagic telangiectasia.', '<b>Common small-bowel causes:</b> angioectasia (especially older adults), NSAID erosions/ulcers, Crohn disease, tumours (GIST, adenocarcinoma, lymphoma), Meckel diverticulum, Dieulafoy lesion, varices, radiation enteritis. Missed upper/lower lesions remain possible.'])]
story += [P('Evaluation algorithm','H2X'),table([['Situation','Best next assessment'],['Repeat upper/lower endoscopy if initial view/preparation inadequate or suspicion of missed lesion','Treat lesion if found; include terminal ileum when appropriate.'],['Haemodynamically stable, overt or occult suspected small-bowel bleeding','VCE first-line after negative high-quality EGD and colonoscopy.'],['VCE lesion or high suspicion of a treatable lesion','DAE: double-balloon, single-balloon or spiral enteroscopy for biopsy, haemostasis, tattooing, dilation or retrieval.'],['Suspected mass, Crohn disease or risk of capsule retention','CT enterography or MR enterography; patency capsule may be considered.'],['Brisk ongoing bleeding / unstable patient','Resuscitate; CTA to localize active bleed, followed by catheter angiography with embolization where indicated.'],['Persistent unexplained bleeding','Repeat targeted testing, DAE; intraoperative enteroscopy or segmental resection only in selected refractory cases.']], [4.1*cm,11.2*cm])]
story += [P('Recent advances in endoscopy','H2X')]+bullets(['<b>High-definition and image-enhanced endoscopy:</b> narrow-band imaging, linked-color imaging, blue-light imaging and magnification improve mucosal/vascular lesion characterization.', '<b>Small-bowel platform:</b> VCE, motorized spiral enteroscopy and balloon-assisted enteroscopy allow deeper examination; artificial-intelligence-assisted capsule reading may reduce reading burden but needs clinical oversight.', '<b>Therapeutic haemostasis:</b> through-the-scope clips, over-the-scope clips, endoscopic suturing, Doppler probe guidance, topical haemostatic powders/gels, radiofrequency ablation of GAVE, and EUS-guided vascular therapy in selected situations.', '<b>Resection/third-space techniques:</b> EMR, ESD, endoscopic full-thickness resection, POEM/G-POEM, endoscopic sleeve gastroplasty and endoscopic ultrasound-guided drainage/anastomosis procedures.', '<b>Safety:</b> capsule retention risk in strictures; obtain cross-sectional imaging/patency assessment when indicated.'])]
story += [P('Exam pearl: VCE is diagnostic, not therapeutic. DAE is used to confirm, biopsy and treat a lesion identified or suspected from VCE/imaging.', 'CallX'),PageBreak()]

# 2
story += [P('2. Chronic Constipation and Mini Gastric Bypass','H1X')]
story += [P('Surgery for chronic constipation','H2X'),P('Operate only after <b>documented, medically refractory disease</b> and careful phenotyping. Exclude secondary causes, medication effect, eating disorder and pelvic-floor dysfunction. Document colonic transit, anorectal manometry, balloon expulsion test and defecography as appropriate.', 'BodyX')]
story += [table([['Disorder','Procedure and key point'],['Slow-transit constipation / colonic inertia with normal pelvic-floor function','Total abdominal colectomy with ileorectal anastomosis (preferred definitive operation). Counsel regarding diarrhoea, urgency, obstruction and possible persistent pain.'],['Isolated megarectum / megacolon','Tailored resection; restorative proctocolectomy with ileal pouch-anal anastomosis or end ileostomy in selected severe disease.'],['Obstructed defecation due to rectocele, intussusception or prolapse','Treat structural defect: rectocele repair, ventral mesh rectopexy for appropriate prolapse/intussusception. STARR is selective and not for generalized constipation.'],['Pelvic-floor dyssynergia','Biofeedback is first-line. Surgery is generally inappropriate unless an anatomical lesion coexists.'],['Severe refractory disease / unsuitable for anastomosis','Diverting ileostomy as a diagnostic or definitive option in highly selected patients.']], [4.7*cm,10.6*cm]),P('Avoid segmental colectomy unless a convincing segmental transit abnormality exists. Psychological assessment and informed counselling are essential.', 'CallX')]
story += [P('Mini gastric bypass / one-anastomosis gastric bypass (OAGB)','H2X'),P('<b>Concept:</b> A long narrow gastric pouch is anastomosed to jejunum as a loop gastrojejunostomy, producing restriction plus malabsorption. “Mini gastric bypass” is commonly termed OAGB.', 'BodyX')]
story += bullets(['<b>Indications:</b> metabolic/bariatric surgery criteria under specialist multidisciplinary assessment, typically obesity with failure of nonsurgical treatment; choose procedure individually considering diabetes, reflux, nutritional risk and local guidelines.', '<b>Key operative steps:</b> create long gastric pouch along lesser curve; measure biliopancreatic limb according to protocol; antecolic gastrojejunostomy; leak test and close mesenteric defects as appropriate.', '<b>Advantages:</b> single anastomosis, technically simpler than Roux-en-Y, effective weight loss and improvement in type 2 diabetes.', '<b>Complications:</b> bleeding, leak, gastrojejunostomy stricture, marginal ulcer, bile reflux gastritis/oesophagitis, internal hernia, diarrhoea, protein-calorie malnutrition and micronutrient deficiency.', '<b>Follow-up:</b> lifelong dietary review, protein intake, multivitamin/mineral supplementation, and surveillance of iron, B12, folate, calcium, vitamin D, albumin and other deficiencies.'])]
story += [P('Exam pearl: “Metabolic surgery” is not simply weight-loss surgery. State metabolic benefits, multidisciplinary selection and lifelong nutritional follow-up.', 'CallX'),PageBreak()]

# 3
story += [P('3. Wounds, Skin, Nutrition, Shock and Transfusion','H1X')]
story += [P('Wounds and closure','H2X'),table([['Classification','Examples / implication'],['Clean (Class I)','Uninfected elective wound; no entry into respiratory, alimentary, genital or urinary tract.'],['Clean-contaminated (Class II)','Controlled entry into hollow viscus without unusual contamination.'],['Contaminated (Class III)','Fresh traumatic wound, major break in asepsis, gross spillage from GI tract, acute nonpurulent inflammation.'],['Dirty/infected (Class IV)','Old traumatic wound with devitalized tissue, established infection, perforated viscus.']], [4.1*cm,11.2*cm])]
story += bullets(['<b>Primary closure:</b> immediate approximation after haemostasis, debridement and irrigation. Suitable for clean wounds and selected clean-contaminated wounds.', '<b>Delayed primary closure (tertiary intention):</b> leave open initially for repeated inspection/debridement; close after approximately 3-5 days when clean. Useful in contaminated wounds.', '<b>Secondary intention:</b> wound granulates, contracts and epithelializes. For infected wounds, tissue loss, or when closure would trap contamination.', '<b>Techniques:</b> sutures, staples, adhesive strips, tissue adhesive. Use tension-free layered closure, obliterate dead space, and consider drain only for a defined indication.'])]
story += [P('Skin: blood supply and function','H2X')]+bullets(['<b>Blood supply:</b> segmental cutaneous perforators form a deep fascial plexus, subdermal plexus and dermal capillary loops. Random-pattern flaps depend on subdermal plexus; axial flaps have a named direct vessel. Venous outflow is through superficial and deep plexuses.', '<b>Functions:</b> barrier to water loss/microorganisms/trauma; thermoregulation (sweat, vasodilation/constriction); sensation; vitamin D synthesis; immune surveillance; excretion and social/appearance roles.'])]
story += [P('Nutritional indices','H2X')]+bullets(['<b>Clinical:</b> weight loss, BMI, muscle wasting, temporal wasting, oedema, dietary history and functional grip strength.', '<b>Anthropometry:</b> percentage weight loss, mid-arm circumference, triceps skinfold, mid-arm muscle circumference.', '<b>Laboratory:</b> albumin (affected by inflammation and fluid status), prealbumin/transthyretin (shorter half-life but also inflammation-sensitive), transferrin, total lymphocyte count, CRP, electrolytes and micronutrients. Use validated screening tools such as MUST/NRS-2002.'])]
story += [P('Shock and massive transfusion','H2X'),P('<b>Shock:</b> acute circulatory failure causing inadequate tissue oxygen delivery and cellular hypoxia. Types: hypovolaemic (haemorrhagic/non-haemorrhagic), cardiogenic, distributive (septic, anaphylactic, neurogenic) and obstructive (tamponade, pulmonary embolism, tension pneumothorax).', 'BodyX')]
story += [P('<b>Case diagnosis:</b> decompensated haemorrhagic (hypovolaemic) shock due to major blood loss, with severe anaemia. Tachycardia, hypotension, cold peripheries and altered perfusion must be treated as life-threatening trauma until proven otherwise.', 'CallX')]
story += bullets(['<b>Immediate management:</b> trauma ABCDE, call senior help and activate MTP; control external bleeding with pressure/tourniquet/pelvic binder where indicated; high-flow oxygen, warming, two large-bore IV or rapid infuser access; send blood for group/crossmatch, CBC, coagulation, fibrinogen, blood gas/lactate.', '<b>Resuscitation:</b> warmed balanced blood components per local MTP, limit crystalloids, early tranexamic acid in eligible trauma patients, calcium replacement and active warming. Use permissive hypotension only when appropriate and not in traumatic brain injury. Obtain definitive haemorrhage control: theatre, interventional radiology or damage-control surgery.', '<b>Massive transfusion:</b> commonly defined as replacement of one blood volume within 24 h, or ≥10 units packed RBC within 24 h. Practical dynamic definitions include ≥4 units RBC in 1 h with ongoing need or ≥3 units RBC in 1 h. Follow local policy.'])]
story += [P('Transfusion complications','H2X')]+bullets(['<b>Acute immune:</b> acute haemolytic reaction, febrile non-haemolytic reaction, allergic/anaphylactic reaction.', '<b>Acute non-immune:</b> TACO, TRALI, bacterial sepsis, hypothermia, citrate-induced hypocalcaemia, hyperkalaemia, dilutional coagulopathy and acidosis.', '<b>Delayed:</b> delayed haemolysis/alloimmunization, transfusion-transmitted infection, iron overload, post-transfusion purpura and transfusion-associated graft-versus-host disease. <b>Action:</b> stop transfusion, keep IV line with saline, recheck identity, support ABCs, notify blood bank and send required samples/bag.']),PageBreak()]

# 4
story += [P('4. Lesser Sac, Neck and Pleomorphic Adenoma','H1X')]
story += [P('Lesser sac (omental bursa): anatomy and surgical importance','H2X')]+bullets(['A peritoneal recess behind the stomach and lesser omentum. <b>Anterior:</b> stomach, lesser omentum, gastrocolic ligament. <b>Posterior:</b> pancreas, left kidney/adrenal, transverse mesocolon. <b>Superior:</b> caudate lobe of liver and diaphragm. <b>Inferior:</b> transverse colon/mesocolon. <b>Left:</b> spleen and gastrosplenic/splenorenal ligaments.', '<b>Entrance:</b> epiploic (omental) foramen. Anterior boundary: hepatoduodenal ligament containing portal triad; posterior: IVC; superior: caudate lobe; inferior: first part of duodenum.', '<b>Surgical relevance:</b> access the posterior stomach/pancreas via gastrocolic ligament; drain lesser-sac collections/pseudocysts; assess posterior gastric perforation; Pringle manoeuvre compresses hepatoduodenal ligament; internal herniation can occur through epiploic foramen.'])]
story += [P('Triangles of the neck','H2X'),table([['Triangle','Boundaries / important contents'],['Anterior triangle','Midline, anterior border of SCM, lower border mandible. Subdivisions: submental, submandibular (digastric), carotid and muscular triangles. Contents include submandibular gland, carotid sheath, thyroid, larynx/trachea.'],['Posterior triangle','Posterior SCM, anterior trapezius, middle third clavicle. Divided by inferior belly omohyoid into occipital and supraclavicular triangles. Contents: spinal accessory nerve, external jugular vein, brachial plexus roots, subclavian vessels.']], [4.0*cm,11.3*cm])]
story += [P('Neck dissection','H2X')]+bullets(['<b>Radical neck dissection:</b> levels I-V lymph nodes plus sternocleidomastoid, internal jugular vein and spinal accessory nerve.', '<b>Modified radical neck dissection:</b> levels I-V with preservation of one or more of those non-lymphatic structures.', '<b>Selective neck dissection:</b> preservation of one or more lymph-node levels routinely removed in radical dissection, based on primary tumour drainage pattern.', '<b>Extended radical neck dissection:</b> radical procedure plus additional nodal groups or non-lymphatic structures.', '<b>Indications:</b> clinically/radiologically metastatic cervical nodes from head-and-neck malignancy; elective treatment of selected cN0 necks; salvage for persistent/recurrent nodal disease. Complications: chyle leak, haemorrhage, nerve injury, shoulder dysfunction, carotid injury, lymphoedema.'])]
story += [P('Pleomorphic adenoma','H2X')]+bullets(['Most common benign salivary gland tumour, usually parotid. Slow-growing, painless, firm mobile mass. Histology: epithelial/myoepithelial elements in chondromyxoid stroma.', 'Investigate with ultrasound plus fine-needle aspiration cytology; MRI/CT when deep lobe or malignant features suspected. Do <b>not</b> perform open biopsy of a parotid mass.', 'Treatment: superficial parotidectomy (superficial lobe) or appropriate parotidectomy with facial-nerve preservation. Enucleation is avoided because of pseudopodia and recurrence. Long-standing lesions can undergo malignant transformation (carcinoma ex pleomorphic adenoma).']),PageBreak()]

# 5
story += [P('5. TAPP, Laparoscopy and the Space of Bogros','H1X')]
story += [P('TAPP anatomy: what is seen','H2X')]+bullets(['Peritoneal flap exposes the myopectineal orifice. Identify inferior epigastric vessels, deep inguinal ring, spermatic vessels, vas deferens, Cooper ligament, pubic tubercle, iliopubic tract and femoral canal.', '<b>Triangles:</b> triangle of doom lies between vas deferens medially and gonadal vessels laterally, containing external iliac vessels. Triangle of pain lies lateral to gonadal vessels and below iliopubic tract, containing lateral femoral cutaneous and femoral branch of genitofemoral nerve. Avoid tacks here.', '<b>Spaces:</b> Retzius = prevesical medial space. Bogros = lateral preperitoneal space between transversalis fascia and parietal peritoneum, developed for wide mesh placement.'])]
story += [P('Post-TAPP pain case','H2X'),P('<b>Likely diagnosis:</b> chronic postoperative inguinal pain (CPIP), with neuropathic features. Pain radiating to upper medial thigh and hemiscrotum suggests ilioinguinal/genital branch of genitofemoral involvement; tacks or mesh-related inflammation/fibrosis may contribute.', 'BodyX')]
story += [table([['Approach','Key action'],['Assess','Exclude recurrence, seroma, infection, testicular pathology and hip/spine causes. Map sensory distribution; assess neuropathic features.'],['Initial treatment','Explanation, activity modification, simple analgesia/NSAID if appropriate; neuropathic agents under supervision; physiotherapy and pain specialist input.'],['Diagnostic/therapeutic block','Targeted ilioinguinal/iliohypogastric/genitofemoral nerve block can support diagnosis.'],['Refractory disabling pain','Hernia/pain multidisciplinary review. Consider mesh/tack removal and neurectomy only in carefully selected patients by expert surgeons.']], [4.0*cm,11.3*cm])]
story += [P('Other complications of laparoscopic hernia repair','H2X')]+bullets(['Intraoperative: vascular injury, bladder/bowel injury, inferior epigastric injury, conversion to open procedure.', 'Early: haematoma, seroma, urinary retention, port-site infection, ileus, acute pain, scrotal oedema, ischaemic orchitis (rare).', 'Late: recurrence, chronic pain/numbness, mesh infection, mesh migration/erosion, port-site hernia, testicular atrophy (rare).'])]
story += [P('Sterilization of laparoscopic instruments','H2X')]+bullets(['Immediately after use: prevent drying of soil, flush lumens, dismantle per manufacturer instructions, manually clean with enzymatic detergent and soft brushes, rinse and dry. Cleaning is indispensable before disinfection/sterilization.', 'Inspect insulation, jaws, seals and optics; leak-test flexible scopes. Package correctly and use an approved low-temperature sterilization process compatible with device materials, such as hydrogen peroxide gas plasma or ethylene oxide. Steam only for heat-stable instruments. Follow manufacturer instructions, traceability and biological/chemical indicators.', 'Do not rely on surface wiping alone. Inadequate drying or residual organic material defeats sterilization.'])]
story += [P('Exam pearl: in TAPP, no tack placement below the iliopubic tract laterally, because of nerve injury risk.', 'CallX'),PageBreak()]

# 6
story += [P('6. Small-Intestinal Perforation and Typhoid Perforation','H1X')]
story += [P('Causes of small-bowel perforation','H2X')]+bullets(['Trauma: blunt, penetrating, iatrogenic instrumentation. Infection: typhoid, tuberculosis, CMV in immunocompromised patients. Inflammatory: Crohn disease, diverticulitis. Ischaemia/strangulation: obstruction, volvulus, mesenteric ischaemia. Neoplasm, radiation, foreign body, NSAID ulceration and anastomotic leak.'])]
story += [P('Typhoid ileal perforation: pathophysiology','H2X'),P('Salmonella Typhi invades Peyer patches, producing hyperplasia, necrosis and longitudinal oval ulcers along the antimesenteric ileum. Ulcer extension through muscularis causes perforation, usually in the third week of untreated disease, leading to faecal peritonitis and sepsis.', 'BodyX')]
story += [P('Presentation and diagnosis','H2X')]+bullets(['History of fever, malaise, abdominal pain and diarrhoea/constipation followed by sudden worsening abdominal pain, distension, vomiting and obstipation. Examine for toxicity, dehydration, tachycardia, guarding, rigidity and silent abdomen.', 'Investigations: CBC, renal/liver profile, electrolytes, arterial/venous blood gas and lactate, group/crossmatch, blood culture. Erect chest/abdominal radiograph may show free subdiaphragmatic gas; ultrasound may show free fluid; CT is most sensitive if stable and diagnosis uncertain.', 'Diagnosis is mainly clinical in a peritonitic patient: do not delay source control for confirmatory serology.'])]
story += [P('Management principles','H2X')]+bullets(['<b>Resuscitate:</b> ABCDE, oxygen, warming, two IV lines, crystalloids and blood as required, urinary catheter, nasogastric decompression, correction of electrolyte/glucose abnormalities, broad-spectrum antibiotics covering enteric Gram-negative and anaerobic flora, and cultures where feasible.', '<b>Operation:</b> urgent laparotomy/laparoscopy after resuscitation. Suction contamination, peritoneal lavage, locate all perforations, assess ileal viability and lymph nodes. Procedure depends on number/site of perforations, bowel condition and physiology: primary two-layer closure for a single small healthy-edge perforation; segmental resection with anastomosis for multiple/large adjacent perforations or diseased segment; exteriorization/stoma in gross contamination, unstable patient or poor bowel condition.', '<b>Postoperative:</b> ICU/HDU when indicated, culture-directed antibiotics, fluid/electrolyte balance, analgesia, DVT prevention, nutrition, monitor sepsis, wound and anastomotic/stoma complications.'])]
story += [P('Complications','H2X')]+bullets(['Septic shock, residual intra-abdominal abscess, wound infection/dehiscence, enterocutaneous fistula, burst abdomen, prolonged ileus, anastomotic leak, stoma complications, incisional hernia and death.'])]
story += [P('Rapid 15-mark answer skeleton','H2X'),P('<b>Definition/causes (2) → pathophysiology (2) → features and investigations (3) → resuscitation (3) → operative options (3) → postoperative complications (2).</b>', 'CallX')]

# sources
story += [Spacer(1,8),P('Selected sources for revision','H1X'),P('Textbook foundations: <i>Bailey and Love’s Short Practice of Surgery</i>, 28th ed., sections on typhoid and laparoscopic hernia repair; <i>Clinical Gastrointestinal Endoscopy</i>, 3rd ed., sections on video capsule and device-assisted enteroscopy; <i>Pye’s Surgical Handicraft</i>, 22nd ed., sections on blood transfusion and wound closure; <i>Cummings Otolaryngology</i>, sections on neck dissection and pleomorphic adenoma.', 'SmallX'),P('Current practice supplement: American Society for Gastrointestinal Endoscopy guideline, “The role of endoscopy in the management of suspected small-bowel bleeding” (2017). Recent systematic-review literature was checked for capsule safety, chronic constipation surgery and metabolic/bariatric surgery. This guide is for study use and does not replace institutional protocols.', 'SmallX')]

doc=SimpleDocTemplate(OUT,pagesize=A4,rightMargin=1.45*cm,leftMargin=1.45*cm,topMargin=1.45*cm,bottomMargin=1.3*cm,title='General Surgery Concise Study Guide',author='Orris')
doc.build(story,onFirstPage=header_footer,onLaterPages=header_footer)
print(OUT)
Running Command

python "/tmp/workspace/general-surgery-study-guide/src/create_guide.py" && python -c "from pypdf import PdfReader; p='/tmp/workspace/general-surgery-study-guide/output/General_Surgery_Concise_Study_Guide.pdf'; r=PdfReader(p); print('pages',len(r.pages)); print('chars',sum(len(x.extract_text() or '') for x in r.pages))"

Searching Content

"])]" in ~/general-surgery-study-guide/src

Reading File
Running Command

python -c "p='/tmp/workspace/general-surgery-study-guide/src/create_guide.py'; s=open(p).read(); s=s.replace(']))]', '])]'); open(p,'w').write(s)" && python -m py_compile "/tmp/workspace/general-surgery-study-guide/src/create_guide.py" && python "/tmp/workspace/general-surgery-study-guide/src/create_guide.py" && python -c "from pypdf import PdfReader; p='/tmp/workspace/general-surgery-study-guide/output/General_Surgery_Concise_Study_Guide.pdf'; r=PdfReader(p); print('pages',len(r.pages)); print('chars',sum(len(x.extract_text() or '') for x in r.pages))"

Editing File

~/general-surgery-study-guide/src/create_guide.py

Successfully replaced 16 instance(s) of the string in '/tmp/workspace/general-surgery-study-guide/src/create_guide.py'
Running Command

python -m py_compile "/tmp/workspace/general-surgery-study-guide/src/create_guide.py" && python "/tmp/workspace/general-surgery-study-guide/src/create_guide.py" && python -c "from pypdf import PdfReader; p='/tmp/workspace/general-surgery-study-guide/output/General_Surgery_Concise_Study_Guide.pdf'; r=PdfReader(p); print('pages',len(r.pages)); print('chars',sum(len(x.extract_text() or '') for x in r.pages)); print((r.pages[0].extract_text() or '')[:300])"

Reading File
Searching Content

"),PageBreak()]" in ~/general-surgery-study-guide/src

Editing File

~/general-surgery-study-guide/src/create_guide.py

Successfully replaced 2 instance(s) of the string in '/tmp/workspace/general-surgery-study-guide/src/create_guide.py'
Running Command

python -m py_compile "/tmp/workspace/general-surgery-study-guide/src/create_guide.py" && python "/tmp/workspace/general-surgery-study-guide/src/create_guide.py" && python -c "from pypdf import PdfReader; p='/tmp/workspace/general-surgery-study-guide/output/General_Surgery_Concise_Study_Guide.pdf'; r=PdfReader(p); print('pages',len(r.pages)); print('chars',sum(len(x.extract_text() or '') for x in r.pages)); print((r.pages[0].extract_text() or '')[:220])"

Created an 8-page concise General Surgery exam study guide covering all listed questions, including structured definitions, classifications, diagnostic approaches, operative principles, complications, and exam pearls.

General Surgery Concise Study Guide

PDF Document · PDF

Add diagrams and flowcharts for the key surgical answers

Reading File
Reading File
Browsing Directory

~/general-surgery-study-guide/

Searching the Web

surgical anatomy and management flowcharts obscure gastrointestinal bleeding hemorrhagic shock TAPP typhoid intestinal perforation authoritative guidelines

Searching Images

diagram lesser sac anatomy boundaries surgical anatomy

Searching Images

inguinal region posterior wall TAPP laparoscopic anatomy triangle of doom triangle of pain diagram

Searching Images

neck triangles anatomy diagram levels neck dissection

Finding Sources
Finding Sources
Reading File
Reading File
Writing File

.../src/create_visual_supplement.py

from reportlab.lib.pagesizes import A4
from reportlab.pdfgen import canvas
from reportlab.lib.colors import HexColor, white, black
from reportlab.lib.units import cm
from reportlab.pdfbase.pdfmetrics import stringWidth

OUT='/tmp/workspace/general-surgery-study-guide/output/Illustrated_Surgical_Diagrams_and_Flowcharts.pdf'
W,H=A4
NAVY=HexColor('#163A5F'); TEAL=HexColor('#147D80'); BLUE=HexColor('#2A6F97'); PALE=HexColor('#EAF3F7'); GREY=HexColor('#F4F6F7'); RED=HexColor('#9E2A2B'); GREEN=HexColor('#DDEFEA'); AMBER=HexColor('#FFF0D6'); LINE=HexColor('#8AA3B0')

def header(c,title,page):
    c.setFillColor(NAVY); c.rect(0,H-1.55*cm,W,1.55*cm,fill=1,stroke=0)
    c.setFillColor(white); c.setFont('Helvetica-Bold',14); c.drawString(1.35*cm,H-0.94*cm,title)
    c.setFillColor(HexColor('#516B79')); c.setFont('Helvetica',7.5); c.drawRightString(W-1.25*cm,0.7*cm,f'Illustrated Surgical Revision | {page}')

def wrap(c,text,x,y,maxw,font='Helvetica',size=8.2,leading=10.2,color=black,center=False):
    c.setFillColor(color); c.setFont(font,size); words=text.split(); lines=[]; line=''
    for wd in words:
        t=(line+' '+wd).strip()
        if stringWidth(t,font,size)<=maxw: line=t
        else: lines.append(line); line=wd
    if line: lines.append(line)
    for ln in lines:
        tx=x+(maxw-stringWidth(ln,font,size))/2 if center else x
        c.drawString(tx,y,ln); y-=leading
    return y

def box(c,x,y,w,h,text,fill=PALE,stroke=TEAL,fs=8.2):
    c.setFillColor(fill); c.setStrokeColor(stroke); c.setLineWidth(1)
    c.roundRect(x,y,w,h,7,fill=1,stroke=1)
    lines=[]; words=text.split(); line=''
    for wd in words:
        t=(line+' '+wd).strip()
        if stringWidth(t,'Helvetica-Bold',fs)<=w-12: line=t
        else: lines.append(line); line=wd
    if line: lines.append(line)
    total=len(lines)*(fs+2)
    yy=y+h/2+total/2-fs
    c.setFillColor(NAVY); c.setFont('Helvetica-Bold',fs)
    for ln in lines:
        c.drawCentredString(x+w/2,yy,ln); yy-=fs+2

def arrow(c,x1,y1,x2,y2,label=None):
    c.setStrokeColor(NAVY); c.setFillColor(NAVY); c.setLineWidth(1.4); c.line(x1,y1,x2,y2)
    import math
    a=math.atan2(y2-y1,x2-x1); s=7
    c.line(x2,y2,x2-s*math.cos(a-0.45),y2-s*math.sin(a-0.45)); c.line(x2,y2,x2-s*math.cos(a+0.45),y2-s*math.sin(a+0.45))
    if label:
        c.setFont('Helvetica',7); c.setFillColor(NAVY); c.drawCentredString((x1+x2)/2,(y1+y2)/2+4,label)

def note(c,text,y):
    c.setFillColor(HexColor('#FCEDEC')); c.setStrokeColor(RED); c.roundRect(1.35*cm,y,W-2.7*cm,0.72*cm,5,fill=1,stroke=1)
    wrap(c,text,1.55*cm,y+0.43*cm,W-3.1*cm,'Helvetica-Bold',7.6,9,RED)

c=canvas.Canvas(OUT,pagesize=A4)
# page 1 GI flow
header(c,'1. Suspected Small-Bowel Bleeding: Evaluation Algorithm',1)
y=H-3.0*cm
box(c,5.0*cm,y,11*cm,1.05*cm,'Overt or occult bleeding / iron-deficiency anaemia',AMBER,HexColor('#B87500')); y-=1.7*cm
box(c,5.0*cm,y,11*cm,1.05*cm,'Resuscitate if unstable + CBC, coagulation, iron studies; review drugs and comorbidity'); arrow(c,10.5*cm,y,10.5*cm,y-0.65*cm); y-=1.7*cm
box(c,5.0*cm,y,11*cm,1.05*cm,'High-quality EGD + colonoscopy negative or non-diagnostic'); arrow(c,10.5*cm,y,10.5*cm,y-0.65*cm); y-=1.7*cm
box(c,5.0*cm,y,11*cm,1.05*cm,'Reconsider repeat endoscopy if examination or bowel preparation was inadequate'); arrow(c,10.5*cm,y,10.5*cm,y-0.65*cm); y-=1.7*cm
box(c,1.4*cm,y,8.1*cm,1.15*cm,'Stable: Video capsule endoscopy (VCE) first-line'); box(c,11.4*cm,y,8.1*cm,1.15*cm,'Brisk active bleeding / instability: CTA -> catheter angiography +/- embolization',HexColor('#FCEDEC'),RED)
arrow(c,5.45*cm,y,5.45*cm,y-0.75*cm); arrow(c,15.45*cm,y,15.45*cm,y-0.75*cm); y-=1.95*cm
box(c,1.4*cm,y,8.1*cm,1.3*cm,'Lesion on VCE or ongoing high suspicion -> device-assisted enteroscopy: biopsy, haemostasis, tattoo or retrieve capsule'); box(c,11.4*cm,y,8.1*cm,1.3*cm,'Mass / Crohn disease / suspected stricture -> CT or MR enterography; consider patency capsule before VCE')
note(c,'Exam line: VCE is diagnostic. Device-assisted enteroscopy is diagnostic and therapeutic. In selected refractory cases, use intraoperative enteroscopy or resection.',3.0*cm)
c.showPage()
# page 2 shock
header(c,'2. Haemorrhagic Shock and Massive Transfusion: First-Hour Flowchart',2)
box(c,2.4*cm,H-3.0*cm,16.2*cm,1.1*cm,'Recognize haemorrhagic shock: hypotension + tachycardia + cold peripheries + impaired perfusion',HexColor('#FCEDEC'),RED)
steps=[('ABCDE + call trauma/surgical team','Protect airway, high-flow oxygen; expose patient, prevent hypothermia.'),('Control haemorrhage','Direct pressure, tourniquet, pelvic binder if indicated; urgent theatre or interventional radiology.'),('Access and investigations','Two large-bore IVs or rapid infuser. CBC, group/crossmatch, PT/INR, fibrinogen, ABG/lactate.'),('Activate MTP','Give warmed balanced components according to institutional MTP. Minimize unnecessary crystalloid.'),('Correct lethal triad','Warm patient and blood, give calcium, monitor/treat coagulopathy, acidosis and hyperkalaemia.'),('Reassess repeatedly','Pulse, mental state, BP, urine output, lactate and ongoing blood loss. Obtain definitive haemorrhage control.')]
y=H-4.65*cm
for i,(a,b) in enumerate(steps):
    box(c,1.35*cm,y,4.3*cm,1.05*cm,f'{i+1}. {a}',GREEN,TEAL)
    c.setFillColor(black); wrap(c,b,6.1*cm,y+0.69*cm,13.2*cm,'Helvetica',8.8,11)
    if i<len(steps)-1: arrow(c,3.5*cm,y,3.5*cm,y-0.45*cm)
    y-=1.35*cm
note(c,'Massive transfusion: commonly >=10 units RBC in 24 h or one blood volume in 24 h. Dynamic definitions such as >=4 RBC units in 1 h with ongoing bleeding are more actionable. Follow the local protocol.',2.0*cm)
c.showPage()
# page 3 anatomy
header(c,'3. Surgical Anatomy: Lesser Sac and Neck Triangles',3)
c.setFont('Helvetica-Bold',11); c.setFillColor(TEAL); c.drawString(1.35*cm,H-2.5*cm,'A. Lesser sac (omental bursa): schematic sagittal relation')
# lesser sac diagram
c.setFillColor(HexColor('#FCE2C8')); c.ellipse(5.7*cm,H-7.2*cm,14.5*cm,H-3.55*cm,fill=1,stroke=1); c.setFillColor(NAVY); c.setFont('Helvetica-Bold',9); c.drawCentredString(10.1*cm,H-5.45*cm,'STOMACH')
c.setFillColor(HexColor('#F5C7BE')); c.roundRect(7.0*cm,H-9.05*cm,6.2*cm,1.0*cm,7,fill=1,stroke=1); c.setFillColor(NAVY); c.drawCentredString(10.1*cm,H-8.5*cm,'PANCREAS (posterior)')
c.setFillColor(PALE); c.roundRect(7.05*cm,H-7.85*cm,6.1*cm,0.65*cm,4,fill=1,stroke=1); c.setFillColor(TEAL); c.drawCentredString(10.1*cm,H-7.57*cm,'LESSER SAC')
c.setStrokeColor(NAVY); c.line(4.7*cm,H-4.0*cm,4.7*cm,H-8.9*cm); c.setFont('Helvetica',7.5); c.drawRightString(4.5*cm,H-4.3*cm,'Anterior:'); c.drawRightString(4.5*cm,H-4.65*cm,'stomach, lesser'); c.drawRightString(4.5*cm,H-5.0*cm,'omentum, gastrocolic'); c.drawRightString(4.5*cm,H-5.35*cm,'ligament')
c.drawString(14.9*cm,H-8.35*cm,'Posterior: pancreas,'); c.drawString(14.9*cm,H-8.7*cm,'left kidney/adrenal,'); c.drawString(14.9*cm,H-9.05*cm,'transverse mesocolon')
c.setFont('Helvetica-Bold',8); c.setFillColor(RED); c.drawCentredString(10.1*cm,H-10.15*cm,'Foramen of Winslow -> gateway to lesser sac')
c.setFont('Helvetica-Bold',11); c.setFillColor(TEAL); c.drawString(1.35*cm,H-11.3*cm,'B. Neck triangles: high-yield boundaries')
# neck triangle
cx=10.5*cm; top=H-12.0*cm
c.setStrokeColor(NAVY); c.setLineWidth(2); c.line(cx,top,cx-4.0*cm,top-5.5*cm); c.line(cx,top,cx+4.0*cm,top-5.5*cm); c.line(cx-4.0*cm,top-5.5*cm,cx+4.0*cm,top-5.5*cm); c.line(cx,top,cx,top-5.5*cm)
c.setFont('Helvetica',7.3); c.setFillColor(NAVY); c.drawCentredString(cx-2.0*cm,top-2.2*cm,'Anterior triangle'); c.drawCentredString(cx+2.0*cm,top-2.2*cm,'Posterior triangle'); c.drawCentredString(cx,top-5.9*cm,'SCM divides anterior / posterior')
wrap(c,'Anterior triangle: bounded by midline, anterior border of SCM and mandible. Subtriangles: submental, submandibular, carotid, muscular.',1.35*cm,H-15.0*cm,8.2*cm,'Helvetica',7.5,9)
wrap(c,'Posterior triangle: bounded by posterior border of SCM, anterior border of trapezius and clavicle. Subdivided by inferior belly of omohyoid.',11.7*cm,H-15.0*cm,7.8*cm,'Helvetica',7.5,9)
note(c,'Neck dissection map: Levels I-VI guide nodal clearance. Describe whether selective, modified radical or radical, and state structures preserved or sacrificed.',2.0*cm)
c.showPage()
# page 4 TAPP
header(c,'4. TAPP Repair: Myopectineal Orifice and Safe Zones',4)
c.setFont('Helvetica-Bold',11); c.setFillColor(TEAL); c.drawString(1.35*cm,H-2.5*cm,'Posterior laparoscopic view: conceptual map')
# main scene
x=2.0*cm;y=H-12.4*cm;w=17.0*cm;h=8.7*cm
c.setFillColor(HexColor('#F8F3E8')); c.setStrokeColor(NAVY); c.roundRect(x,y,w,h,12,fill=1,stroke=1)
# central structures
c.setStrokeColor(RED); c.setLineWidth(4); c.line(x+6.5*cm,y+h,x+6.5*cm,y); c.setFillColor(RED); c.setFont('Helvetica-Bold',8); c.drawString(x+5.0*cm,y+h-0.4*cm,'Inferior epigastric vessels')
c.setStrokeColor(TEAL); c.setLineWidth(4); c.line(x+10.6*cm,y+0.3*cm,x+12.6*cm,y+h-0.2*cm); c.setFillColor(TEAL); c.drawString(x+11.4*cm,y+h-0.65*cm,'Gonadal vessels')
c.setStrokeColor(NAVY); c.setLineWidth(4); c.line(x+8.0*cm,y+0.4*cm,x+7.0*cm,y+h-0.5*cm); c.setFillColor(NAVY); c.drawString(x+6.0*cm,y+0.55*cm,'Vas deferens')
# zones
c.setFillColor(HexColor('#FCEDEC')); c.setStrokeColor(RED); c.wedge(x+7.0*cm,y+1.0*cm,x+12.6*cm,y+5.5*cm,210,330,fill=1,stroke=1); c.setFillColor(RED); c.setFont('Helvetica-Bold',8); c.drawCentredString(x+10.0*cm,y+3.1*cm,'TRIANGLE OF DOOM'); c.setFont('Helvetica',7); c.drawCentredString(x+10.0*cm,y+2.7*cm,'External iliac vessels')
c.setFillColor(HexColor('#FFF0D6')); c.setStrokeColor(HexColor('#B87500')); c.wedge(x+12.0*cm,y+0.8*cm,x+16.3*cm,y+5.2*cm,190,340,fill=1,stroke=1); c.setFillColor(HexColor('#925F00')); c.setFont('Helvetica-Bold',8); c.drawCentredString(x+14.3*cm,y+2.8*cm,'TRIANGLE OF PAIN'); c.setFont('Helvetica',7); c.drawCentredString(x+14.3*cm,y+2.4*cm,'Nerves: no tacks')
c.setStrokeColor(BLUE); c.setLineWidth(3); c.line(x+0.5*cm,y+1.4*cm,x+w-0.5*cm,y+1.4*cm); c.setFillColor(BLUE); c.setFont('Helvetica-Bold',8); c.drawString(x+0.7*cm,y+1.65*cm,'Iliopubic tract: avoid fixation below this line laterally')
c.setFillColor(TEAL); c.setFont('Helvetica-Bold',8); c.drawString(x+0.8*cm,y+6.7*cm,'Medial: Retzius space / Cooper ligament')
c.drawString(x+0.8*cm,y+6.2*cm,'Lateral: Bogros space for broad mesh overlap')
# hernia sites
c.setFillColor(NAVY); c.setFont('Helvetica',8); c.drawString(x+2.0*cm,y+4.3*cm,'Direct') ; c.drawString(x+7.0*cm,y+6.2*cm,'Indirect (deep ring)'); c.drawString(x+3.0*cm,y+2.3*cm,'Femoral')
note(c,'Pain after TAPP: exclude recurrence, seroma, infection and testicular pathology. Neuropathic radiating pain suggests nerve irritation or fixation injury. Start conservative care; use specialist nerve blocks and expert revision only for refractory disabling pain.',2.0*cm)
c.showPage()
# page 5 typhoid + wound
header(c,'5. Typhoid Ileal Perforation and Wound Closure: Operative Decisions',5)
c.setFont('Helvetica-Bold',11); c.setFillColor(TEAL); c.drawString(1.35*cm,H-2.5*cm,'A. Typhoid ileal perforation: resuscitation-to-operation flowchart')
y=H-3.8*cm
labels=[('Peritonitis with fever / toxic patient','Resuscitate: ABCs, IV fluids and blood as needed, NG decompression, urinary catheter, broad-spectrum antibiotics, correct electrolyte deficit.'),('Confirm and prepare','CBC, renal function, electrolytes, group/crossmatch; erect chest/abdominal radiograph or CT if stable. Do not delay source control in generalized peritonitis.'),('Emergency laparotomy','Assess number/site of perforations, bowel viability, degree of peritoneal contamination and haemodynamic status.'),('Choose operation','Single small perforation + healthy bowel: debridement and transverse two-layer closure. Multiple, large, friable lesions or unhealthy segment: limited ileal resection with anastomosis if stable; diversion may be safer in gross sepsis/poor physiology.'),('Postoperative care','Antibiotics guided by culture/local policy, ICU support as required, fluid/electrolyte and nutritional support; observe for leak, intra-abdominal abscess, wound infection, fistula and sepsis.')]
for i,(a,b) in enumerate(labels):
 box(c,1.35*cm,y,5.1*cm,1.0*cm,a,PALE,TEAL); wrap(c,b,6.8*cm,y+0.69*cm,12.3*cm,'Helvetica',8.3,10.3)
 if i<len(labels)-1: arrow(c,3.9*cm,y,3.9*cm,y-0.37*cm)
 y-=1.27*cm
c.setFont('Helvetica-Bold',11); c.setFillColor(TEAL); c.drawString(1.35*cm,H-11.25*cm,'B. Wound closure choice')
box(c,1.4*cm,H-13.0*cm,5.3*cm,1.15*cm,'Clean wound with viable tissue and no tension',GREEN,TEAL); box(c,8.0*cm,H-13.0*cm,5.3*cm,1.15*cm,'Contaminated / dirty wound or doubtful viability',AMBER,HexColor('#B87500')); box(c,14.6*cm,H-13.0*cm,5.3*cm,1.15*cm,'Tissue loss or cannot close without tension',HexColor('#FCEDEC'),RED)
arrow(c,4.05*cm,H-13.0*cm,4.05*cm,H-13.75*cm); arrow(c,10.65*cm,H-13.0*cm,10.65*cm,H-13.75*cm); arrow(c,17.25*cm,H-13.0*cm,17.25*cm,H-13.75*cm)
box(c,1.4*cm,H-15.0*cm,5.3*cm,0.95*cm,'Primary closure: suture, staple or adhesive for appropriate superficial wounds',PALE,TEAL,7.5); box(c,8.0*cm,H-15.0*cm,5.3*cm,0.95*cm,'Delayed primary closure after debridement, irrigation and observation',AMBER,HexColor('#B87500'),7.5); box(c,14.6*cm,H-15.0*cm,5.3*cm,0.95*cm,'Secondary intention, graft or flap after wound-bed optimization',HexColor('#FCEDEC'),RED,7.5)
note(c,'Principles: asepsis, haemostasis, debridement, eliminate dead space, preserve perfusion, approximate without tension and select absorbable/non-absorbable material based on tissue and required support.',2.0*cm)
c.save()
print(OUT)
Running Command

python -m py_compile "/tmp/workspace/general-surgery-study-guide/src/create_visual_supplement.py" && python "/tmp/workspace/general-surgery-study-guide/src/create_visual_supplement.py" && python -c "from pypdf import PdfReader, PdfWriter; base='/tmp/workspace/general-surgery-study-guide/output/General_Surgery_Concise_Study_Guide.pdf'; sup='/tmp/workspace/general-surgery-study-guide/output/Illustrated_Surgical_Diagrams_and_Flowcharts.pdf'; out='/tmp/workspace/general-surgery-study-guide/output/General_Surgery_Illustrated_Study_Guide.pdf'; w=PdfWriter(); [w.add_page(p) for f in [base,sup] for p in PdfReader(f).pages]; w.add_metadata({'/Title':'General Surgery Illustrated Study Guide','/Subject':'Concise surgical revision with diagrams and flowcharts'}); w.write(out); r=PdfReader(out); print('pages',len(r.pages)); print('text chars',sum(len(p.extract_text() or '') for p in r.pages)); print('exists',out)"

Reading File
Running Command

python -c "import fitz; p='/tmp/workspace/general-surgery-study-guide/output/Illustrated_Surgical_Diagrams_and_Flowcharts.pdf'; d=fitz.open(p); page=d[3]; pix=page.get_pixmap(matrix=fitz.Matrix(1.5,1.5),alpha=False); pix.save('/tmp/workspace/general-surgery-study-guide/output/tapp_preview.png'); print('rendered', pix.width, pix.height)"

Added a 5-page illustrated supplement and merged it with the original guide.
It includes:
  • Suspected small-bowel bleeding diagnostic flowchart
  • Haemorrhagic shock and massive transfusion first-hour algorithm
  • Lesser sac schematic and neck-triangle diagram
  • TAPP safe-zone diagram: myopectineal orifice, triangle of doom, triangle of pain, Retzius and Bogros spaces
  • Typhoid ileal perforation management flowchart
  • Wound-closure decision flowchart

General Surgery Illustrated Study Guide

PDF Document · PDF

This is a shared conversation. Sign in to Orris to start your own chat.