Isko explains kr skta without ek word chode kahi se bhi agar ponch lu to Bol bta ??

Reading File
Running Command

cd /tmp/workspace/attachments/65881b94-4175-4a4b-ba5c-ca6635cd7192/ && python3 -c " import pdfplumber pdf_path = 'Surgery Part 1 - Hyperrevision l @AnandxBotss.pdf' with pdfplumber.open(pdf_path) as pdf: print(f'Total pages: {len(pdf.pages)}') # Extract first 5 pages to see what's in it for i, page in enumerate(pdf.pages[:5]): print(f'\n=== PAGE {i+1} ===') text = page.extract_text() if text: print(text[:2000]) else: print('[No text extracted]') "

Running Command

cd /tmp/workspace/attachments/65881b94-4175-4a4b-ba5c-ca6635cd7192/ && python3 -c " import pdfplumber pdf_path = 'Surgery Part 1 - Hyperrevision l @AnandxBotss.pdf' with pdfplumber.open(pdf_path) as pdf: for i, page in enumerate(pdf.pages[5:]): print(f'\n=== PAGE {i+6} ===') text = page.extract_text() if text: print(text) else: print('[No text extracted]') "

Ab poora content aa gaya. Ye 19-page Surgery Hyperrevision notes hain - Cerebellum's 20th Course ka Part 1. Main isko topic-by-topic simple Hindi-English (Hinglish) mein explain karta hoon.

πŸ₯ Surgery Part 1 - Hyperrevision: Complete Explanation

Ye notes Gastrointestinal Tract (GIT) surgery ke topics cover karte hain. Poora content neeche explain hai:

πŸ“Œ 1. ESOPHAGEAL DISORDERS

πŸ”Ή ACHALASIA CARDIA

Kya hai? Esophagus ka MC motility disorder. Lower esophageal sphincter (LES) relax nahi karta aur peristalsis absent ho jaata hai.
Kaun? Middle-aged female (30-60 years)
Classic Triad:
  1. Dysphagia - Liquids > Solids (KEY point! Malignancy mein solids > liquids)
  2. Regurgitation - khana wapas aata hai
  3. Weight loss
Yaad karo - "Three Cities of Esophagus":
  • Chicago = Manometry classification (Achalasia)
  • Montreal = Definition of GERD
  • LA (Los Angeles) = Grading of GERD
Risk factors:
  • Allgrove Syndrome (AAA): Adrenal insufficiency + Alacrymia (no tears) + Achalasia
  • Chagas disease: Trypanosoma cruzi infection
Investigations:
  • 1st step: UGI Endoscopy (malignancy/stricture rule out karo)
  • IOC: Esophageal Manometry (HRM) - Absent peristalsis + Elevated LES pressure
Chicago Classification (Manometry types):
TypeFindingsKey
Type 1 (MC)Absent peristalsis + High LES pressureBoth must be present
Type 2Type 1 + Pan-esophageal pressurization β‰₯20%Best treatment response
Type 3 (Spastic)Type 1 + Premature spasmsTOC = POEM
Treatment:
  • Mild/Unfit: CCBs / Botox injection / Pneumatic dilatation (NOT definitive)
  • Definitive TOC (Type 1 & 2): Heller's Cardiomyotomy (6-7 cm esophagus + 2 cm stomach)
  • Type 3: POEM (Per Oral Endoscopic Myotomy)

πŸ”Ή DIFFUSE ESOPHAGEAL SPASM (DES)

  • Barium: Corkscrew appearance
  • IOC: Manometry
  • TOC: POEM (long myotomy)

πŸ”Ή ZENKER'S DIVERTICULUM (Pharyngeal Pouch)

  • False diverticulum (sirf mucosa herniates)
  • Through Killian's dehiscence (inferior constrictor ka weak spot)
  • Direction: Posteriorly herniates
  • Features: Halitosis + Regurgitation (food collects in pouch)
  • Barium (lateral view): Posterior outpouching in neck
  • Treatment: Dohlman procedure (endoscopic) ya Stapled diverticulopexy

πŸ”Ή SCHATZKI RING

  • Barium: Single-point narrowing at GE junction with hiatal hernia
  • Associated with GERD/Hiatus hernia

πŸ”Ή GERD (Gastroesophageal Reflux Disease)

  • Montreal definition: Reflux causing "troublesome symptoms"
  • Who: Young male or female
  • Triggers: Smoking, alcohol, tea, coffee, stress
Features:
  • Heartburn (MC/earliest)
  • Regurgitation (LATE feature = advanced GERD)
  • Atypical: Chronic cough, laryngitis, dental erosions, asthma
Investigations:
TestRole
UGI Endoscopy1st step - visualize erosions; LA grading A-D
24-hr pH StudyGold Standard; DeMeester score >14.7 = positive
24-hr pH kab karo? Atypical symptoms mein, before surgery
Treatment:
  • TOC: PPI + Lifestyle modifications (4-8 weeks)
  • Surgery kab? Intractable GERD / Complications (Barrett's, hiatus hernia)
Anti-Reflux Surgeries (Fundoplications):
ProcedureWrapKey Points
Nissen (Floppy)360Β° completeMC complication: Short-term dysphagia (<3 months)
Toupet270Β° posteriorLess dysphagia; commonly done now
Dor180Β° anterior-

πŸ”Ή HIATUS HERNIA

  • Defect = Esophageal hiatus of diaphragm
  • IOC: CT with oral contrast (ya Barium meal)
Types:
TypeFeatureAssociation
Type 1: Sliding (MC)GE junction slides into chest; muscle weaknessGERD
Type 2: Rolling (Paraesophageal)Fundus herniates beside esophagus; GE junction normalNot GERD
Type 3: MixedBoth GE junction + fundus herniateGERD + weakness

πŸ”Ή BARRETT'S ESOPHAGUS

Kya hai? Chronic GERD ke kaaran squamous epithelium β†’ columnar/intestinal epithelium (metaplasia)
Risk: Adenocarcinoma (cancer banne ka risk)
Endoscopy: Tongue-like projections at GE junction (salmon-pink) β€” ye erosions NAHI hain
Seattle Biopsy Protocol: 4-quadrant biopsies at 2 cm intervals (bottom to top) - koi dysplastic area miss na ho
Management by Dysplasia:
DysplasiaCancer RiskTreatment
No dysplasia0.2-0.5%/yearTreat GERD (PPI + LSM)
Low grade0.7%/yearEMR / RFA
High grade7%/yearExcision + Surveillance

πŸ”Ή ESOPHAGEAL PERFORATION & CORROSIVE INJURY

Sites of esophageal narrowing:
  • 15 cm: Cricopharyngeal sphincter (MC site of perforation)
  • 25 cm: Left bronchus / Arch of aorta
  • 40 cm: Diaphragmatic pinch
Boerhaave Syndrome (Spontaneous Perforation):
  • Cause: Alcohol binge β†’ forceful vomiting β†’ esophagus bursts
  • Site: Left lower esophagus (weak area)
  • Mackler's Triad: Chest pain + Retching + Subcutaneous emphysema
  • IOC: CT with water-soluble contrast (NOT barium - barium toxic hai leak hone par)
Surgery kab: Boerhaave, unstable patient, sepsis, mediastinitis, intra-abdominal perforation
Corrosive Injury:
AcidAlkali (WORSE)
NecrosisCoagulation (shallow)Liquefaction (deep)
DepthLimited by escharDeeper penetration
  • Management: Stabilize β†’ Careful UGI Endoscopy β†’ Zargar grading
  • Severe: Artificial nutrition (NG feeds)

πŸ”Ή ESOPHAGEAL CANCER

"Golden Rule - All GI Cancers:" Elderly Male Smoker β†’ Think malignancy
  • Dysphagia: Painless, progressive, solids > liquids (contrast with Achalasia: liquids > solids)
  • Pseudoachalasia = Same triad as Achalasia but in malignancy
Investigations:
  • Diagnosis: UGI Endoscopy + Biopsy (1st step & IOC)
  • Local staging: EUS (depth of invasion, T-stage)
  • Distant staging: PET Scan
T-Staging:
  • T1a: Mucosa | T1b: Mucosa + Submucosa | T2: Muscularis | T3: Adventitia
  • T4a: Resectable adjacent organs | T4b: Unresectable (trachea/aorta) = Inoperable

πŸ“Œ 2. STOMACH & DUODENUM

πŸ”Ή CA STOMACH

  • Type: Adenocarcinoma | MC site: Antrum (H. pylori yahan rehta hai)
  • Risk factors (4S + 1D): Smoking, Spirits (alcohol), Sepsis (H. pylori), Smoked foods/Soya sauce, Diet
Signs of Metastasis:
SignLocation
Virchow's nodeLeft supraclavicular LN
Sister Mary Joseph nodulePara-umbilical nodule
Krukenberg tumourBilateral ovarian metastasis
Irish nodeLeft axillary LN
H. pylori ke 3 consequences:
  1. Chronic Gastritis
  2. Peptic Ulcers
  3. Stomach Cancer (Adenocarcinoma + MALT lymphoma)
Diagnosis: UGI Endoscopy + Biopsy (1st step & IOC) Local staging: EUS | Distant: PET Scan
Surgery: Radical Gastrectomy (subtotal/total) + D2 Lymphadenectomy
  • D1 = Stations 1-6 (perigastric nodes)
  • D2 = D1 + Stations 7-11 (named vessels)
  • Chemotherapy: FLOT regimen (platinum-based)

πŸ”Ή IHPS (Infantile Hypertrophic Pyloric Stenosis)

  • NOT congenital (presents at 4-8 weeks after birth, NOT at birth)
Clinical features:
  • Age: 4-8 weeks
  • Projectile, non-bilious vomiting after feeds
  • Olive-shaped mass in RUQ (best felt when baby relaxed/feeding)
  • Visible peristalsis: Left to Right
Investigations:
  • IOC: USG abdomen - thick pylorus (β‰₯4 mm diagnostic)
  • X-ray: Single bubble (grossly dilated stomach)
  • Barium: Mushroom appearance
Metabolic Triad (HIGH YIELD):
Hypokalemia + Hypochloremia + Metabolic Alkalosis with Paradoxical Aciduria
Treatment:
  • Step 1: Correct dehydration FIRST (Fluid: DNS with KCl)
  • Step 2: Surgery - Ramstedt's Pyloromyotomy (cut adventitia β†’ cut muscularis β†’ do NOT cut mucosa)
DDx: Neonatal GERD - similar age, non-bilious but NON-projectile, improves with growth

πŸ”Ή PEPTIC ULCER DISEASE (PUD)

  • MC sites: D1 + Lesser curvature of stomach
  • Risk: Smoking, NSAIDs, H. pylori (most important)
Johnson's Classification of Gastric Ulcers:
TypeLocationAcid LevelKey
IDistal lesser curvatureNormalLoss of mucus barrier
IILesser curve + Duodenal (double)HighAcid lowering surgery beneficial
IIIPyloric/Pre-pyloricHighAcid lowering surgery
IVProximal lesser curvatureNormalSimilar to Type I
VAnywhereNSAID-inducedNSAIDs cause, not acid
Types I & IV = Normal acid β†’ Only ulcer resection needed Types II & III = High acid β†’ Acid lowering surgery needed
Diagnosis:
  • 1st step: UGI Endoscopy
  • Rapid Urease Test (RUT/CLO Test) for H. pylori on antral biopsy
Medical Treatment: PPI + LSM; H. pylori positive β†’ add triple therapy
Surgical - Vagotomy procedures:
ProcedureKeySide Effects
Truncal VagotomyExcellent acid lowering; MUST add drainage (Pyloroplasty/GJ)High complications
HSV (Highly Selective)BEST TOLERATED - spares pyloric Crow's FootLowest mortality (<0.2%), least side effects (<5%)
TV + AntrectomyLowest recurrence (1%)Highest side effects (10-20%), mortality 1%
Bailey's Comparison:
  • HSV = Best tolerated (least mortality, least side effects, but slightly higher recurrence 2-10%)
  • TV + Antrectomy = "With great power come great complications"

πŸ”Ή DUMPING SYNDROME

  • Complication of gastrectomy procedures (TV+GJ, Billroth 2)
  • Trigger: High sugar foods (milkshakes, fruit juices, bananas)
Early DumpingLate Dumping
TimingWithin minutes of meal1-3 hours after meal
MechanismOsmotic fluid shiftRebound hypoglycemia
BPLOWNormal
Blood SugarNormalLOW
SymptomsSweating, tachycardia, diarrheaTremors, fainting
Treatment: Dietary modification (avoid triggers) | Acarbose | Severe: Octreotide

πŸ”Ή UPPER GI BLEED

  • MC cause: Bleeding Peptic Ulcer (NOT varices!)
  • Site: Posterior wall D1 | Artery: Gastroduodenal Artery (GDA)
Forrest Classification:
GradeFindingRebleed Risk
IaActive arterial jetHIGH
IbActive oozingHIGH
IIaVisible vessel (stopped)HIGH
IIbAdherent clot (stopped)INTERMEDIATE
IIcBlack spot (flat, stopped)LOW
IIIClean base, no bleedingLOW
Scoring systems:
  • Rockall Score: Risk of rebleed AND mortality (ABCDE - Age, BP, Comorbidities, Diagnosis, Endoscopic appearance)
  • Glasgow-Blatchford: Does NOT look at endoscopic findings
  • Forrest: Only one specific for PU bleeding
Management:
  • Step 1: Stabilize + UGI Endoscopy
  • Forrest II (stopped): Medical management
  • Forrest I (active): Dual Endotherapy = Any 2 of 3: Clip + Inject Adrenaline + Argon Plasma Coagulation
  • 2 failed attempts β†’ Angioembolization of GDA or Surgery

πŸ”Ή PEPTIC ULCER PERFORATION

  • MC site: D1, Anterior wall ("Anterior = Perforate | Posterior = Bleed")
  • History: NSAID use + sudden acute abdominal pain
  • Examination: Cardboard-like rigidity
Management:
  1. Stabilize
  2. X-ray chest: Pneumoperitoneum (free air under right dome)
  3. X-ray negative? β†’ CECT abdomen (IOC)
  4. Free air positive β†’ Surgery
Repair:
  • DU perforation: Graham's Omental Patch Repair
  • Ileal perforation (TB/Typhoid): Simple suture
  • Gastric perforation: Simple suture + Biopsy

πŸ“Œ 3. INTESTINAL DISORDERS

πŸ”Ή INTESTINAL TB

  • MC site: Terminal ileum / Ileocaecal (IC) junction
  • Cause: Secondary TB - swallowing sputum in pulmonary TB patient
Types:
  • Ulcerative type (poor immunity): Transverse/circumferential ulcers β†’ heal β†’ stricture
  • Hyperplastic type (moderate immunity): Mass formation
(Typhoid mein ulcers LONGITUDINAL hote hain β†’ stricture nahi banta - important differentiator!)
Complications: Stricture β†’ Obstruction | Perforation β†’ Peritonitis | Cocoon abdomen | Multiple anal fistulae
Barium findings:
  • Sterlin sign: Ileum poorly visualized
  • String sign: Terminal ileal stricture
  • Pulled up cecum, deformed IC junction
Treatment: ATT (2 months HRZE + 4-6 months HRE) Surgery: ONLY for complications
TB vs Crohn's Disease (PYQ HIGH YIELD):
FeatureIntestinal TBCrohn's Disease
CauseM. tuberculosisAutoimmune; NOD2 mutation
MC SiteTerminal ileum / IC junctionTerminal ileum (mouth to anus)
HistologyCaseating granulomasNon-caseating granulomas
GrossStrictures, tubercles on peritoneumCreeping fat, cobblestone mucosa
DiagnosisColonoscopy + Biopsy β†’ CBNAATColonoscopy + Biopsy β†’ ASCA positive
TreatmentATTImmunosuppression (steroids, biologics)

πŸ”Ή ACUTE APPENDICITIS

  • Typical: Young people (teens/20s)
  • Cause: Obstruction by hypertrophied Peyer's patches
Positions of Appendix:
PositionFrequencyClinical
Retrocaecal~70% (MC)Psoas sign positive
Pelvic20-25%Obturator sign positive
Murphy's Triad: RIF pain (periumbilical β†’ RIF) + Low-grade fever + Nausea/Vomiting
Clinical Signs:
SignDescription
McBurney's tenderness2/3 from umbilicus to ASIS on right side
BlumbergRebound tenderness
RovsingPress LIF β†’ pain in RIF
Psoas signPain on hip extension (retrocaecal appendix)
Obturator signPain on hip flexion (pelvic appendix)
Alvarado Score (MANTRELS):
FeatureScore
Migration1
Anorexia1
Nausea/Vomiting1
Tenderness RIF2
Rebound tenderness1
Elevated temp1
Leucocytosis2
Shift to left1
Score β‰₯7/10 = Appendicitis LIKELY (Only Tenderness and Leucocytosis get double points)
IOC:
  • Children: USG (diameter β‰₯6 mm diagnostic)
  • Adults: CECT abdomen
  • Pregnancy: MRI (USG first, MRI if doubt)
Management:
  • Acute: Laparoscopic appendectomy (TOC)
  • Appendicular Lump/Phlegmon: Oschner-Sherren Regimen (conservative)
  • Tumor found intraoperatively:
    • <1 cm at tip β†’ Appendectomy alone
    • At base or >2 cm β†’ Right hemicolectomy
Incisions (Open):
  • McBurney/Gridiron: Perpendicular to right spino-umbilical line; muscle splitting
  • Rutherford-Morrison: Same location; muscle cutting (better exposure)
  • Lanz: Cosmetic, skin crease
Complications of appendectomy:
  • MC early: Wound infection
  • MC late: Adhesive intestinal obstruction
  • MC nerve injured: Iliohypogastric nerve β†’ right-sided inguinal hernia risk

πŸ”Ή SIGMOID DIVERTICULA

  • False diverticula (mucosa only) - in chronic constipation
  • Complications: Hemorrhage / Diverticulitis / Perforation
Hinchey Classification (Diverticular Perforation):
GradeDescription
1aPericolonic phlegmon
1bPericolonic abscess <4 cm
2Pelvic/inter-loop abscess
3Purulent peritonitis
4Fecal peritonitis (worst)
Treatment = Sigmoidectomy (remove entire sigmoid) Hartmann's procedure: Rectal stump sutured; descending colon as colostomy

πŸ”Ή COLONIC POLYPOSIS SYNDROMES

All three are Autosomal Dominant!
FeaturePeutz-JeghersFAPHNPCC/Lynch
MutationSTK11APC geneMismatch repair (MSH, MLH)
Polyp typeHamartomas (non-neoplastic)Adenomatous (>100)Few adenomas
LocationSmall bowel + Colon + RectumColon + RectumRight colon
CRC riskSlightly ↑100% by 20s~80%
ManagementSurveillanceProphylactic proctocolectomy before age 20Surveillance colonoscopy
OtherLip melanosisGardner: osteomas, brain tumorsPancreatic, endometrial, ovarian CA

πŸ”Ή CARCINOMA COLON AND RECTUM

  • MC site: Rectosigmoid (Rectum 38% + Sigmoid 21% = ~60%)
  • Type: Adenocarcinoma
  • Risk: Smoking, alcohol, low-fiber diet, red meat
  • Metformin + Aspirin protective but NOT for prophylactic use
Spread: Liver = MC site of metastasis (50% of liver mets come from CRC)
"GI cancers β†’ Liver mets | Urinary cancers β†’ Lung/bone mets"
Investigations:
  • 1st step: Stool exam
  • IOC: Colonoscopy + Biopsy
  • Local staging for Rectum: MRI rectum (preferred over EUS)
  • Local staging for Colon: CECT abdomen
  • Tumor marker: CEA
Blood in Stools by Age:
  • Elderly male smoker β†’ Colorectal cancer
  • Young (20s) β†’ Ulcerative colitis
  • Child β†’ Polyp / Meckel's diverticulum
TNM Staging:
  • T1: Mucosa/Submucosa | T2: Muscularis | T3: Subserosa (rectum: mesorectum invasion)
  • T4a: Serosa breach | T4b: Adjacent structures
Treatment:
  • Early: Surgery + Adjuvant chemo
  • CA Rectum advanced: Neoadjuvant CHEMORADIATION (ONLY GI cancer with neoadjuvant chemoradiation, others = chemo only)
  • Chemo: FOLFOX / FOLFIRI / FOLFOXIRI (5-FU based, Oxaliplatin, Irinotecan)
Surgical resection (Colon):
LocationSurgery
Cecum/AscendingRadical Right Hemicolectomy
Proximal TransverseExtended Right Hemicolectomy
Descending/SigmoidRadical Left Hemicolectomy
Surgical resection (Rectum):
ScenarioSurgeryDetail
High/Proximal tumorAnterior Resection (AR)Anastomosis possible
Low tumor (within 2 cm levator)APR (Abdominoperineal Resection)Permanent colostomy
Early T1 low lesiontaTMESphincter-saving
Nerve Injuries (NEET PG 2023 - HIGH YIELD):
  • "P for Pointing (erection) = Parasympathetic injury β†’ Impotence"
  • "S for Shooting (ejaculation) = Sympathetic injury β†’ Retrograde ejaculation"

πŸ”Ή RECTAL PROLAPSE

  • Rectum puri tarah bahar aata hai anal verge se
  • Risk: Chronic constipation, elderly, weak pelvic floor, obstetric trauma
  • Children: Partial (mucosal) prolapse - self-limiting
Perineal Procedures (TAD mnemonic) - Elderly/Unfit, higher recurrence:
  • T = Thiersch (Anal Wiring) - OUTDATED
  • A = Altemeier (Perineal rectal resection) - for STRANGULATED prolapse
  • D = Delorme (Plication of prolapsed rectum)
Abdominal Procedures - Young/Fit, lower recurrence:
  • TOC: Laparoscopic ventral mesh rectopexy (most common today)
  • Ripstein/Wells = Rectal rectopexy (abdominal, NOT perineal - asked repeatedly!)

πŸ”Ή PARALYTIC ILEUS vs MECHANICAL OBSTRUCTION

FeatureParalytic IleusMechanical Obstruction
PainNO colicky painColicky pain PRESENT
Bowel soundsABSENTPresent (step-ladder)
Air-fluid levelsAbsentStep-ladder pattern
Air in rectumPresentAbsent
Next stepConservativeCECT abdomen
  • Paralytic ileus MC cause: Post-laparotomy
  • MC electrolyte abnormality: Hypokalemia
  • Management: NPO, IV fluids, correct K+, wait 2-3 days

πŸ”Ή INTUSSUSCEPTION

  • Bowel telescopes into adjacent bowel
  • MC type in children: Ileocolic | Lead point: Hypertrophied Peyer's patches
  • MC type in adults: Colocolic | Lead point: Tumors
  • Age: Weaning period (6 months - 1 year)
  • Classic: Red currant jelly stools
  • Mass: Para-umbilical sausage-shaped
  • Sign of Dance: Right iliac fossa feels empty
  • USG: Donut/Target appearance | Barium: Claw sign
Treatment:
  • Stable: High-pressure enema (air/barium) = Hydro-reduction
  • Unstable/Ischemia/Failed: Surgery

πŸ”Ή SIGMOID VOLVULUS

  • Anti-clockwise twist β†’ Closed loop obstruction β†’ TRUE surgical emergency
  • Elderly, chronic constipation
X-ray signs:
  • Coffee bean sign (dilated sigmoid with mesentery in between)
  • Bent inner tube sign (same, asked to confuse!)
Management:
  • X-ray β†’ CECT (assess ischemia)
  • No ischemia: Colonoscopic decompression β†’ elective sigmoidectomy after 2-3 days
  • Ischemia/failed: Emergency sigmoidectomy

πŸ“Œ 4. ANAL DISORDERS

πŸ”Ή FISTULA IN ANO

  • Abnormal tract: Anal canal β†’ Perianal skin
  • Cause: Secondary to perianal abscess
Park's Classification:
TypeNameCourseFrequency
1IntersphinctericBetween internal & external sphincterMC
2TranssphinctericCrosses through external sphincter2nd MC
3SuprasphinctericAbove external sphincter, crosses levator aniRare
4ExtrasphinctericFrom rectum to perianal skinLeast
  • Types 1 & 2 = LOW fistula | Types 3 & 4 = HIGH fistula
  • IOC: MRI Perineum
  • Goodsall's Rule: Predicts course of fistula tract
Treatment:
TypeTreatment
Low (1, 2)Fistulectomy or Fistulotomy
High/ComplexSeton insertion (Kshar Sutra)

πŸ”Ή HEMORRHOIDS

  • Dilated superior hemorrhoidal veins (origin ABOVE dentate line)
  • Presentation: Painless bleeding = "Splash in the pan"
  • IOC: Proctoscopy (3, 7, 11 o'clock positions)
  • Always do DRE first! If anal spasm present β†’ Proctoscopy CONTRAINDICATED
Grading & Treatment:
GradeDescriptionTreatment
Grade 1Inside anus, asymptomaticConservative
Grade 1(bleeding)/Grade 2Exit but return spontaneouslyBarron's band ligation or Sclerotherapy
Grade 3Exit, manually reducibleStapled hemorrhoidopexy or Milligan-Morgan
Grade 4Permanently outside, irreducibleStapled hemorrhoidopexy or Milligan-Morgan open

πŸ”Ή FISSURE IN ANO

  • Tear/ulcer at anal verge (BELOW dentate line)
  • One of MOST PAINFUL conditions
  • Blood: Streaking pattern (not splash - contrast with hemorrhoids)
  • Sentinel pile: Skin tag covering ulcer
  • Proctoscopy CONTRAINDICATED (due to anal spasm)
Treatment:
  • Conservative: Laxatives, lignocaine gel, sitz bath
  • Surgery: Lateral Internal Sphincterotomy (of Notaras)

πŸ”Ή PILONIDAL SINUS

  • Sinus at UPPER END of natal cleft (overlying coccyx)
  • NOT near anal verge (contrast with fistula in ano)
  • Contains hair (hair falls INTO sinus)
  • Seen in men with hairy back
Procedures:
ProcedureTechnique
KarydakisElliptical PARAMEDIAN excision - suture line avoids midline
Limberg flapRhomboid excision with local flap reconstruction
BascomLinear paramedian incision - excise tracts from the side

πŸ“Œ 5. HERNIA

πŸ”Ή INGUINAL HERNIA

Types:
TypeDefectKey
Indirect (MC overall)Deep ring (fascia transversalis)Enters scrotum; any age; accompanies spermatic cord
DirectHesselbach's trianglePurely inguinal, doesn't enter scrotum; elderly
FemoralFemoral ringMore common in females (but NOT MC hernia in females!)
Hesselbach's Triangle boundaries:
  • Lateral: Inferior epigastric artery
  • Medial: Rectus abdominis
  • Inferior: Inguinal ligament
EHS Classification:
  • P/R = Primary/Recurrent
  • M/L/F = Medial(Direct)/Lateral(Indirect)/Femoral
  • 1/2/3 = Size (<1.5 / <3 / >3 cm)
  • "Direct = M (medial), Indirect = L (lateral)" - use M and L, NOT D and I!
Specially Named Hernias:
NameContentKey
Richter'sPart/knuckle of bowel wallHigh strangulation risk; NO obstruction
Maydl's (W hernia)Two loops of bowel (W-shape)-
Amyand'sAppendixInguinal hernia with appendix
Littre'sMeckel's diverticulumVery rare
Hernia Repairs:
  1. Herniotomy: Congenital hernia/hydrocele; excises indirect sac only
  2. Herniorrhaphy: Bassini (oldest), Shouldice (4-layer), Desarda
  3. Hernioplasty (TOC): Lichtenstein's tension-free repair - Mesh: Polypropylene (Prolene) - ONLAY
Nerve Injuries:
  • Open repair: MC = Ilioinguinal nerve β†’ sensory loss at root of penis/inner thigh
  • Laparoscopic repair: MC = Lateral cutaneous nerve of thigh β†’ Meralgia paraesthetica
Laparoscopic Repair (TAPP & TEP): Can repair Direct + Indirect + Femoral + Obturator ALL AT ONCE
Triangles in Laparoscopic repair:
  • Triangle of Doom: Vas deferens (medial) + Testicular vessels (lateral) - contains external iliac vessels; risk of vascular injury
  • Triangle of Pain: Testicular vessels (medial) + Ilio-pubic tract (lateral) - contains lateral cutaneous nerve, femoral nerve

πŸ“Œ 6. HEPATOBILIARY DISORDERS

πŸ”Ή HYDATID CYST OF LIVER

  • Parasite: Echinococcus granulosus (Dog tapeworm)
  • Definitive host: Dog | Intermediate host: Sheep | Man = Accidental/Dead-end host
  • MC site: Liver | 2nd MC: Lungs
Investigations:
  • 1st step: LFT + USG abdomen
  • USG: Floating membrane appearance (Water lily sign) | Active cyst
  • CT: Honeycombing (multiseptated)
  • FNAC/Biopsy: CONTRAINDICATED (anaphylaxis + spillage risk)
Treatment:
Cyst StatusTreatment
Inactive/Calcified/AsymptomaticSurveillance only
Active/SymptomaticAlbendazole x 3 weeks β†’ TOC: PAIR procedure
PAIR contraindicatedSurgery: Pericystectomy
PAIR Procedure:
  • P = Puncture (image-guided)
  • A = Aspirate contents
  • I = Inject scolicidal agent (10% hypertonic saline or 10% Povidone iodine)
  • R = Re-aspirate
PAIR Contraindications: Deep/inaccessible cyst | Multiseptated/Honeycombed | Cysto-biliary communication

πŸ”Ή LIVER ABSCESS

Pyogenic vs Amebic (HIGH YIELD):
FeaturePyogenicAmebic
OrganismE. coli / KlebsiellaEntamoeba histolytica
PathwayAscending cholangitis (MC)Feco-oral β†’ Portal vein
NumberUsually multipleUsually solitary
PusTrue pusAnchovy sauce
PresentationAcute, high feverSubacute, mild symptoms
TreatmentAntibiotics + Drainage (always needed)Metronidazole + Diloxanide
DrainageAlways mandatoryOnly if non-responsive/risk of rupture
Key principle:
"Pyogenic = Real abscess β†’ Drainage mandatory | Amebic = Not real abscess (liquefied liver) β†’ Medical management is TOC"
Amebic treatment: High-dose Metronidazole + Luminal agent (Diloxanide furoate) 10-14 days

πŸ”Ή CHOLEDOCHAL CYST - Todani Classification

TypeDescriptionKey
Type I (MC)Fusiform dilation of CBDClassical; saccular/fusiform
Type IIDiverticular dilation of CBDLooks like accessory gallbladder

🎯 SUPER HIGH YIELD MNEMONICS & POINTS (Quick Revision)

TopicKey Fact
AchalasiaLiquids > Solids (contrast: Malignancy = Solids > Liquids)
BoerhaaveMackler's Triad: Chest pain + Retching + Subcutaneous emphysema
Barrett'sSalmon-pink tongue-like projections at GE junction
DeMeester score>14.7 = Positive (acid reflux confirmed)
IHPS metabolic triadHypokalemia + Hypochloremia + Metabolic Alkalosis + Paradoxical Aciduria
D1 ulcerAnterior = Perforate, Posterior = Bleed (GDA)
Forrest IaArterial jet = HIGH rebleed risk; needs dual endotherapy
TB vs Typhoid ulcersTB = Transverse (causes stricture)
Appendix identificationAt convergence of taenia coli on cecum
Alvarado scoreTenderness(2) + Leucocytosis(2) = only double score items
Rectal cancerONLY GI cancer with neoadjuvant chemoradiation
Nerve injuryP = Pointing (erection) = Parasympathetic
Pilonidal vs FistulaPilonidal = upper natal cleft
Hemorrhoids vs FissureHemorrhoids = painless splash
Hydatid cystFNAC = CONTRAINDICATED; Water lily sign on USG
Amebic abscessAnchovy sauce pus; Medical TOC (Metronidazole)
Virchow's nodeLeft supraclavicular = GI cancer metastasis
Krukenberg tumorBilateral ovarian mets from stomach cancer

Ye poora Surgery Part 1 hai - GIT se Esophagus, Stomach, Intestines, Anal disorders, Hernia, aur Hepatobiliary tak. Koi bhi topic ka koi bhi point agar zyada detail mein chahiye, ya koi specific question hai, toh pooch sakte ho - ek word bhi nahi chodenge! πŸ’ͺ

Create a summary PDF with all mnemonics & high-yield facts

Running Command

mkdir -p /tmp/workspace/surgery-summary && ls /tmp/workspace/surgery-summary/

Writing File

~/surgery-summary/create_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import mm, cm
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table,
                                 TableStyle, HRFlowable, PageBreak, KeepTogether)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import BaseDocTemplate, Frame, PageTemplate
from reportlab.pdfgen import canvas

OUTPUT = "/tmp/workspace/surgery-summary/Surgery_Mnemonics_HY_Facts.pdf"

# ── Color palette ──────────────────────────────────────────────────────────────
DARK_BLUE   = colors.HexColor("#1A237E")
MID_BLUE    = colors.HexColor("#283593")
LIGHT_BLUE  = colors.HexColor("#E8EAF6")
ACCENT      = colors.HexColor("#FF6F00")   # amber
GREEN       = colors.HexColor("#1B5E20")
GREEN_LIGHT = colors.HexColor("#E8F5E9")
RED         = colors.HexColor("#B71C1C")
RED_LIGHT   = colors.HexColor("#FFEBEE")
GOLD        = colors.HexColor("#F9A825")
GOLD_LIGHT  = colors.HexColor("#FFFDE7")
PURPLE      = colors.HexColor("#4A148C")
PURPLE_LIGHT= colors.HexColor("#F3E5F5")
TEAL        = colors.HexColor("#004D40")
TEAL_LIGHT  = colors.HexColor("#E0F2F1")
GREY_LIGHT  = colors.HexColor("#F5F5F5")
GREY_MED    = colors.HexColor("#BDBDBD")
WHITE       = colors.white
BLACK       = colors.black

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

def S(name, **kw):
    return ParagraphStyle(name, **kw)

cover_title = S("CoverTitle",
    fontName="Helvetica-Bold", fontSize=28, textColor=WHITE,
    alignment=TA_CENTER, leading=34, spaceAfter=8)

cover_sub = S("CoverSub",
    fontName="Helvetica-Bold", fontSize=14, textColor=GOLD,
    alignment=TA_CENTER, leading=20, spaceAfter=4)

cover_info = S("CoverInfo",
    fontName="Helvetica", fontSize=11, textColor=WHITE,
    alignment=TA_CENTER, leading=16)

chapter_title = S("ChapterTitle",
    fontName="Helvetica-Bold", fontSize=15, textColor=WHITE,
    alignment=TA_LEFT, leading=18, leftIndent=6)

section_title = S("SectionTitle",
    fontName="Helvetica-Bold", fontSize=12, textColor=DARK_BLUE,
    alignment=TA_LEFT, leading=14, spaceBefore=10, spaceAfter=4,
    leftIndent=4, borderPad=2)

hy_title = S("HYTitle",
    fontName="Helvetica-Bold", fontSize=10, textColor=RED,
    alignment=TA_LEFT, leading=12, spaceBefore=4, spaceAfter=2)

mnemonic_title = S("MnemonicTitle",
    fontName="Helvetica-Bold", fontSize=10, textColor=PURPLE,
    alignment=TA_LEFT, leading=12, spaceBefore=4, spaceAfter=2)

body = S("Body",
    fontName="Helvetica", fontSize=9, textColor=BLACK,
    alignment=TA_LEFT, leading=13, spaceAfter=2, leftIndent=4)

body_bold = S("BodyBold",
    fontName="Helvetica-Bold", fontSize=9, textColor=BLACK,
    alignment=TA_LEFT, leading=13, spaceAfter=2, leftIndent=4)

bullet_style = S("Bullet",
    fontName="Helvetica", fontSize=9, textColor=BLACK,
    alignment=TA_LEFT, leading=12, leftIndent=12, firstLineIndent=-8,
    spaceAfter=2)

bullet_bold = S("BulletBold",
    fontName="Helvetica-Bold", fontSize=9, textColor=DARK_BLUE,
    alignment=TA_LEFT, leading=12, leftIndent=12, firstLineIndent=-8,
    spaceAfter=2)

small = S("Small",
    fontName="Helvetica", fontSize=8, textColor=colors.HexColor("#444444"),
    alignment=TA_LEFT, leading=11, leftIndent=4)

footer_style = S("Footer",
    fontName="Helvetica-Oblique", fontSize=7, textColor=colors.HexColor("#888888"),
    alignment=TA_CENTER)

# ── Helper builders ────────────────────────────────────────────────────────────

def chapter_header(title, color=DARK_BLUE):
    """Colored full-width chapter banner."""
    data = [[Paragraph(title, chapter_title)]]
    t = Table(data, colWidths=[170*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), color),
        ("ROWBACKGROUNDS", (0,0), (-1,-1), [color]),
        ("TOPPADDING", (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
        ("ROUNDEDCORNERS", [4,4,4,4]),
    ]))
    return t

def section_box(title, bg=LIGHT_BLUE, fg=DARK_BLUE):
    """Section heading in colored box."""
    st = S("_sec", fontName="Helvetica-Bold", fontSize=11, textColor=fg,
           alignment=TA_LEFT, leading=13)
    data = [[Paragraph(f"β–Ά  {title}", st)]]
    t = Table(data, colWidths=[170*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
    ]))
    return t

def hy_box(lines, color=RED_LIGHT, border=RED):
    """HIGH YIELD orange/red box."""
    label_style = S("_hyl", fontName="Helvetica-Bold", fontSize=9,
                    textColor=border, leading=12, alignment=TA_LEFT)
    content = [Paragraph("β˜…  HIGH YIELD", label_style)]
    for l in lines:
        content.append(Paragraph(f"β€’ {l}", bullet_style))
    data = [[content]]
    t = Table([[content]], colWidths=[170*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), color),
        ("BOX", (0,0), (-1,-1), 1, border),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
    ]))
    return t

def mnemonic_box(mnemonic_name, lines, color=PURPLE_LIGHT, border=PURPLE):
    """Mnemonic box in purple."""
    label_style = S("_mnl", fontName="Helvetica-Bold", fontSize=9,
                    textColor=border, leading=12, alignment=TA_LEFT)
    content = [Paragraph(f"🧠  MNEMONIC: {mnemonic_name}", label_style)]
    for l in lines:
        content.append(Paragraph(f"  {l}", bullet_style))
    t = Table([[content]], colWidths=[170*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), color),
        ("BOX", (0,0), (-1,-1), 1, border),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
    ]))
    return t

def gold_box(title, lines):
    """Gold PYT box."""
    label_style = S("_gl", fontName="Helvetica-Bold", fontSize=9,
                    textColor=colors.HexColor("#7B5E00"), leading=12, alignment=TA_LEFT)
    content = [Paragraph(f"πŸ†  PYT GOLD: {title}", label_style)]
    for l in lines:
        content.append(Paragraph(f"β€’ {l}", bullet_style))
    t = Table([[content]], colWidths=[170*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), GOLD_LIGHT),
        ("BOX", (0,0), (-1,-1), 1.5, GOLD),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
    ]))
    return t

def green_box(lines):
    """Tip/Note green box."""
    label_style = S("_gnl", fontName="Helvetica-Bold", fontSize=9,
                    textColor=GREEN, leading=12, alignment=TA_LEFT)
    content = [Paragraph("βœ…  KEY RULE / NOTE", label_style)]
    for l in lines:
        content.append(Paragraph(f"β€’ {l}", bullet_style))
    t = Table([[content]], colWidths=[170*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), GREEN_LIGHT),
        ("BOX", (0,0), (-1,-1), 1, GREEN),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
    ]))
    return t

def teal_box(lines):
    """Comparison / differentiation box."""
    label_style = S("_tl", fontName="Helvetica-Bold", fontSize=9,
                    textColor=TEAL, leading=12, alignment=TA_LEFT)
    content = [Paragraph("⚑  DIFFERENTIATOR", label_style)]
    for l in lines:
        content.append(Paragraph(f"β€’ {l}", bullet_style))
    t = Table([[content]], colWidths=[170*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), TEAL_LIGHT),
        ("BOX", (0,0), (-1,-1), 1, TEAL),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
    ]))
    return t

def make_table(headers, rows, col_widths=None, header_bg=DARK_BLUE):
    """Generic styled table."""
    if col_widths is None:
        w = 170*mm / max(len(headers),1)
        col_widths = [w]*len(headers)

    header_style = S("_th", fontName="Helvetica-Bold", fontSize=8.5,
                     textColor=WHITE, leading=11, alignment=TA_CENTER)
    cell_style   = S("_td", fontName="Helvetica", fontSize=8.5,
                     textColor=BLACK, leading=11, alignment=TA_LEFT)
    bold_cell    = S("_tdb", fontName="Helvetica-Bold", fontSize=8.5,
                     textColor=DARK_BLUE, leading=11, alignment=TA_LEFT)

    data = [[Paragraph(h, header_style) for h in headers]]
    for r in rows:
        row = []
        for i, cell in enumerate(r):
            if isinstance(cell, str) and cell.startswith("**") and cell.endswith("**"):
                row.append(Paragraph(cell[2:-2], bold_cell))
            else:
                row.append(Paragraph(str(cell), cell_style))
        data.append(row)

    t = Table(data, colWidths=col_widths, repeatRows=1)
    row_colors = []
    for i in range(1, len(data)):
        bg = GREY_LIGHT if i % 2 == 0 else WHITE
        row_colors.append(("BACKGROUND", (0,i), (-1,i), bg))

    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,0), header_bg),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, GREY_LIGHT]),
        ("GRID", (0,0), (-1,-1), 0.4, GREY_MED),
        ("TOPPADDING", (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING", (0,0), (-1,-1), 5),
        ("RIGHTPADDING", (0,0), (-1,-1), 5),
        ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
        ("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
    ] + row_colors))
    return t

def sp(n=4): return Spacer(1, n)
def hr(): return HRFlowable(width="100%", thickness=0.5, color=GREY_MED, spaceAfter=4, spaceBefore=4)

# ── Page numbering ─────────────────────────────────────────────────────────────

def add_page_number(canvas_obj, doc):
    canvas_obj.saveState()
    canvas_obj.setFont("Helvetica", 7)
    canvas_obj.setFillColor(colors.HexColor("#888888"))
    canvas_obj.drawCentredString(A4[0]/2, 10*mm,
        f"Surgery Part 1 β€” Mnemonics & High-Yield Facts   |   Page {doc.page}")
    # top banner stripe
    canvas_obj.setFillColor(DARK_BLUE)
    canvas_obj.rect(0, A4[1]-8*mm, A4[0], 8*mm, fill=1, stroke=0)
    canvas_obj.setFont("Helvetica-Bold", 7)
    canvas_obj.setFillColor(WHITE)
    canvas_obj.drawString(15*mm, A4[1]-5.5*mm, "SURGERY PART 1 β€” HYPERREVISION")
    canvas_obj.drawRightString(A4[0]-15*mm, A4[1]-5.5*mm, "Cerebellum 20th Course  @AnandxBotss")
    canvas_obj.restoreState()

# ── COVER PAGE ─────────────────────────────────────────────────────────────────

def cover_page(canvas_obj, doc):
    w, h = A4
    # gradient-like background
    canvas_obj.setFillColor(DARK_BLUE)
    canvas_obj.rect(0, 0, w, h, fill=1, stroke=0)
    canvas_obj.setFillColor(MID_BLUE)
    canvas_obj.rect(0, 0, w, h*0.45, fill=1, stroke=0)
    # accent stripe
    canvas_obj.setFillColor(ACCENT)
    canvas_obj.rect(0, h*0.45, w, 4, fill=1, stroke=0)
    # bottom watermark text
    canvas_obj.setFont("Helvetica-Bold", 80)
    canvas_obj.setFillColor(colors.HexColor("#FFFFFF10"))
    canvas_obj.drawCentredString(w/2, h*0.15, "SURGERY")
    # page number off for cover
    pass

# ── BUILD DOCUMENT ─────────────────────────────────────────────────────────────

story = []

# ──────────────────────────────────────────────────────────────────────────────
# PAGE 1 β€” COVER
# ──────────────────────────────────────────────────────────────────────────────
cover_bg_style = S("covbg",
    fontName="Helvetica-Bold", fontSize=32, textColor=WHITE,
    alignment=TA_CENTER, leading=38, spaceBefore=60, spaceAfter=6)

story.append(Spacer(1, 55*mm))
story.append(Paragraph("SURGERY PART 1", cover_bg_style))
story.append(Paragraph("Mnemonics &amp; High-Yield Facts", S("_cs2",
    fontName="Helvetica-Bold", fontSize=18, textColor=GOLD,
    alignment=TA_CENTER, leading=22, spaceAfter=8)))
story.append(Spacer(1, 6))
story.append(Paragraph("GIT Β· Esophagus Β· Stomach Β· Intestines Β· Anal Disorders Β· Hernia Β· Hepatobiliary",
    S("_cs3", fontName="Helvetica", fontSize=10, textColor=WHITE,
      alignment=TA_CENTER, leading=14)))
story.append(Spacer(1, 14*mm))

cover_table_data = [
    [Paragraph("πŸ“– SOURCE", S("_ct", fontName="Helvetica-Bold", fontSize=9, textColor=GOLD, alignment=TA_CENTER)),
     Paragraph("Cerebellum's Hyperrevision β€” 20th Course", S("_cv", fontName="Helvetica", fontSize=9, textColor=WHITE, alignment=TA_LEFT))],
    [Paragraph("πŸ“… DATE", S("_ct", fontName="Helvetica-Bold", fontSize=9, textColor=GOLD, alignment=TA_CENTER)),
     Paragraph("July 2026", S("_cv", fontName="Helvetica", fontSize=9, textColor=WHITE, alignment=TA_LEFT))],
    [Paragraph("🎯 PURPOSE", S("_ct", fontName="Helvetica-Bold", fontSize=9, textColor=GOLD, alignment=TA_CENTER)),
     Paragraph("Quick revision β€” mnemonics, differentiators, exam-ready facts", S("_cv", fontName="Helvetica", fontSize=9, textColor=WHITE, alignment=TA_LEFT))],
]
ct = Table(cover_table_data, colWidths=[38*mm, 120*mm])
ct.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), colors.HexColor("#283593")),
    ("BOX", (0,0), (-1,-1), 1, GOLD),
    ("INNERGRID", (0,0), (-1,-1), 0.3, colors.HexColor("#3F51B5")),
    ("TOPPADDING", (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING", (0,0), (-1,-1), 8),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))
story.append(ct)
story.append(PageBreak())

# ──────────────────────────────────────────────────────────────────────────────
# SECTION 1 β€” ESOPHAGUS
# ──────────────────────────────────────────────────────────────────────────────
story.append(chapter_header("SECTION 1: ESOPHAGEAL DISORDERS", DARK_BLUE))
story.append(sp(6))

# --- ACHALASIA ---
story.append(section_box("ACHALASIA CARDIA", LIGHT_BLUE, DARK_BLUE))
story.append(sp(4))

story.append(KeepTogether([
    mnemonic_box("THREE CITIES OF ESOPHAGUS", [
        "πŸ™οΈ CHICAGO β†’ Manometry classification of Achalasia",
        "πŸ™οΈ MONTREAL β†’ Definition of GERD",
        "πŸ™οΈ LA (Los Angeles) β†’ Grading of GERD severity (A–D)",
    ]),
    sp(5),
    hy_box([
        "MC motility disorder of esophagus",
        "Dysphagia: LIQUIDS > SOLIDS (key differentiator from malignancy where SOLIDS > LIQUIDS)",
        "Triad: Dysphagia + Regurgitation + Weight loss",
        "IOC: High-Resolution Manometry (HRM) β€” Absent peristalsis + Elevated LES pressure",
        "Type 3 Achalasia (Spastic) β€” TOC = POEM | Type 1 & 2 β€” TOC = Heller's Cardiomyotomy",
    ]),
    sp(5),
]))

story.append(make_table(
    ["Type", "Manometry Findings", "Key Point"],
    [
        ["Type 1 (MC)", "Absent peristalsis + High resting LES pressure", "BOTH must be present"],
        ["Type 2", "Type 1 + Pan-esophageal pressurization β‰₯20% swallows", "Best response to treatment"],
        ["Type 3 (Spastic)", "Type 1 + Premature spasms in esophagus", "TOC = POEM"],
    ],
    col_widths=[30*mm, 90*mm, 50*mm]
))
story.append(sp(5))

story.append(mnemonic_box("Allgrove Syndrome = AAA", [
    "A β€” Adrenal insufficiency",
    "A β€” Alacrymia (no tears)",
    "A β€” Achalasia",
]))
story.append(sp(8))

# --- BOERHAAVE ---
story.append(section_box("BOERHAAVE SYNDROME (Spontaneous Perforation)", LIGHT_BLUE, DARK_BLUE))
story.append(sp(4))
story.append(mnemonic_box("Mackler's TRIAD", [
    "1. Chest pain (retrosternal)",
    "2. Retching / vomiting",
    "3. Subcutaneous emphysema",
]))
story.append(sp(4))
story.append(hy_box([
    "Cause: Alcohol binge β†’ forceful vomiting β†’ esophagus bursts",
    "Site: Left lower esophagus (weak area)",
    "IOC: CT with WATER-SOLUBLE contrast (NOT barium β€” barium is toxic when it leaks!)",
    "Sites of narrowing: 15 cm (Cricopharynx β€” MC perforation) | 25 cm (L bronchus/Aorta) | 40 cm (Diaphragm)",
]))
story.append(sp(8))

# --- GERD & BARRETT'S ---
story.append(section_box("GERD / BARRETT'S ESOPHAGUS", LIGHT_BLUE, DARK_BLUE))
story.append(sp(4))
story.append(hy_box([
    "GERD gold standard: 24-hr pH Study β€” DeMeester score >14.7 = POSITIVE",
    "LA grading on endoscopy: A–D (severity of esophageal erosions)",
    "TOC: PPI + Lifestyle modifications (4–8 weeks)",
    "Barrett's = Squamous β†’ Columnar metaplasia (chronic GERD)",
    "Endoscopy: Salmon-pink tongue-like projections at GE junction (NOT erosions!)",
    "Seattle biopsy: 4-quadrant biopsies at 2 cm intervals",
    "High-grade dysplasia β†’ 7%/year cancer risk β†’ Excision + Surveillance",
]))
story.append(sp(5))
story.append(make_table(
    ["Dysplasia Grade", "Cancer Risk/Year", "Treatment"],
    [
        ["No dysplasia", "0.2–0.5%", "Treat GERD (PPI + LSM)"],
        ["Low grade", "0.7%", "EMR / Radiofrequency Ablation (RFA)"],
        ["High grade", "7%", "Excision (endoscopic/surgical) + Surveillance"],
    ],
    col_widths=[50*mm, 40*mm, 80*mm]
))
story.append(sp(5))
story.append(teal_box([
    "Achalasia: Dysphagia liquids > solids | Malignancy: Dysphagia solids > liquids",
    "Barrett's endoscopy: Salmon-pink projections (NOT erosions β€” those are GERD)",
    "Corrosive injury: Alkali = liquefaction (worse, deeper) | Acid = coagulation (shallower)",
    "Pilonidal sinus vs Fistula in Ano: Pilonidal = upper natal cleft | Fistula = near anal verge",
]))
story.append(sp(8))

# --- HIATUS HERNIA ---
story.append(section_box("HIATUS HERNIA + FUNDOPLICATIONS", LIGHT_BLUE, DARK_BLUE))
story.append(sp(4))
story.append(make_table(
    ["Type", "Mechanism", "Association", "Treatment"],
    [
        ["Type 1: Sliding (MC)", "GE junction slides into chest; muscle weakness", "GERD", "Nissen/Toupet"],
        ["Type 2: Rolling (Paraesophageal)", "Fundus herniates beside esophagus; GE junction normal", "NOT GERD", "Surgery + fix defect"],
        ["Type 3: Mixed", "Both GE junction + fundus herniate", "GERD + weakness", "Combine both"],
    ],
    col_widths=[40*mm, 58*mm, 32*mm, 40*mm]
))
story.append(sp(5))
story.append(make_table(
    ["Procedure", "Wrap", "Key Points"],
    [
        ["Nissen (Floppy)", "360Β° complete", "MC complication: Short-term dysphagia (<3 months); also gas bloat, vagus nerve injury"],
        ["Toupet", "270Β° posterior", "Less dysphagia than Nissen; commonly done now"],
        ["Dor", "180Β° anterior", "Partial wrap"],
    ],
    col_widths=[38*mm, 32*mm, 100*mm]
))
story.append(sp(8))
story.append(PageBreak())

# ──────────────────────────────────────────────────────────────────────────────
# SECTION 2 β€” STOMACH & DUODENUM
# ──────────────────────────────────────────────────────────────────────────────
story.append(chapter_header("SECTION 2: STOMACH & DUODENUM", MID_BLUE))
story.append(sp(6))

# --- CA STOMACH ---
story.append(section_box("CA STOMACH", LIGHT_BLUE, DARK_BLUE))
story.append(sp(4))
story.append(mnemonic_box("Risk Factors β€” 4S + 1D", [
    "S β€” Smoking",
    "S β€” Spirits (alcohol)",
    "S β€” Sepsis (H. pylori β€” lives in antrum, Type B gastritis)",
    "S β€” Smoked foods / Soya sauce",
    "D β€” Diet (nitrates, smoked foods)",
]))
story.append(sp(5))
story.append(hy_box([
    "H. pylori causes: Chronic Gastritis + Peptic Ulcers + Gastric Cancer (Adenocarcinoma + MALT lymphoma)",
    "Golden Rule ALL GI Cancers: ELDERLY MALE SMOKER β†’ Think Malignancy",
    "MC site of CA Stomach: Antrum",
    "Diagnosis: UGI Endoscopy + Biopsy (1st step & IOC) | Local staging: EUS | Distant: PET Scan",
    "Surgery: Radical Gastrectomy + D2 Lymphadenectomy | Chemo: FLOT regimen (Platinum-based)",
]))
story.append(sp(5))
story.append(make_table(
    ["Sign", "Location", "Origin"],
    [
        ["Virchow's node", "Left supraclavicular lymph node", "GI cancer metastasis (MC from stomach)"],
        ["Sister Mary Joseph nodule", "Para-umbilical nodule", "Peritoneal metastasis"],
        ["Krukenberg tumour", "Bilateral ovaries", "Haematogenous spread from stomach"],
        ["Irish node", "Left axillary lymph node", "GI cancer metastasis"],
    ],
    col_widths=[50*mm, 60*mm, 60*mm]
))
story.append(sp(8))

# --- IHPS ---
story.append(section_box("IHPS (Infantile Hypertrophic Pyloric Stenosis)", LIGHT_BLUE, DARK_BLUE))
story.append(sp(4))

story.append(hy_box([
    "NOT congenital β€” presents at 4–8 WEEKS after birth, NOT at birth",
    "Projectile, NON-BILIOUS vomiting after feeds",
    "Olive-shaped mass in RUQ (best felt when baby is relaxed/during feeding)",
    "Visible peristalsis: LEFT to RIGHT direction",
    "IOC: USG abdomen β€” pylorus thickness β‰₯4 mm is diagnostic",
    "X-ray: Single bubble (dilated stomach) | Barium: Mushroom appearance",
    "DDx from Neonatal GERD: GERD is non-projectile; improves with growth",
]))
story.append(sp(5))
story.append(mnemonic_box("IHPS Classic Metabolic Triad", [
    "Hypo KALEMIA",
    "Hypo CHLOREMIA",
    "Metabolic ALKALOSIS with Paradoxical ACIDURIA",
    "(Acid is lost in vomit β†’ body tries to conserve H+ β†’ paradoxically excretes H+ in urine)",
]))
story.append(sp(5))
story.append(green_box([
    "Step 1: Correct DEHYDRATION FIRST (Fluid: DNS with KCl)",
    "Step 2: Ramstedt's Pyloromyotomy β€” cut adventitia β†’ cut muscularis β†’ DO NOT cut mucosa",
]))
story.append(sp(8))

# --- PUD ---
story.append(section_box("PEPTIC ULCER DISEASE (PUD)", LIGHT_BLUE, DARK_BLUE))
story.append(sp(4))
story.append(make_table(
    ["Johnson Type", "Location", "Acid Level", "Surgery"],
    [
        ["I", "Distal lesser curvature", "Normal", "Ulcer resection only"],
        ["II", "Lesser curve + Duodenal (double)", "HIGH", "Acid-lowering surgery"],
        ["III", "Pyloric / Pre-pyloric", "HIGH", "Acid-lowering surgery"],
        ["IV", "Proximal lesser curvature", "Normal", "Similar to Type I"],
        ["V", "Anywhere (NSAID-induced)", "NSAID-related", "Stop NSAIDs"],
    ],
    col_widths=[28*mm, 55*mm, 32*mm, 55*mm]
))
story.append(sp(5))
story.append(mnemonic_box("Vagotomy Procedures β€” Bailey's Golden Rule", [
    "HSV (Highly Selective Vagotomy) = BEST TOLERATED",
    "  β†’ Mortality <0.2% | Side effects <5% | Recurrence 2–10% (acceptable)",
    "  β†’ Spares pyloric Crow's Foot / Nerves of Latarjet | NO drainage needed",
    "TV + Antrectomy = 'With great power come great complications'",
    "  β†’ Lowest recurrence (1%) BUT highest side effects (10–20%) + mortality (1%)",
]))
story.append(sp(5))
story.append(hy_box([
    "D1 Ulcer memory aid: ANTERIOR wall = Perforate | POSTERIOR wall = Bleed (erodes GDA)",
    "Posterior D1 bleeds from: Gastroduodenal Artery (GDA)",
    "MC cause of UGI Bleed: Bleeding Peptic Ulcer (NOT varices!)",
    "Graham's Omental Patch = DU Perforation | Simple suture = Ileal/Gastric Perforation",
    "Gastric perforation β†’ ALWAYS take biopsy (rule out malignancy)",
]))
story.append(sp(8))
story.append(PageBreak())

# --- DUMPING + UGI BLEED ---
story.append(chapter_header("SECTION 2 (cont.): DUMPING + UGI BLEED", MID_BLUE))
story.append(sp(6))
story.append(section_box("DUMPING SYNDROME", LIGHT_BLUE, DARK_BLUE))
story.append(sp(4))
story.append(make_table(
    ["Feature", "Early Dumping", "Late Dumping"],
    [
        ["Timing", "Within minutes of meal", "1–3 hours after meal"],
        ["Mechanism", "Osmotic fluid shift (hyperosmolar food β†’ jejunum)", "Rebound hypoglycemia"],
        ["BP", "LOW", "Normal"],
        ["Blood Sugar", "Normal", "LOW"],
        ["Symptoms", "Sweating, tachycardia, diarrhea, lightheadedness", "Tremors, fainting, sense of impending doom"],
        ["Relieves with", "Lying down", "Food intake"],
    ],
    col_widths=[38*mm, 66*mm, 66*mm]
))
story.append(sp(4))
story.append(green_box([
    "Trigger: High sugar foods (milkshakes, fruit juices, refined flour, bananas)",
    "Medical: Acarbose | Severe: Octreotide",
]))
story.append(sp(8))

story.append(section_box("UPPER GI BLEED β€” FORREST CLASSIFICATION", LIGHT_BLUE, DARK_BLUE))
story.append(sp(4))
story.append(make_table(
    ["Grade", "Finding", "Rebleed Risk", "Management"],
    [
        ["Ia", "Active arterial jet (spurting)", "HIGH", "Dual Endotherapy"],
        ["Ib", "Active oozing (diffuse)", "HIGH", "Dual Endotherapy"],
        ["IIa", "Visible vessel (stopped)", "HIGH", "Dual Endotherapy"],
        ["IIb", "Adherent clot (stopped)", "INTERMEDIATE", "Endotherapy"],
        ["IIc", "Black spot/flat (stopped)", "LOW", "Medical management"],
        ["III", "Clean base, no bleeding", "LOW", "Medical management"],
    ],
    col_widths=[18*mm, 55*mm, 35*mm, 62*mm]
))
story.append(sp(5))
story.append(mnemonic_box("Dual Endotherapy = Any 2 of 3", [
    "1. CLIP the vessel",
    "2. INJECT Adrenaline",
    "3. APC β€” Argon Plasma Coagulation",
    "Can attempt endotherapy TWICE. If still bleeds β†’ Angioembolization of GDA OR Surgery",
]))
story.append(sp(5))
story.append(mnemonic_box("Scoring Systems", [
    "ROCKALL Score = Rebleed risk + MORTALITY (ABCDE: Age, BP, Comorbidities, Diagnosis, Endoscopic appearance)",
    "GLASGOW-BLATCHFORD = Does NOT look at endoscopic findings",
    "FORREST = ONLY specific for PU bleeding",
]))
story.append(sp(8))
story.append(PageBreak())

# ──────────────────────────────────────────────────────────────────────────────
# SECTION 3 β€” INTESTINAL DISORDERS
# ──────────────────────────────────────────────────────────────────────────────
story.append(chapter_header("SECTION 3: INTESTINAL DISORDERS", colors.HexColor("#1B5E20")))
story.append(sp(6))

story.append(section_box("INTESTINAL TB vs CROHN'S DISEASE", GREEN_LIGHT, GREEN))
story.append(sp(4))
story.append(make_table(
    ["Feature", "Intestinal TB", "Crohn's Disease"],
    [
        ["Cause", "Mycobacterium tuberculosis (swallowed sputum)", "Autoimmune; NOD2 mutation"],
        ["MC Site", "Terminal ileum / IC junction", "Terminal ileum (mouth to anus)"],
        ["Ulcer type", "TRANSVERSE / circumferential β†’ STRICTURE", "Longitudinal/serpiginous"],
        ["Histology", "CASEATING granulomas; transmural", "NON-CASEATING granulomas; transmural"],
        ["Gross Appearance", "Strictures, tubercles on peritoneum", "Creeping fat, cobblestone mucosa"],
        ["Serology", "CBNAAT, TB culture", "ASCA positive"],
        ["Treatment", "ATT (2 HRZE + 4–6 HRE); surgery ONLY for complications", "Immunosuppression (steroids, biologics); surgery for complications"],
    ],
    col_widths=[36*mm, 67*mm, 67*mm]
))
story.append(sp(5))
story.append(teal_box([
    "TB ulcers: TRANSVERSE β†’ heal by fibrosis β†’ STRICTURE",
    "Typhoid ulcers: LONGITUDINAL β†’ do NOT cause stricture (key differentiator!)",
    "Investigation Dictum: UGI symptoms β†’ UGI Endoscopy | Acute abdomen β†’ X-ray/USG β†’ CECT | Lower GI β†’ Stool exam β†’ Colonoscopy",
]))
story.append(sp(8))

# --- ACUTE APPENDICITIS ---
story.append(section_box("ACUTE APPENDICITIS", GREEN_LIGHT, GREEN))
story.append(sp(4))
story.append(mnemonic_box("Alvarado Score β€” MANTRELS", [
    "M β€” Migration of pain (1)",
    "A β€” Anorexia (1)",
    "N β€” Nausea / Vomiting (1)",
    "T β€” Tenderness in RIF (2) ← double points",
    "R β€” Rebound tenderness (1)",
    "E β€” Elevated temperature (1)",
    "L β€” Leucocytosis (2) ← double points",
    "S β€” Shift to left of WBCs (1)",
    "Score β‰₯7/10 = Appendicitis LIKELY",
]))
story.append(sp(5))
story.append(make_table(
    ["Sign", "Description"],
    [
        ["McBurney's tenderness", "Point of max tenderness β€” 2/3 from umbilicus to ASIS on right side"],
        ["Blumberg sign", "Rebound tenderness β€” pain on releasing pressure in RIF"],
        ["Rovsing sign", "Press in LIF β†’ pain in RIF"],
        ["Psoas sign", "Pain on hip extension β€” retrocaecal appendix (70% MC position)"],
        ["Obturator sign", "Pain on hip flexion β€” pelvic appendix (20–25%)"],
    ],
    col_widths=[50*mm, 120*mm]
))
story.append(sp(5))
story.append(hy_box([
    "IOC: Children = USG (diameter β‰₯6 mm) | Adults = CECT abdomen | Pregnancy = MRI (USG first)",
    "TOC: Laparoscopic appendectomy",
    "Appendicular lump β†’ Oschner-Sherren regimen (conservative)",
    "Tumor at tip <1 cm β†’ Appendectomy alone | At base or >2 cm β†’ Right hemicolectomy",
    "MC early complication: Wound infection | MC late complication: Adhesive intestinal obstruction",
    "MC nerve injured: Iliohypogastric nerve β†’ right-sided inguinal hernia risk",
    "Amyand's hernia = Inguinal hernia containing appendix",
]))
story.append(sp(8))
story.append(PageBreak())

# --- POLYPOSIS ---
story.append(chapter_header("SECTION 3 (cont.): POLYPOSIS + CA COLON/RECTUM", colors.HexColor("#1B5E20")))
story.append(sp(6))
story.append(section_box("COLONIC POLYPOSIS SYNDROMES β€” All Autosomal Dominant!", GREEN_LIGHT, GREEN))
story.append(sp(4))
story.append(make_table(
    ["Feature", "Peutz-Jeghers", "FAP", "HNPCC / Lynch"],
    [
        ["Mutation", "STK11", "APC gene", "Mismatch repair (MSH, MLH)"],
        ["Polyp type", "Hamartomas (non-neoplastic)", "Adenomatous (>100)", "Few adenomas"],
        ["Location", "Small bowel + Colon + Rectum", "Colon + Rectum", "RIGHT colon (MC)"],
        ["CRC Risk", "Slightly ↑", "100% by 20s", "~80%"],
        ["Management", "Surveillance", "Prophylactic proctocolectomy before age 20", "Surveillance colonoscopy"],
        ["Other cancers", "Pancreatic adenoCA", "Gardner: osteomas, brain tumors (Turcot)", "Pancreatic, endometrial, ovarian"],
    ],
    col_widths=[32*mm, 46*mm, 46*mm, 46*mm]
))
story.append(sp(5))
story.append(hy_box([
    "Peutz-Jeghers: Lip/mucosal MELANOSIS β€” pathognomonic; hamartomas on small bowel",
    "FAP: >100 adenomas = practically diagnostic; 100% cancer risk β†’ prophylactic proctocolectomy BEFORE age 20",
    "HNPCC: Non-polyposis (FEW adenomas) but HIGH cancer risk; RIGHT colon predominance",
]))
story.append(sp(8))

story.append(section_box("CA COLON & RECTUM", GREEN_LIGHT, GREEN))
story.append(sp(4))
story.append(mnemonic_box("Blood in Stools by AGE", [
    "Elderly Male Smoker β†’ COLORECTAL CANCER",
    "Young patient (20s) β†’ ULCERATIVE COLITIS",
    "Child β†’ POLYP or MECKEL'S DIVERTICULUM",
]))
story.append(sp(5))
story.append(hy_box([
    "MC site: Rectosigmoid (Rectum 38% + Sigmoid 21% = ~60%)",
    "IOC: Colonoscopy + Biopsy (Adenocarcinoma β€” MC histology)",
    "Local staging RECTUM: MRI rectum (preferred over EUS)",
    "Local staging COLON: CECT abdomen | Distant mets: PET scan",
    "Tumor marker: CEA (Carcinoembryonic Antigen)",
    "Hematogenous spread: MC site = LIVER (50% of liver mets come from CRC)",
    "GI cancers β†’ LIVER mets | Urinary cancers β†’ LUNG/BONE mets",
    "Metformin + Aspirin are protective but NOT for prophylactic use",
]))
story.append(sp(5))
story.append(mnemonic_box("CA RECTUM β€” Special Rule", [
    "CA RECTUM = ONLY GI cancer where NEOADJUVANT CHEMORADIATION is given",
    "All other GI cancers β†’ Neoadjuvant CHEMO ONLY",
    "Chemo regimens: FOLFOX | FOLFIRI | FOLFOXIRI (5-FU based)",
]))
story.append(sp(5))
story.append(mnemonic_box("Nerve Injury in Rectal Surgery (NEET PG 2023)", [
    "P for POINTING (erection) = PARASYMPATHETIC injury (Nervi erigentes S2–S4) β†’ IMPOTENCE",
    "S for SHOOTING (ejaculation) = SYMPATHETIC injury (Lumbar sympathetics L3–L4) β†’ RETROGRADE EJACULATION",
    "Injury during: High IMA ligation β†’ Sympathetic | Lateral/AP dissection β†’ Parasympathetic",
]))
story.append(sp(8))
story.append(PageBreak())

# --- INTUSSUSCEPTION / VOLVULUS / ILEUS ---
story.append(chapter_header("SECTION 3 (cont.): OBSTRUCTION + VOLVULUS", colors.HexColor("#1B5E20")))
story.append(sp(6))

story.append(section_box("INTUSSUSCEPTION", GREEN_LIGHT, GREEN))
story.append(sp(4))
story.append(hy_box([
    "MC type in CHILDREN: Ileocolic | Lead point: Hypertrophied Peyer's patches",
    "MC type in ADULTS: Colocolic | Lead point: Tumors",
    "Age: Weaning period (6 months – 1 year)",
    "Classic: RED CURRANT JELLY STOOLS (mucosal ischemia)",
    "Mass: Para-umbilical sausage-shaped | Sign of Dance: RIF feels empty",
    "USG: Donut/Target appearance | Barium enema: CLAW sign",
    "Treatment: STABLE β†’ High-pressure enema (hydro-reduction) | UNSTABLE β†’ Surgery",
]))
story.append(sp(8))

story.append(section_box("SIGMOID VOLVULUS", GREEN_LIGHT, GREEN))
story.append(sp(4))
story.append(hy_box([
    "Anti-clockwise twist of sigmoid β†’ CLOSED LOOP OBSTRUCTION β†’ TRUE SURGICAL EMERGENCY",
    "Elderly patient, chronic constipation, sudden massive distension + obstipation",
    "X-ray: COFFEE BEAN SIGN (also called: Bent inner tube sign)",
    "Management: X-ray β†’ CECT (assess ischemia)",
    "No ischemia: Colonoscopic decompression β†’ Elective sigmoidectomy after 2–3 days",
    "Ischemia / failed: Emergency sigmoidectomy",
]))
story.append(sp(8))

story.append(section_box("PARALYTIC ILEUS vs MECHANICAL OBSTRUCTION", GREEN_LIGHT, GREEN))
story.append(sp(4))
story.append(make_table(
    ["Feature", "Paralytic Ileus", "Mechanical Obstruction"],
    [
        ["Pain", "NO colicky pain", "Colicky pain PRESENT"],
        ["Bowel sounds", "ABSENT", "Present (exaggerated/high-pitched)"],
        ["Air-fluid levels", "Absent / diffuse dilated bowel", "Step-ladder pattern"],
        ["Air in rectum", "Present", "Absent (distal collapse)"],
        ["MC cause", "Post-laparotomy", "Adhesions (MC in adults)"],
        ["MC electrolyte abnormality", "Hypokalemia", "Variable"],
        ["Management", "NPO + IV fluids + correct K+ (2–3 days)", "CECT abdomen β†’ Surgery"],
    ],
    col_widths=[50*mm, 60*mm, 60*mm]
))
story.append(sp(8))
story.append(PageBreak())

# ──────────────────────────────────────────────────────────────────────────────
# SECTION 4 β€” ANAL DISORDERS
# ──────────────────────────────────────────────────────────────────────────────
story.append(chapter_header("SECTION 4: ANAL DISORDERS", colors.HexColor("#4A148C")))
story.append(sp(6))

story.append(section_box("FISTULA IN ANO β€” Park's Classification", PURPLE_LIGHT, PURPLE))
story.append(sp(4))
story.append(make_table(
    ["Type", "Name", "Course", "Frequency", "Classification"],
    [
        ["1", "Intersphincteric", "Between internal & external sphincter", "MC", "LOW"],
        ["2", "Transsphincteric", "Crosses through external sphincter", "2nd MC", "LOW"],
        ["3", "Suprasphincteric", "Above ext sphincter, crosses levator ani", "Rare", "HIGH"],
        ["4", "Extrasphincteric", "From rectum to perianal skin", "Least common", "HIGH"],
    ],
    col_widths=[14*mm, 38*mm, 56*mm, 28*mm, 34*mm]
))
story.append(sp(5))
story.append(hy_box([
    "IOC: MRI Perineum (Goodsall's Rule predicts course of fistula tract)",
    "LOW fistula (Types 1 & 2): Fistulectomy or Fistulotomy",
    "HIGH/Complex fistula (Types 3 & 4): Seton insertion (Kshar Sutra)",
    "Seton = sphincter-saving; causes fibrosis to close tract over weeks",
    "Cause: Usually secondary to perianal abscess β†’ then discharge",
]))
story.append(sp(8))

story.append(section_box("HEMORRHOIDS", PURPLE_LIGHT, PURPLE))
story.append(sp(4))
story.append(hy_box([
    "Origin: ABOVE dentate line (dilated superior hemorrhoidal veins)",
    "Presentation: PAINLESS bleeding = 'Splash in the pan'",
    "IOC: Proctoscopy β€” seen at 3, 7, 11 o'clock positions",
    "ALWAYS do DRE first! If anal spasm β†’ Proctoscopy CONTRAINDICATED (vasovagal risk)",
]))
story.append(sp(4))
story.append(make_table(
    ["Grade", "Description", "Treatment"],
    [
        ["Grade 1", "Inside anus, asymptomatic (or bleeding)", "Conservative / Barron's band ligation / Sclerotherapy"],
        ["Grade 2", "Exit but return spontaneously", "Barron's band ligation or Sclerotherapy"],
        ["Grade 3", "Exit anus, manually reducible", "Stapled hemorrhoidopexy or Milligan-Morgan"],
        ["Grade 4", "Permanently outside, irreducible", "Stapled hemorrhoidopexy or Milligan-Morgan open"],
    ],
    col_widths=[22*mm, 58*mm, 90*mm]
))
story.append(sp(8))

story.append(section_box("FISSURE IN ANO", PURPLE_LIGHT, PURPLE))
story.append(sp(4))
story.append(teal_box([
    "Fissure: BELOW dentate line | Hemorrhoids: ABOVE dentate line",
    "Fissure: PAINFUL (MC painful condition) | Hemorrhoids: PAINLESS",
    "Fissure bleeding: STREAKING pattern | Hemorrhoids: SPLASH in the pan",
    "Proctoscopy CONTRAINDICATED in fissure (anal spasm present)",
    "Sentinel pile = skin tag covering the ulcer (misnomer β€” NOT a true pile mass)",
]))
story.append(sp(4))
story.append(green_box([
    "Conservative: Laxatives + Lignocaine gel + Sitz bath",
    "Surgery: Lateral Internal Sphincterotomy (of Notaras) β€” cut internal sphincter to relieve spasm",
]))
story.append(sp(8))

story.append(section_box("PILONIDAL SINUS", PURPLE_LIGHT, PURPLE))
story.append(sp(4))
story.append(hy_box([
    "Site: UPPER END of natal cleft (overlying coccyx) β€” NOT near anal verge",
    "Contains hair (hair falls INTO the sinus, not grows from it)",
    "Seen in men with hairy back; clinical diagnosis",
    "Karydakis: Elliptical PARAMEDIAN excision (suture line avoids midline)",
    "Limberg flap: Rhomboid excision with local flap reconstruction",
    "Bascom: Linear paramedian incision β€” excise tracts from the side",
]))
story.append(sp(8))
story.append(PageBreak())

# ──────────────────────────────────────────────────────────────────────────────
# SECTION 5 β€” HERNIA
# ──────────────────────────────────────────────────────────────────────────────
story.append(chapter_header("SECTION 5: HERNIA", colors.HexColor("#BF360C")))
story.append(sp(6))

story.append(section_box("INGUINAL HERNIA", RED_LIGHT, RED))
story.append(sp(4))
story.append(make_table(
    ["Type", "Defect", "Key Feature"],
    [
        ["Indirect (MC overall)", "Deep ring (fascia transversalis)", "Enters scrotum; any age; accompanies spermatic cord"],
        ["Direct", "Hesselbach's triangle (weakness)", "Purely inguinal (doesn't enter scrotum); elderly men"],
        ["Femoral", "Femoral ring", "More common in females vs males β€” but NOT MC hernia in females!"],
    ],
    col_widths=[40*mm, 55*mm, 75*mm]
))
story.append(sp(5))
story.append(mnemonic_box("Hesselbach's Triangle β€” 'RIL'", [
    "R β€” Rectus abdominis (medial border)",
    "I β€” Inferior epigastric artery (lateral border)",
    "L β€” Inguinal ligament (inferior border)",
    "Direct hernia = MEDIAL to inferior epigastric artery (inside triangle)",
    "Indirect hernia = LATERAL to inferior epigastric artery (outside triangle)",
]))
story.append(sp(5))
story.append(mnemonic_box("EHS Classification β€” 'Don't use D and I, use M and L'", [
    "M = Medial (Direct) | L = Lateral (Indirect) | F = Femoral",
    "1 = <1.5 cm | 2 = <3 cm | 3 = >3 cm",
    "P = Primary | R = Recurrent",
    "Example: Primary + Direct + 3cm defect = PM2 (NOT PD2!)",
]))
story.append(sp(5))
story.append(make_table(
    ["Named Hernia", "Content", "Key Feature"],
    [
        ["Richter's", "Part/knuckle of bowel WALL only", "HIGH strangulation risk with NO obstruction (no lumen involved)"],
        ["Maydl's (W hernia)", "TWO loops of bowel (W-shape)", "Middle loop most vulnerable"],
        ["Amyand's", "Appendix inside hernia", "Inguinal hernia containing appendix β€” PYQ"],
        ["Littre's", "Meckel's diverticulum", "Very rare"],
    ],
    col_widths=[35*mm, 50*mm, 85*mm]
))
story.append(sp(5))
story.append(hy_box([
    "TOC Repair: Lichtenstein's tension-free hernioplasty β€” Mesh = Polypropylene (Prolene) β€” ONLAY",
    "Open repair MC nerve injured: ILIOINGUINAL nerve β†’ sensory loss at root of penis/inner thigh",
    "Laparoscopic (TAPP/TEP) MC nerve injured: LATERAL CUTANEOUS NERVE OF THIGH β†’ Meralgia paraesthetica",
    "Laparoscopic: Can repair Direct + Indirect + Femoral + Obturator ALL AT ONCE",
]))
story.append(sp(5))
story.append(mnemonic_box("Triangles in Laparoscopic Inguinal Repair", [
    "TRIANGLE OF DOOM: Vas deferens (medial) + Testicular vessels (lateral)",
    "  β†’ Contains: External iliac vessels + Genital branch of Genitofemoral nerve",
    "  β†’ Risk: Vascular injury (avoid dissecting here!)",
    "TRIANGLE OF PAIN: Testicular vessels (medial) + Ilio-pubic tract (lateral)",
    "  β†’ Contains: Lateral cutaneous nerve of thigh, Femoral nerve, Femoral branch of GFN",
    "  β†’ Risk: Nerve injury β†’ chronic pain / meralgia paraesthetica",
]))
story.append(sp(8))
story.append(PageBreak())

# ──────────────────────────────────────────────────────────────────────────────
# SECTION 6 β€” HEPATOBILIARY
# ──────────────────────────────────────────────────────────────────────────────
story.append(chapter_header("SECTION 6: HEPATOBILIARY DISORDERS", colors.HexColor("#006064")))
story.append(sp(6))

story.append(section_box("HYDATID CYST OF LIVER", TEAL_LIGHT, TEAL))
story.append(sp(4))
story.append(mnemonic_box("Echinococcus Host Chain", [
    "Definitive host: DOG (adult worm lives here)",
    "Intermediate host: SHEEP (cysts form here)",
    "Man = ACCIDENTAL / DEAD-END host",
    "MC site: LIVER | 2nd MC: LUNGS (via portal vein)",
]))
story.append(sp(5))
story.append(hy_box([
    "FNAC / Biopsy: ABSOLUTELY CONTRAINDICATED (anaphylaxis + spillage risk)",
    "USG: Water lily sign (floating membrane) | CT: Honeycombing (multiseptated)",
    "Active/Symptomatic: Albendazole Γ—3 weeks β†’ PAIR procedure (TOC)",
    "Inactive/Calcified/Asymptomatic: Surveillance only",
]))
story.append(sp(5))
story.append(mnemonic_box("PAIR Procedure", [
    "P β€” Puncture (under image guidance)",
    "A β€” Aspirate contents",
    "I β€” Inject scolicidal agent (10% hypertonic saline OR 10% Povidone iodine)",
    "R β€” Re-aspirate",
    "PAIR CONTRAINDICATED: Deep/inaccessible | Multiseptated | Cysto-biliary communication",
]))
story.append(sp(8))

story.append(section_box("LIVER ABSCESS β€” Pyogenic vs Amebic", TEAL_LIGHT, TEAL))
story.append(sp(4))
story.append(green_box([
    "PYOGENIC = Real abscess β†’ DRAINAGE IS MANDATORY",
    "AMEBIC = Not a real abscess (liquefied liver) β†’ MEDICAL MANAGEMENT IS TOC",
]))
story.append(sp(5))
story.append(make_table(
    ["Feature", "Pyogenic", "Amebic"],
    [
        ["Organism", "E. coli / Klebsiella", "Entamoeba histolytica"],
        ["Pathway", "Ascending cholangitis (MC)", "Feco-oral β†’ Cyst β†’ Gut β†’ Portal vein β†’ Liver"],
        ["Number", "Usually MULTIPLE", "Usually SOLITARY"],
        ["Pus character", "True pus", "ANCHOVY SAUCE (dark brown; dead liver + few RBCs/WBCs)"],
        ["Presentation", "Acute, HIGH fever", "Subacute, mild symptoms"],
        ["Treatment", "Antibiotics + DRAINAGE (always)", "High-dose Metronidazole + Diloxanide furoate (10–14 days)"],
        ["Drainage", "ALWAYS needed", "ONLY if non-responsive, size >5 cm, subcapsular, left lobe"],
    ],
    col_widths=[38*mm, 66*mm, 66*mm]
))
story.append(sp(8))
story.append(PageBreak())

# ──────────────────────────────────────────────────────────────────────────────
# MASTER QUICK-REFERENCE PAGE
# ──────────────────────────────────────────────────────────────────────────────
story.append(chapter_header("MASTER QUICK-REFERENCE: ALL MNEMONICS & DIFFERENTIATORS", colors.HexColor("#37474F")))
story.append(sp(6))

story.append(section_box("MNEMONICS AT A GLANCE", GREY_LIGHT, colors.HexColor("#37474F")))
story.append(sp(5))

mnemonics_data = [
    ["THREE CITIES", "Chicago = Achalasia Manometry | Montreal = GERD Definition | LA = GERD Grading"],
    ["AAA Syndrome", "Adrenal insufficiency + Alacrymia + Achalasia (Allgrove Syndrome)"],
    ["Mackler's Triad", "Chest pain + Retching + Subcutaneous emphysema (Boerhaave Syndrome)"],
    ["4S + 1D (CA Stomach)", "Smoking + Spirits + Sepsis (H.pylori) + Smoked foods + Diet"],
    ["Virchow/Krukenberg", "Virchow = Left supraclavicular | Krukenberg = Bilateral ovaries | Irish = Left axilla"],
    ["IHPS Metabolic Triad", "Hypokalemia + Hypochloremia + Metabolic Alkalosis + Paradoxical Aciduria"],
    ["MANTRELS (Appendix)", "Migration + Anorexia + Nausea + Tenderness(2) + Rebound + Elevated T + Leucocytosis(2) + Shift"],
    ["Blood in Stools Age", "Elderly male smoker = CRC | Young (20s) = UC | Child = Polyp/Meckel's"],
    ["P for Pointing", "Parasympathetic injury β†’ Impotence (erection lost) β€” rectal surgery"],
    ["S for Shooting", "Sympathetic injury β†’ Retrograde ejaculation β€” rectal surgery"],
    ["TAD (Rectal Prolapse)", "Thiersch + Altemeier + Delorme = Perineal procedures (elderly/unfit)"],
    ["PAIR Procedure", "Puncture + Aspirate + Inject scolicidal + Re-aspirate (Hydatid cyst)"],
    ["Dual Endotherapy", "Any 2 of: Clip + Adrenaline injection + APC (UGI bleed Forrest I)"],
    ["Rockall ABCDE", "Age + BP + Comorbidities + Diagnosis + Endoscopic appearance"],
    ["Hesselbach's RIL", "Rectus (medial) + Inferior epigastric (lateral) + Inguinal ligament (inferior)"],
    ["Triangle of DOOM", "Vas deferens + Testicular vessels = External iliac vessels = Vascular injury risk"],
    ["Triangle of PAIN", "Testicular vessels + Ilio-pubic tract = Nerve-dense area = Chronic pain risk"],
]

mnemonics_table = make_table(
    ["Mnemonic / Rule", "What It Means"],
    mnemonics_data,
    col_widths=[52*mm, 118*mm],
    header_bg=PURPLE
)
story.append(mnemonics_table)
story.append(sp(8))

story.append(section_box("KEY DIFFERENTIATORS EXAM TABLE", GREY_LIGHT, colors.HexColor("#37474F")))
story.append(sp(5))
diff_data = [
    ["Achalasia dysphagia", "LIQUIDS > SOLIDS", "Malignancy dysphagia", "SOLIDS > LIQUIDS"],
    ["Fissure bleeding", "STREAKING (painful)", "Hemorrhoid bleeding", "SPLASH (painless)"],
    ["TB ulcers", "TRANSVERSE β†’ Stricture", "Typhoid ulcers", "LONGITUDINAL β†’ No stricture"],
    ["Pilonidal sinus site", "Upper natal cleft (coccyx)", "Fistula in ano site", "Near anal verge"],
    ["Ripstein procedure", "ABDOMINAL (rectopexy)", "Altemeier/Delorme", "PERINEAL"],
    ["Pyogenic abscess", "Multiple, true pus, DRAIN always", "Amebic abscess", "Solitary, anchovy sauce, MEDICAL TOC"],
    ["Corrosive alkali", "Liquefaction (deep, worse)", "Corrosive acid", "Coagulation (shallow, eschar limits)"],
    ["Early dumping", "Low BP + Normal sugar", "Late dumping", "Normal BP + Low sugar"],
    ["Rockall score", "Rebleed + Mortality", "Glasgow-Blatchford", "Endoscopy NOT included"],
    ["Direct hernia", "Medial (M) β€” Hesselbach's", "Indirect hernia", "Lateral (L) β€” Deep ring"],
],
diff_table_data = [["Condition A", "Finding A", "Condition B", "Finding B"]]
for row in diff_data:
    diff_table_data.append(row)

diff_st_h = S("_dh", fontName="Helvetica-Bold", fontSize=8.5, textColor=WHITE,
              alignment=TA_CENTER, leading=11)
diff_st_a = S("_da", fontName="Helvetica-Bold", fontSize=8.5, textColor=TEAL,
              alignment=TA_LEFT, leading=11)
diff_st_b = S("_db", fontName="Helvetica-Bold", fontSize=8.5, textColor=RED,
              alignment=TA_LEFT, leading=11)
diff_st_n = S("_dn", fontName="Helvetica", fontSize=8.5, textColor=BLACK,
              alignment=TA_LEFT, leading=11)

formatted_diff = [[Paragraph(h, diff_st_h) for h in ["Condition A", "Finding A", "Condition B", "Finding B"]]]
for row in diff_data:
    formatted_diff.append([
        Paragraph(row[0], diff_st_a),
        Paragraph(row[1], diff_st_n),
        Paragraph(row[2], diff_st_b),
        Paragraph(row[3], diff_st_n),
    ])

dt = Table(formatted_diff, colWidths=[38*mm, 47*mm, 38*mm, 47*mm], repeatRows=1)
dt.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), TEAL),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, TEAL_LIGHT]),
    ("GRID", (0,0), (-1,-1), 0.4, GREY_MED),
    ("TOPPADDING", (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
    ("LINEAFTER", (1,1), (1,-1), 1.5, GREY_MED),
]))
story.append(dt)
story.append(sp(8))
story.append(PageBreak())

# ──────────────────────────────────────────────────────────────────────────────
# INVESTIGATIONS QUICK-REF
# ──────────────────────────────────────────────────────────────────────────────
story.append(chapter_header("IOC / STAGING QUICK-REFERENCE", colors.HexColor("#1A237E")))
story.append(sp(6))

story.append(make_table(
    ["Condition", "1st Step", "IOC / Diagnosis", "Local Staging", "Distant Staging"],
    [
        ["Achalasia", "UGI Endoscopy (rule out malignancy)", "High-Resolution Manometry (HRM)", "β€”", "β€”"],
        ["GERD", "UGI Endoscopy (LA grading)", "24-hr pH Study (DeMeester >14.7)", "β€”", "β€”"],
        ["Esophageal Perforation", "X-ray chest", "CT with water-soluble contrast", "β€”", "β€”"],
        ["CA Esophagus", "UGI Endoscopy + Biopsy", "UGI Endoscopy + Biopsy", "EUS (T-stage)", "PET Scan"],
        ["CA Stomach", "UGI Endoscopy + Biopsy", "UGI Endoscopy + Biopsy", "EUS (T-stage)", "PET Scan"],
        ["IHPS", "USG abdomen", "USG (pylorus β‰₯4 mm)", "β€”", "β€”"],
        ["PU Perforation", "X-ray chest (pneumoperitoneum)", "CECT abdomen", "β€”", "β€”"],
        ["Intestinal TB (stable)", "Stool exam", "Colonoscopy + Biopsy (CBNAAT)", "β€”", "β€”"],
        ["Intestinal TB (acute)", "X-ray abdomen", "CECT abdomen", "β€”", "β€”"],
        ["Appendicitis (Adults)", "USG abdomen", "CECT abdomen", "β€”", "β€”"],
        ["Appendicitis (Children)", "USG abdomen", "USG (diameter β‰₯6 mm)", "β€”", "β€”"],
        ["Appendicitis (Pregnancy)", "USG abdomen", "MRI appendix", "β€”", "β€”"],
        ["CA Colon", "Stool exam", "Colonoscopy + Biopsy", "CECT abdomen", "PET Scan"],
        ["CA Rectum", "Stool exam", "Colonoscopy + Biopsy", "MRI rectum", "PET Scan"],
        ["Intussusception", "USG abdomen", "USG (donut sign)", "β€”", "β€”"],
        ["Sigmoid Volvulus", "X-ray abdomen (coffee bean)", "CECT abdomen (ischemia)", "β€”", "β€”"],
        ["Fistula in Ano", "DRE + Proctoscopy", "MRI perineum", "β€”", "β€”"],
        ["Hydatid Cyst", "USG abdomen", "CT abdomen (honeycombing)", "β€”", "β€”"],
        ["Liver Abscess (Pyogenic)", "USG abdomen", "Image-guided aspiration", "β€”", "β€”"],
        ["Zenker's Diverticulum", "β€”", "Barium Swallow (lateral view)", "β€”", "β€”"],
        ["Hiatus Hernia", "β€”", "CT with oral contrast / Barium meal", "β€”", "β€”"],
    ],
    col_widths=[35*mm, 37*mm, 42*mm, 30*mm, 26*mm]
))
story.append(sp(8))
story.append(PageBreak())

# ──────────────────────────────────────────────────────────────────────────────
# FINAL REVISION FLASH FACTS
# ──────────────────────────────────────────────────────────────────────────────
story.append(chapter_header("FINAL RAPID FIRE β€” EXAM FLASH FACTS", colors.HexColor("#B71C1C")))
story.append(sp(6))

flash_facts = [
    ("Achalasia", [
        "MC motility disorder of esophagus",
        "HRM shows: Absent peristalsis + Elevated LES pressure (BOTH cardinal findings)",
        "Type 2 has best response to treatment",
        "Type 3 (Spastic) TOC = POEM",
        "Eckhardt score: Triad + Heartburn = 4 components",
    ]),
    ("Barrett's Esophagus", [
        "Squamous β†’ Columnar metaplasia (intestinal metaplasia)",
        "Seattle protocol: 4-quadrant biopsy at 2 cm intervals",
        "High-grade dysplasia = 7%/year adenocarcinoma risk",
        "NBI (Narrow Band Imaging) = Blue light endoscopy for better visualization",
    ]),
    ("CA Stomach", [
        "Adenocarcinoma | MC site: Antrum",
        "H. pylori β†’ Type B gastritis (antral)",
        "Bormann's classification: Advanced CA stomach (gross appearance)",
        "D2 lymphadenectomy = standard of care",
        "FLOT regimen = chemotherapy of choice",
    ]),
    ("Ramstedt's Pyloromyotomy", [
        "Order: Adventitia β†’ Muscularis β†’ STOP (do NOT cut mucosa)",
        "Fluid before surgery: DNS with KCl",
        "DDx: Neonatal GERD (non-projectile; improves with growth)",
    ]),
    ("PUD Surgery", [
        "Best tolerated: HSV (mortality <0.2%, side effects <5%)",
        "Lowest recurrence: TV + Antrectomy (1%) but highest complications",
        "Billroth II > Billroth I (more commonly done; more complications)",
        "Dumping = complication of gastrectomy/GJ anastomosis",
    ]),
    ("Appendicitis", [
        "Appendix: Arises at convergence of taenia coli on cecum",
        "Has mesoappendix (Meckel's is antimesenteric)",
        "Retrocaecal = MC position (70%) = Psoas sign",
        "Phlegmon = Oschner-Sherren (conservative, NO surgery acutely)",
        "Amyand's = appendix inside inguinal hernia (PYQ)",
    ]),
    ("Rectal Prolapse", [
        "Perineal (TAD): Thiersch + Altemeier (strangulated) + Delorme",
        "TOC: Laparoscopic ventral mesh rectopexy (abdominal; young/fit)",
        "Ripstein = ABDOMINAL procedure (asked: which is NOT perineal?)",
    ]),
    ("Hernia Repair", [
        "Herniotomy: Only for congenital hernia/hydrocele (sac excision only)",
        "Lichtenstein: Tension-free, Prolene mesh, ONLAY placement",
        "IPOM: DUAL/COMPOSITE mesh (Prolene + collagen/PTFE); non-adhering side faces bowel",
        "Mesh must be 3–5 cm LARGER than defect on ALL sides (IPOM rule)",
    ]),
    ("Hydatid/Liver Abscess", [
        "Hydatid: FNAC CONTRAINDICATED; Water lily sign on USG",
        "Anchovy sauce = Amebic abscess (sterile; organism at border only)",
        "Amebic: Metronidazole + Diloxanide; drain ONLY if >5 cm/non-responsive",
        "Pyogenic: ALWAYS drain (true pus; ascending cholangitis MC cause)",
    ]),
]

for topic, facts in flash_facts:
    story.append(KeepTogether([
        Paragraph(f"β–Έ  {topic}", S("_ft", fontName="Helvetica-Bold", fontSize=10,
                                    textColor=DARK_BLUE, leading=13, spaceBefore=6, spaceAfter=3)),
        *[Paragraph(f"   ✦  {f}", S("_ff", fontName="Helvetica", fontSize=8.5, textColor=BLACK,
                                     leading=12, leftIndent=8, spaceAfter=1)) for f in facts],
        HRFlowable(width="100%", thickness=0.4, color=GREY_MED, spaceBefore=4, spaceAfter=2),
    ]))

story.append(sp(10))

# back cover note
back = S("_bk", fontName="Helvetica-Oblique", fontSize=9, textColor=colors.HexColor("#555555"),
         alignment=TA_CENTER, leading=14)
story.append(Paragraph("All content sourced from: Cerebellum's Hyperrevision β€” 20th Course (Surgery Part 1)", back))
story.append(Paragraph("@AnandxBotss  |  Compiled for rapid exam revision", back))

# ── BUILD ──────────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=15*mm, rightMargin=15*mm,
    topMargin=18*mm, bottomMargin=15*mm,
    title="Surgery Part 1 β€” Mnemonics & High-Yield Facts",
    author="Cerebellum Hyperrevision 20th Course",
)

# Cover page uses different template
def cover_canvas(canvas_obj, doc):
    cover_page(canvas_obj, doc)

def normal_canvas(canvas_obj, doc):
    add_page_number(canvas_obj, doc)

# Build with page number from page 2 onwards
doc.build(story,
          onFirstPage=cover_canvas,
          onLaterPages=normal_canvas)

print(f"PDF created: {OUTPUT}")
import os
size = os.path.getsize(OUTPUT)
print(f"File size: {size/1024:.1f} KB")
Running Command

cd /tmp/workspace/surgery-summary && python3 create_pdf.py 2>&1

Editing File

~/surgery-summary/create_pdf.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/surgery-summary/create_pdf.py'
Reading File
Running Command

cd /tmp/workspace/surgery-summary && python3 create_pdf.py 2>&1

Running Command

python3 -c " from pypdf import PdfReader r = PdfReader('/tmp/workspace/surgery-summary/Surgery_Mnemonics_HY_Facts.pdf') print(f'Total pages: {len(r.pages)}') for i, page in enumerate(r.pages): text = page.extract_text() first_line = text.strip().split('\n')[0][:80] if text.strip() else '[empty]' print(f' Page {i+1}: {first_line}') "

PDF ready hai! Download karo:

Surgery Mnemonics HY Facts

PDF Document Β· PDF


PDF mein kya hai (18 pages):

SectionContent
Cover PageStyled title page with course info
Section 1 - EsophagusAchalasia (Chicago/Montreal/LA mnemonic), Boerhaave (Mackler's Triad), GERD, Barrett's, Hiatus Hernia, Fundoplications
Section 2 - Stomach & DuodenumCA Stomach (4S+1D, metastasis signs), IHPS (metabolic triad, Ramstedt's), PUD (Johnson's classification, vagotomy comparison), Dumping syndrome table, Forrest classification + Dual Endotherapy
Section 3 - IntestinesTB vs Crohn's differentiator table, Alvarado MANTRELS score, Appendicitis signs, Polyposis syndromes, CA Colon/Rectum, Nerve injury mnemonics (P=Pointing, S=Shooting), Intussusception, Sigmoid Volvulus, Paralytic Ileus vs Obstruction
Section 4 - Anal DisordersPark's Classification table, Hemorrhoid grading, Fissure vs Hemorrhoid differentiator, Pilonidal procedures
Section 5 - HerniaInguinal hernia types, Hesselbach's RIL, EHS classification, Named hernias, Triangle of Doom vs Pain
Section 6 - HepatobiliaryHydatid cyst hosts + PAIR mnemonic, Pyogenic vs Amebic abscess comparison
Master Quick-ReferenceAll 17 mnemonics at a glance + 10-row differentiator table
IOC Quick-Reference21 conditions with 1st step, IOC, staging in one table
Final Rapid FireFlash facts for last-day revision

Ab meri bat sun Bsdk Mujhe nhj ati surgery bilkul tera kam hai mere mind m dalna achse se smjna aya Smj m tere Kyu kse ye Kyu hua yahi ku hai sub kuvh smj gya na tutor h fmge net pg ka tu

Asking for Preferences
Perfect. Story style mein le chalta hoon tujhe β€” aaj se tu doctor nahi, detective hai. Patient aata hai, tu sochta hai. Chalo shuru karte hain.

πŸ₯ ESOPHAGUS β€” Complete Story-Based Tutorial


🎬 SCENE 1: "Pani peeney mein bhi takleef ho rahi hai..."

Patient: Sunita, 42 saal, housewife, Delhi

Sunita 6 mahine se bol rahi hai:
"Doctor, khaana atak jaata hai... aur ajeeb baat yeh hai β€” pani peeney mein bhi utni hi takleef hoti hai jitni roti khaane mein. Aur kabhi kabhi khaana wapas aa jaata hai... seedha munh mein."
Tujhe kya laga pehli baar padh ke? Shayad cancer? Stricture?

🧠 RUK. YE CLUE DEKH:

Pani + Solid dono mein equally problem = MOTILITY disorder, NOT blockage
Agar blockage hoti (cancer, stricture) toh:
  • Pehle solid mein problem hoti
  • Pani easily nikal jaata
  • Kyunki pani toh gravity se bhi nikal jaata hai
Lekin yahan pani bhi nahi nikal raha β€” matlab esophagus ki muscle hi kaam nahi kar rahi. Wo push nahi kar rahi neechey ki taraf.
Yahi hai ACHALASIA ka fingerprint.

πŸ”¬ Andar kya ho raha hai? (Pathophysiology)

Normal esophagus mein kya hota hai?
Tum khaana khaate ho
      ↓
Esophagus ki muscles ek wave mein contract karti hain (peristalsis)
      ↓
Lower Esophageal Sphincter (LES) β€” yeh "darwaza" hai stomach ka
      ↓
Khaana aata hai β†’ LES RELAX karta hai β†’ khaana stomach mein jaata hai
      ↓
βœ… Done!
Achalasia mein kya ho raha hai?
Sunita khaana khaati hai
      ↓
Peristalsis hoti hi NAHI (absent) β€” waves nahi bantin
      ↓
LES ka darwaza KABHI NAHI KHULTA (relax nahi karta)
      ↓
Khaana esophagus mein jam jaata hai
      ↓
Pressure badhta hai β†’ khaana wapas aata hai (regurgitation)
      ↓
Woh khata nahi ➜ Weight loss
WHY LES relax nahi karta?
Esophagus ke neeche Auerbach's plexus mein ek special nerve cell hoti hai β€” inhibitory neurons β€” jo LES ko "relax ho ja" bolti hain.
Achalasia mein ye neurons destroy ho jaate hain (idiopathic β€” pata nahi kyun, bas ho jaata hai). Toh LES ko "khulne" ka signal hi nahi milta.

πŸ“‹ Diagnosis kaise karein?

Step 1: UGI Endoscopy (PEHLE)
Kyun? β€” Tumor/Stricture rule out karna zaroori hai! Agar yeh cancer hai toh treatment alag hoga.
Endoscopy mein kya dikhega Achalasia mein?
  • Esophagus dilated hai, khaana jam raha hai
  • LES tight hai but endoscope push karke nikal jaata hai (pops through β€” cancer mein aisa nahi hota)
  • Koi tumor nahi dikhega
Lekin endoscopy diagnose nahi karti Achalasia ko β€” kyunki Achalasia ek motility disorder hai, muscle problem hai, structure normal dikhta hai!
Step 2: IOC = Manometry (HRM)
Yahan tube naak se daalo, esophagus mein pressure sensors hain β€” real-time mein dekhte hain ki wave ban rahi hai ya nahi, LES khul raha hai ya nahi.
Achalasia mein manometry ka result:
  1. Absent peristalsis β€” koi wave nahi
  2. High resting LES pressure β€” darwaza tight banda hai
DONO milne chahiye. Ek bhi missing toh Achalasia nahi.

πŸ—ΊοΈ Chicago Classification (WHY 3 types?)

Same disease, different severity aur mechanism:
Type 1 β€” Classic (MC)
  • Esophagus dead hai β€” koi kaam nahi karta
  • Bas LES tight hai
  • Think: "Completely paralyzed esophagus"
Type 2 β€” Most treatable
  • LES tight hai
  • Peristalsis nahi hai
  • BUT β€” pressure waves pan-esophageal banti hain (poora esophagus ek saath squeeze hota hai, waves nahi)
  • Think: "Trying but failing uniformly"
  • Best response to treatment β€” kyunki kuch function bacha hai
Type 3 β€” Spastic (Worst to treat)
  • LES tight hai
  • Peristalsis nahi
  • Lekin random premature spasms hote hain β€” esophagus mein pain bhi hoti hai!
  • Think: "Randomly jerking β€” out of control"
  • TOC = POEM β€” kyunki long myotomy chahiye (spasms tak pahuncho)

πŸ’Š Treatment β€” WHY kya?

Mild / Unfit patients:
  • CCBs (Calcium Channel Blockers): Calcium ke bina muscles contract nahi karti β€” LES thoda relax karta hai. Temporary relief only.
  • Botox injection: LES mein inject karo β€” nerve signals block β†’ LES temporarily relax hoti hai. Wears off in 6–12 months.
  • Pneumatic Dilation: Balloon se LES ko forcefully stretch karo β€” thodi muscular fibers tear β†’ LES thoda loose hoti hai. Risk of perforation.
Definitive Treatment:
Heller's Cardiomyotomy (Type 1 & 2):
Surgery mein doctor LES ki muscle ko longitudinally cut karta hai (6–7 cm esophagus + 2 cm stomach tak).
Soch ek tight rubber band ko length mein kaat do β€” wo ab tight nahi rahega. Khaana freely nikal jayega.
LES muscle cut βœ‚οΈ
      ↓
Darwaza permanently open
      ↓
Khaana nikal jaata hai βœ…
      ↓
Side effect: Ab reflux bhi ho sakta hai! (darwaza zyada khul gaya)
      ↓
Isliye saath mein partial fundoplication bhi karte hain (GERD rokne ke liye)
POEM β€” Per Oral Endoscopic Myotomy (Type 3):
Endoscope se karo β€” koi cut nahi skin par. Endoscope muh se daalo β†’ esophagus ki wall mein tunnel banao β†’ andar se muscle kato (Type 3 mein esophagus tak bhi cut karna padta hai β€” isliye POEM zyada flexible hai).

🎬 SCENE 2: "Seedha seedha GERD se Barrett's tak ka safar"

New Patient: Rahul, 28 saal, IT professional

"Roz raat ko seene mein jalan hoti hai, especially chai ke baad ya late dinner ke baad. 2 saal se hai."
Yeh clearly GERD lag raha hai. But tujhe samajhna hai ki yeh kyu hota hai aur kahan jaake ruk sakta hai.

🧠 GERD ki pathology β€” ek simple story

Normal mein:
Khaana khao β†’ stomach mein jaao β†’ LES band ho jaata hai (valve)
β†’ Acid stomach mein rehti hai βœ…
GERD mein:
LES weak ho jaata hai (smoking, alcohol, tea, coffee, stress β†’ ye sab LES tone kam karte hain)
β†’ Acid wapas esophagus mein aati hai
β†’ Esophagus ki lining acid handle nahi kar sakti (stomach ki lining kar sakti hai β€” coating hoti hai)
β†’ Burning / heartburn βœ…
Montreal Definition yaad karo aise:
"Reflux tabhi disease hai jab troublesome symptoms hon" (Sirf acid aana disease nahi β€” symptoms hone chahiye)

Investigations β€” WHY kaunsa kab?

UGI Endoscopy (1st step):
  • Actually erosions dekhte hain β€” LA Grading A (mild) to D (severe)
  • Barrett's rule out karte hain
  • Lekin endoscopy ek snapshot hai β€” wo teri actual acid exposure nahi batata
24-Hour pH Study (Gold Standard):
  • Patient ko 24 hours ek sensor wear karna padta hai esophagus mein
  • Har baar acid aati hai β†’ record hoti hai
  • Symptoms ke saath match karte hain
DeMeester Score > 14.7 = Positive β€” matlab itni zyada acid aa rahi hai ki yeh definitely GERD hai, koi doubt nahi.
Kab karte hain?
  • Atypical symptoms (cough, asthma, dental erosions) β€” endoscopy normal dikhti hai but GERD hai
  • Surgery se pehle confirm karna ho

πŸ”΄ Barrett's β€” Ye kyun hota hai? Kyun dangerous hai?

Rahul agar 10 saal treatment nahi karta:
Chronic acid exposure
      ↓
Esophagus ki lining (squamous cells) repeatedly damage hoti hai
      ↓
Body "repair" karti hai β€” lekin GALAT repair
      ↓
Squamous cells β†’ Columnar cells (intestinal type)
(Normal esophagus ki lining β†’ Stomach/Intestine type lining)
      ↓
YEH HAI BARRETT'S ESOPHAGUS
(Metaplasia = ek type ki normal cell β†’ dusre type ki normal cell)
Kyun dangerous?
Intestinal cells mein already thodi "abnormality" hoti hai. Agar acid exposure continue kare:
Columnar cells (Barrett's)
      ↓
Dysplasia (abnormal cells β€” pre-cancerous)
      ↓
Low grade dysplasia β†’ High grade β†’ Adenocarcinoma
Isliye surveillance karte hain β€” har few years colonoscopy (Seattle protocol: 4-quadrant biopsy har 2 cm par) β€” koi dysplastic area miss nahi hona chahiye.

Endoscopy mein kya dikhta hai?

Normal esophagus: Pale pink, smooth squamous lining Barrett's: Salmon-pink tongue-like projections β€” reddish patches jo GE junction se upar ki taraf badhti hain
NBI (Narrow Band Imaging) kyu use karte hain? Blue light mein blood vessels clearly dikhte hain β†’ dyplastic areas detect karna easy hota hai (vascular pattern change hoti hai)

🎬 SCENE 3: "Woh raat bhar peeta raha... aur subah toh..."

Patient: Suresh, 45 saal, alcoholic

Emergency mein aaya β€” chest mein unbearable dard, retching, gardan pe swelling
Teri pehli soch: Heart attack? Pneumonia?
Lekin Mackler's Triad dekh:
  1. βœ… Retrosternal chest pain
  2. βœ… Retching (ulti aane ki koshish)
  3. βœ… Subcutaneous emphysema (gardan/chest ki skin ke neeche air feel ho rahi hai β€” crunchy sensation)
Yeh hai BOERHAAVE SYNDROME

🧠 Kya hua exactly?

Raat bhar alcohol piya
      ↓
Subah bahut zyada ulti aayi (forceful vomiting)
      ↓
Stomach mein pressure suddenly bahut zyada badh gaya
      ↓
Esophagus ka sabse weak point β†’ LEFT LOWER ESOPHAGUS (Achilles heel of esophagus)
      ↓
Esophagus PHATT GAYA (transmural perforation β€” poori wall)
      ↓
Air + gastric contents β†’ mediastinum mein jaane lage
      ↓
Mediastinitis (mediastinum mein inflammation) = LIFE THREATENING
      ↓
Air skin ke neeche bhi aa gaya β†’ Subcutaneous emphysema
Contrast yeh karo: Instrumental perforation (during endoscopy) β†’ usually cricopharynx (15 cm) pe hoti hai β†’ cervical area β†’ relatively contained β†’ often conservative manage kar sakte hain.
Boerhaave β†’ Left lower esophagus β†’ Directly mediastinum mein β†’ ALWAYS surgical emergency.

IOC β€” Kyun water-soluble contrast? Barium kyun NAHI?

Barium non-absorbable hai. Agar esophagus perforate hai aur barium leak ho jaaye mediastinum mein:
  • Barium particles stay karte hain permanently
  • Chronic inflammation β†’ granulomas β†’ fibrosis
  • Patient ki haalat aur kharab ho jaati hai
Water-soluble contrast (Gastrografin): Absorb ho jaata hai body mein β€” safe to leak.
Exception: Barium zyada accurate hota hai small tears ke liye β€” par Boerhaave mein risk nahi lena.

🎬 SCENE 4: "Mujhe kuch nigalne mein nahi hota... Sirf solid mein problem hai"

New Patient: Ram Kishore, 62 saal, smoker, gutka khaata hai

"3 mahine pehle roti khate waqt thoda atakti thi, ab sirf liquid pi sakta hoon. Wajan bhi ghata hai."
STOP β€” compare kar pehle wale se:
FeatureAchalasia (Sunita)Cancer (Ram Kishore)
Age30–60, middle-agedElderly (60+)
DysphagiaLiquids = SolidsSolids PEHLE, then liquids
ProgressionSlow, yearsFast, weeks to months
RegurgitationOld food (esophagus se)β€”
Weight lossPresentProminent
Solids > Liquids kyun in cancer?
Cancer ek mechanical blockage bana raha hai β€” physical narrowing. Solid pieces phans jaate hain. Pani toh gap se bhi nikal jaata hai. As tumor grows, eventually pani bhi nahi nikalta.
Achalasia mein koi blockage nahi β€” muscle kaam nahi kar rahi β€” toh pani bhi nahi nikal sakta (no push).

Pseudoachalasia β€” Ye kya jhanjhat hai?

Kuch tumors (especially lower esophagus ke) itne close hote hain LES ke pas ki:
  • Tumor LES ke neurons ko damage kar deta hai
  • Manometry mein EXACTLY Achalasia jaisa pattern dikhta hai
  • Patient complain karta hai EXACTLY achalasia jaise (liquids = solids)
Yeh hai Pseudoachalasia β€” Achalasia ka mask pehne hua cancer!
Clue kaise pakdein:
  • Age > 55 + rapid progression + weight loss β†’ ALWAYS endoscopy pehle karo
  • Endoscopy mein tumor dikh jaayega
Isliye rule #1 Achalasia workup mein = PEHLE UGI Endoscopy karo β€” cancer rule out karo, THEN manometry karo.

EUS β€” Local staging kyun?

Endoscopic Ultrasound probe directly esophagus mein daalo β€” ultrasound se layers dekho:
  • T1a: Tumor mucosa tak (endoscopic resection possible)
  • T1b: Submucosa tak
  • T2: Muscularis
  • T3: Adventitia (no serosa in esophagus β€” important!)
  • T4b: Trachea/Aorta involved = INOPERABLE β€” surgery karna hi nahi
Esophagus mein serosa NAHI hoti β€” isliye esophageal cancer zyada easily adjacent structures mein spread karta hai (T3 seedha adventitia, koi covering nahi).

🎯 EXAM MCQ TRAPS β€” Jo Tujhe Baar Baar Milenge

Q1: 35 year old female, dysphagia to liquids = solids, weight loss. Next investigation?
Trap: Seedha manometry mat bol! Answer: UGI Endoscopy FIRST (rule out malignancy/stricture β€” mandatory first step)

Q2: Achalasia diagnosed on manometry. Type 2. Best treatment?
Answer: Heller's Cardiomyotomy (Type 1 & 2 = Heller's; Type 3 = POEM)

Q3: Barrett's esophagus patient β€” endoscopy mein kya dikhega?
Answer: Salmon-pink tongue-like projections at GE junction β€” NOT erosions (erosions = GERD, projections = Barrett's)

Q4: Post-alcohol vomiting, chest pain, crepitus in neck. IOC?
Trap: Barium swallow mat bol! Answer: CT with WATER-SOLUBLE contrast

Q5: 60 year old male smoker, dysphagia progressing over 3 months, solids > liquids. IOC for local staging?
Answer: Endoscopic Ultrasound (EUS)

πŸ”— Poora Esophagus β€” Ek Line Mein Connect Karo

Young middle-aged female
Dysphagia liquids=solids β†’ ACHALASIA β†’ HRM β†’ Heller's/POEM

Chronic heartburn
GERD β†’ Barrett's (metaplasia) β†’ Dysplasia β†’ Adenocarcinoma
         ↑
     Surveillance saves life

Post-alcohol, forceful vomiting
Chest pain + crepitus β†’ BOERHAAVE β†’ CT water-soluble β†’ Surgery

Elderly male smoker
Dysphagia solids>liquids, progressive β†’ CA ESOPHAGUS β†’ Endoscopy+Biopsy β†’ EUS+PET

Yeh tha Esophagus β€” Kyu hota hai, Kaise hota hai, Exam mein kaise pakdein.
Bol bhai β€” next kaunsa topic? Stomach chahiye (IHPS, PUD, CA Stomach) ya sidha puchna hai kuch Esophagus mein se?

Intestines: Appendicitis from start β€” Murphy's triad se surgery tak

πŸ₯ APPENDICITIS β€” Murphy's Triad se Surgery tak


🎬 SCENE 1: "Raat 2 baje Arjun ka pet dard uthha..."

Patient: Arjun, 19 saal, college student

Raat 2 baje Arjun ki neend khul gayi. Pet mein dard. Usne socha gas hogi, so gaya.
Subah uthha β€” dard navel ke aaspaas tha. Thoda nausea bhi tha, kuch khaane ka mann nahi tha.
Dopahar tak dard neeche right side mein shift ho gaya β€” aur badh gaya.
Shaam ko thoda bukhar aaya.

🧠 RUK. Ye dard SHIFT KYUN HUA?

Yahi hai Appendicitis ka sabse important clue β€” aur samajhna zaroori hai kyun.
Initially β€” Navel ke aaspaas kyun?
Appendix embryologically midgut se aata hai. Midgut ka pain referred hota hai T10 dermatome pe β€” jo hota hai navel ke aaspaas (periumbilical area).
Yeh visceral pain hai β€” diffuse, dull, crampy. Brain ko exactly pata nahi kahan se aa raha.
Appendix mein inflammation shuru hota hai
      ↓
Visceral nerves (T10) trigger hoti hain
      ↓
Brain: "Kahin navel ke aaspaas dard hai"
      ↓
Periumbilical / diffuse abdominal pain
Phir shift kyun?
Jaise jaise inflammation badhti hai, appendix ki outer wall (serosa) inflame hoti hai. Yeh serosa parietal peritoneum (abdominal wall ki lining) ke touch mein aata hai.
Parietal peritoneum ka pain localized, sharp hota hai β€” aur exact location batata hai.
Appendix ki serosa inflame hoti hai
      ↓
Parietal peritoneum irritate hoti hai
      ↓
Parietal nerves: "Right iliac fossa mein dard hai"
      ↓
Pain RIF mein shift ho jaata hai βœ…
Yeh shift = Appendicitis ka classic sign. Yeh tab hota hai jab disease progress kar rahi hoti hai.

πŸ”΄ Murphy's Triad β€” Teen Cheezein Milke Banata Hai

Appendicitis ka clinical triad:

1️⃣ RIF Pain (Right Iliac Fossa)

Periumbilical se shift hoke yahan aata hai β€” sharp, localized

2️⃣ Low-grade Fever

Inflammation β†’ cytokines β†’ hypothalamus β†’ fever
Zyada fever nahi hoti initially β€” sirf 37.5–38.5Β°C. Agar high fever hai β€” soch: perforation? Abscess?

3️⃣ Nausea / Vomiting

Visceral irritation β†’ vagus nerve stimulate β†’ nausea/vomiting
Yaad rakho: Appendicitis mein pehle pain, phir vomiting. Food poisoning ya gastroenteritis mein pehle vomiting, phir pain. Yeh sequence exam mein poochha jaata hai.

πŸ“ Appendix Ki Position β€” WHY IT CHANGES EVERYTHING

Ab yahan ek problem hai. Arjun ka appendix tha retrocaecal position mein β€” matlab cecum ke peeche.
Kisi aur ka pelvic ho sakta hai. Kisi ka pre-ileal.
Position ke hisaab se presentation BADAL JAATI HAI:

Retrocaecal (~70% β€” Most Common)

Appendix cecum ke PEECHE hai
      ↓
Psoas muscle ke paas hai
      ↓
Inflammation β†’ Psoas irritate hoti hai
      ↓
Hip extension karo (leg seedha stretch karo behind) β†’ Psoas stretch hota hai β†’ DARD
      ↓
YEH HAI PSOAS SIGN βœ…
Arjun ko uthte waqt thoda dard hota tha kyunki hip extend hoti hai.
Clinical trick: Patient ko prone karke left leg extend karo β€” agar RIF mein dard β€” Psoas sign positive.

Pelvic Position (~20–25%)

Appendix pelvis mein hai
      ↓
Obturator internus muscle ke paas
      ↓
Hip FLEXION + internal rotation β†’ Obturator muscle stretch β†’ DARD
      ↓
YEH HAI OBTURATOR SIGN βœ…
Pelvic appendix mein ek aur problem β€” irritation bladder/urethra ko bhi ho sakti hai β†’ dysuria, frequency β€” examiner tujhe confuse karega: "UTI hai kya?" Nahi! Appendicitis hai.
Females mein: Right ovary/tube ke paas hota hai β†’ gynaecological condition jaisa lag sakta hai.

Pre-ileal Position

Ileum ke saamne hai
      ↓
Diarrhea aur vomiting zyada prominent
      ↓
Gastroenteritis jaisa lagta hai ← TRAP!

🩺 CLINICAL SIGNS β€” Har Sign Ka Logic

McBurney's Point Tenderness

Location: 2/3 distance from umbilicus to ASIS (Anterior Superior Iliac Spine) on right side.
Kyun yahan? β€” Yahi approximate surface projection hai appendix ki (retrocaecal mein thoda shift ho sakta hai).
Yahan direct pressure dalo β†’ appendix compress hoti hai β†’ dard = tenderness at McBurney's point.

Blumberg's Sign (Rebound Tenderness)

Technique: McBurney's point pe slowly press karo, phir achanak haath hatao.
Press karte ho β†’ peritoneum push hoti hai β†’ no signal
Haath hatate ho β†’ peritoneum rapidly spring back karti hai
      ↓
Inflamed peritoneum ke surrounding tissues suddenly move karte hain
      ↓
SHARP PAIN ← peritonitis sign
      ↓
YEH HAI REBOUND TENDERNESS βœ…
Iska matlab: Parietal peritoneum involve ho gayi hai. Disease progress kar rahi hai.

Rovsing's Sign

Technique: Left iliac fossa mein press karo β€” dard RIF mein hota hai.
Kyun?
LIF mein press karo
      ↓
Gas/fluid colon mein right ki taraf shift hoti hai
      ↓
Cecum distend hota hai
      ↓
Inflamed appendix compress/stretch hoti hai
      ↓
RIF mein dard βœ…
Yeh indirect tenderness hai. Confirms ki RIF mein problem hai (not LIF).

Psoas Sign & Obturator Sign

Already upar explain kiya position ke context mein.
Summary:
  • Psoas = Retrocaecal appendix = Hip extension = Dard
  • Obturator = Pelvic appendix = Hip flexion + internal rotation = Dard

πŸ“Š ALVARADO SCORE β€” Har Point Ka Logic

M β€” Migration of pain (periumbilical β†’ RIF)        = 1
A β€” Anorexia                                        = 1
N β€” Nausea / Vomiting                               = 1
T β€” Tenderness in RIF                               = 2 ⭐
R β€” Rebound tenderness                              = 1
E β€” Elevated temperature                            = 1
L β€” Leucocytosis (raised WBC)                      = 2 ⭐
S β€” Shift to Left (neutrophilia)                   = 1
                                          Total = 10
Score β‰₯ 7 = Appendicitis LIKELY
Kyun T aur L ko double points?
  • Tenderness RIF (T = 2): Yeh DIRECT sign hai appendix ka β€” baaki sab indirect. Tenderness matlab appendix definitely inflamed hai.
  • Leucocytosis (L = 2): Infection/inflammation ka objective proof β€” blood test confirm karta hai.
Baaki signs circumstantial hain β€” helpful hain but alone diagnosis nahi karte.

πŸ” INVESTIGATIONS β€” Kab Kaunsa Aur WHY?

Adults β†’ CECT Abdomen (IOC)

Kyun CT?
CT mein appendix clearly dikhta hai:
  • Dilated appendix (>6mm diameter)
  • Wall thickening
  • Periappendiceal fat stranding (surrounding fat inflamed dikhi hai β€” haziness)
  • Appendicolith (calcified faecolith β€” stone jo obstruction cause kar raha hai)
CT mein complications bhi dikhte hain β€” abscess, perforation, free fluid.

Children β†’ USG Abdomen (IOC)

Kyun USG children mein?
  1. Radiation nahi β€” children ke developing tissues pe radiation harmful hai
  2. Children mein appendix relatively superficial hota hai β€” USG se easily dekh sakte hain
USG pe kya dekhte hain?
  • Appendix diameter β‰₯ 6 mm = Diagnostic
  • Non-compressible (normal appendix compressible hota hai probe se press karo)
  • Target sign β€” cross-section mein layered appearance
Limitation: Gas, obesity, retrocaecal position mein USG accurate nahi β€” toh CT karte hain.

Pregnancy β†’ MRI (but USG first)

Kyun MRI?
CT mein radiation β€” fetus ke liye risky. MRI safe hai. USG first karo β€” agar unclear hai toh MRI.

Alvarado Score ke hisaab se investigation decide karo:

Score 1-4 β†’ Low suspicion β†’ Observe, treat symptomatically
Score 5-6 β†’ Moderate β†’ USG/CT karke confirm karo
Score 7-10 β†’ HIGH β†’ Straight to CT / straight to OT

πŸ”΄ COMPLICATIONS β€” Disease Ki Timeline

Timeline dekh:

Day 0-1: Appendicitis shuru β†’ RIF pain, fever, nausea
      ↓
Day 2-3: Appendix distends, pressure badhta hai
      ↓
TWO PATHS:
PATH A β€” Phlegmon/Lump:
Omentum + surrounding bowel wrap around appendix
(Body ka natural defense β€” walling off infection)
      ↓
APPENDICULAR PHLEGMON (mass ban jaati hai)
      ↓
Patient: Dard thoda kum, RIF mein palpable mass
      ↓
YE SURGERY KA TIME NAHI β€” Oschner-Sherren karo
PATH B β€” Perforation:
Appendix ki wall ischemic ho jaati hai (pressure se blood supply cut)
      ↓
Wall ruptures = PERFORATION
      ↓
Pus + faecal matter peritoneum mein
      ↓
PERITONITIS β€” diffuse abdominal pain, guarding, rigidity
      ↓
HIGH fever, tachycardia, sick patient
      ↓
EMERGENCY SURGERY

πŸ’Š OSCHNER-SHERREN REGIMEN β€” WHY Conservative?

Yeh tab use karte hain jab Appendicular Phlegmon ho β€” yaani omentum ne appendix ko wrap kar liya hai aur ek mass ban gaya.
Surgery kyun nahi karte turant?
Phlegmon mein planes unclear hain
      ↓
Surgery karne ki koshish karo β†’ omentum, bowel, appendix sab ek saath chipke hain
      ↓
Risk: Inadvertent bowel injury β†’ bowel cut ho jaaye β†’ fistula
      ↓
Simple appendicitis se zyada dangerous situation ban jaata hai!
Isliye conservative:
NPO (nothing by mouth)
IV antibiotics (broad spectrum β€” target gram negatives + anaerobes)
IV fluids
Monitor vitals β€” temperature, pulse, BP
Monitor mass β€” daily measure karo (should decrease)
      ↓
Mass resolves in 6–8 weeks
      ↓
Interval appendectomy karo (3 months baad)
Surgery kab immediately?
  • Mass BADH raha hai (not resolving)
  • High fever persist kare
  • Peritonitis ke signs develop hon

πŸ”ͺ SURGERY β€” Laparoscopic Appendectomy (TOC)

WHY Laparoscopic > Open?

Laparoscopic:
βœ… Smaller cuts (3 ports β€” usually 10mm, 5mm, 5mm)
βœ… Better visualization (camera inside)
βœ… Less post-op pain
βœ… Faster recovery
βœ… Diagnostic too β€” pelvis, tubes, ovaries bhi dekh sakte hain
βœ… Less wound infection

Open:
❌ Bigger incision
❌ More pain
❌ Slower recovery
BUT: Still used if laparoscopic unavailable or conversions needed

Open Appendectomy Incisions β€” WHY Different Ones?

McBurney's / Gridiron Incision:
McBurney's point pe β€” perpendicular to right spino-umbilical line
MUSCLE SPLITTING incision (not cutting β€” fibers separated)
      ↓
Advantage: Muscle fibers split β†’ less bleeding, self-closing when retracted
      ↓
Disadvantage: Limited exposure
Rutherford-Morrison Incision:
Same location but muscle CUTTING (not splitting)
      ↓
Better exposure β€” use karte hain jab zyada access chahiye
(e.g., complicated appendicitis, uncertain diagnosis)
      ↓
Disadvantage: More bleeding, muscles cut
Lanz Incision:
Skin crease mein (groin crease direction mein)
      ↓
Cosmetically better β€” scar less visible
      ↓
Same muscle splitting underneath

Surgery Mein Appendix Kaise Identify Karte Hain?

YEH EXAM MEIN BAHUT POOCHHA JAATA HAI:
Appendix = Convergence of Taenia Coli on Cecum
Taenia coli β€” cecum pe 3 longitudinal muscle bands hain. Teen teeno bands ek jagah milti hain cecum ke lower end pe β€” wahan appendix ka base hota hai.
Surgeon colon pakad ke taenia follow karta hai β€” appendix mil jaata hai.
Compare with Meckel's Diverticulum:
  • Appendix: Has mesoappendix (mesentery)
  • Meckel's: Antimesenteric border pe hota hai (koi mesentery nahi)

Intraoperative β€” Tumor Mila Appendix Mein!

Yeh scenario bahut important hai:
Surgeon appendix nikal raha tha
      ↓
Appendix pe kuch abnormal tissue mili β€” tumor?
      ↓
FROZEN SECTION BHEJA β€” carcinoid tumor confirm
Treatment decision by SIZE:
Tumor SizeLocationTreatment
< 1 cm, at tipTip peAppendectomy alone sufficient
> 2 cmAnywhereRight Hemicolectomy
At BASEBase pe (near cecum)Right Hemicolectomy
1–2 cm (borderline)β€”Appendectomy β†’ histology check β†’ decide
WHY right hemicolectomy for >2 cm?
Carcinoid >2 cm mein lymph node metastasis risk bahut zyada ho jaata hai. Sirf appendix nikaalna kaafi nahi β€” cecum + ascending colon + draining lymph nodes bhi nikaalne chahiye.
Tip pe choti tumor β€” lymphatics drain karne ki chance bahut kam, appendectomy enough.

⚑ COMPLICATIONS OF APPENDECTOMY

MC Early Complication: WOUND INFECTION

Kyun?
Appendix infected tissue hai β€” surgery ke waqt bacteria contaminate kar sakte hain wound.
Prevention: Pre-operative antibiotics, wound irrigation.

MC Late Complication: ADHESIVE INTESTINAL OBSTRUCTION

Kyun?
Surgery ke baad peritoneum heals
      ↓
Healing process mein fibrin bands bante hain (adhesions)
      ↓
Yeh bands bowel loops ko trap kar lete hain
      ↓
Bowel loop kinked ya blocked β†’ Obstruction
Months-years baad present ho sakta hai β€” patient emergency mein aata hai colicky pain, vomiting, distension ke saath.

MC Nerve Injured: ILIOHYPOGASTRIC NERVE

McBurney's incision ke waqt
      ↓
Iliohypogastric nerve (L1) β€” runs near incision site
      ↓
Cut/stretch ho jaata hai
      ↓
Sensory loss: Suprapubic + Inner thigh area
      ↓
Motor: Internal oblique muscle weakens
      ↓
RISK: Right-sided INGUINAL HERNIA development (long term)

🎯 AMYAND'S HERNIA β€” PYQ Trap

Definition: Inguinal hernia jiske sac mein appendix hoti hai.
Appendix inguinal canal mein herniate ho jaati hai
      ↓
Agar appendix inflamed hai β†’ Appendicitis INSIDE hernia sac
      ↓
Patient: Inguinal swelling + tender + fever
      ↓
Treat karo: Appendectomy + hernia repair
Exam trap: Inguinal swelling + fever β†’ think Amyand's!

🎯 EXAM MCQ TRAPS β€” Ek Ek Ko Thodo

Q1: 18 year old male, periumbilical pain shifted to RIF, fever, leucocytosis. Alvarado score?
Migration (1) + Nausea/Anorexia (assume both = 2) + Tenderness RIF (2) + Fever (1) + Leucocytosis (2) = 8/10
Answer: 8 β€” Appendicitis LIKELY β†’ Surgery

Q2: RIF pain, mass palpable, tender. Best management?
TRAP: Mat bol surgery!
Answer: Oschner-Sherren Regimen (conservative) β€” Appendicular Phlegmon

Q3: During appendectomy, 1.5 cm carcinoid found at tip. Next step?
TRAP: 1-2 cm = BORDERLINE
Answer: Appendectomy β†’ Check histology β†’ If clear margins = done | If not = Right hemicolectomy

Q4: Appendicitis IOC in a 24-week pregnant woman?
Answer: USG first β†’ If unclear β†’ MRI (NOT CT β€” radiation risk to fetus)

Q5: MC late complication of appendectomy?
Answer: Adhesive intestinal obstruction (NOT wound infection β€” that's early)

Q6: How do you identify appendix during surgery?
Answer: Follow convergence of Taenia Coli on Cecum β†’ appendix base milega

Q7: Appendicitis with positive obturator sign β€” where is the appendix?
Answer: PELVIC position (obturator muscle irritation = hip flexion + internal rotation = pain)

πŸ”— COMPLETE STORY β€” EK FLOW MEIN

19 year old Arjun
      ↓
Raat mein periumbilical pain (visceral T10 β€” midgut)
      ↓
Subah RIF shift (parietal peritoneum irritate)
      ↓
Murphy's Triad: RIF pain + Low fever + Nausea
      ↓
McBurney's tenderness, Blumberg positive, Rovsing positive
      ↓
Alvarado: 8/10 β†’ LIKELY Appendicitis
      ↓
CECT Abdomen (adult) β†’ dilated appendix, fat stranding
      ↓
NO MASS β†’ Straight to OT
      ↓
Laparoscopic Appendectomy (TOC)
      ↓
Identify appendix: Follow Taenia Coli convergence
      ↓
Post-op: Watch for wound infection (early) β†’ Adhesions (late)

πŸ” WHAT IF β€” Different Scenarios

FindingDiagnosisManagement
RIF mass + mild symptomsAppendicular PhlegmonOschner-Sherren β†’ Interval appendectomy
RIF pain + obturator signPelvic appendixCECT β†’ Lap appendectomy
RIF pain + psoas signRetrocaecal appendixCECT β†’ Lap appendectomy
Inguinal swelling + feverAmyand's herniaAppendectomy + hernia repair
Intraop: 2.5 cm carcinoid at baseCarcinoid tumorRight hemicolectomy
Post-op 6 months: Colicky pain, vomitingAdhesive obstructionCECT β†’ Manage obstruction

Bhai poora Appendicitis clear ho gaya? Murphy's Triad ka logic, har sign ka WHY, Alvarado ka reason, surgery decisions sab.
Bol next kya β€” Intestinal TB vs Crohn's ka story, ya Sigmoid Volvulus + Intussusception, ya kuch seedha poochhna hai appendicitis mein se?
This is a shared conversation. Sign in to Orris to start your own chat.