Also, I want to discuss something, which is that, uh, I have my block exam on second-- on 3rd of August, block exam. On 3rd August. Um, so I have a lot of, uh, syllabus to cover, and I don't know how I, I'll, how I will do it. Like, I, I don't know how I will cover it, uh, if... You help me. For creating a schedule or schedule. I think maybe I'll follow it and cover my maximum slavers. What you say?

Asking for Preferences
Asking for Preferences

Medicine Surgery Gynae and obs Paediatric

Asking for Preferences
Here is your complete study schedule from today (July 12) to August 2, with exam on August 3.

πŸ“… Block Exam Study Schedule

Exam Date: August 3, 2026 Available time: 22 days of study Daily hours: 8-9 hrs (weekdays) | 4-5 hrs (weekends/half-days) Syllabus covered: ~25% done

Subject Time Allocation

Since Medicine is your hardest subject, here's the split:
Subject% of total study timeApprox. days
Medicine35%~8 days
Surgery25%~5-6 days
Gynae & Obs22%~5 days
Paediatrics18%~4 days

Daily Schedule Template

Weekdays (8-9 hours)
TimeActivity
6:00 - 6:30 AMQuick revision of yesterday's topics (30 min)
6:30 - 9:30 AMSubject Block 1 (3 hrs)
9:30 - 10:00 AMBreak + breakfast
10:00 AM - 1:00 PMSubject Block 2 (3 hrs)
1:00 - 2:00 PMLunch + rest
2:00 - 5:00 PMSubject Block 3 (3 hrs)
5:00 - 5:30 PMBreak / walk
5:30 - 6:30 PMMake short notes / MCQ practice (1 hr)
EveningRelax - no heavy studying
Weekends (4-5 hours - half day)
TimeActivity
7:00 - 9:00 AMRevision of the week's topics (2 hrs)
9:00 - 9:30 AMBreak
9:30 - 11:30 AMCarry forward any pending topic (2 hrs)
AfternoonFree / rest

πŸ“† Day-by-Day Plan

PHASE 1: Medicine (July 12 - July 21)

Medicine is hardest - tackle it when you're freshest
DateDayTopicsHours
Jul 12Sun (half-day)Medicine - CVS (Hypertension, IHD, Heart failure)4-5 hrs
Jul 13MonMedicine - CVS continued + Arrhythmias8-9 hrs
Jul 14TueMedicine - Respiratory (Asthma, COPD, Pneumonia, TB)8-9 hrs
Jul 15WedMedicine - GI (Peptic ulcer, Liver diseases, IBD)8-9 hrs
Jul 16ThuMedicine - Nephrology (AKI, CKD, Nephrotic/Nephritic)8-9 hrs
Jul 17FriMedicine - Endocrinology (DM, Thyroid, Adrenal)8-9 hrs
Jul 18Sat (half-day)Medicine - Revision + MCQs (CVS + Resp + GI)4-5 hrs
Jul 19Sun (half-day)Medicine - Revision + MCQs (Nephro + Endo)4-5 hrs
Jul 20MonMedicine - Neurology + Haematology (Anaemia, Leukaemia)8-9 hrs
Jul 21TueMedicine - Infections (Malaria, Typhoid, Dengue) + Rapid revision entire Medicine8-9 hrs

PHASE 2: Surgery (July 22 - July 25)

DateDayTopicsHours
Jul 22WedSurgery - GI (Appendicitis, Intestinal obstruction, Hernias)8-9 hrs
Jul 23ThuSurgery - Breast, Thyroid, Fluids & Electrolytes8-9 hrs
Jul 24FriSurgery - Trauma, Burns, Orthopaedics basics8-9 hrs
Jul 25Sat (half-day)Surgery - Urology + Rapid revision of Surgery4-5 hrs

PHASE 3: Gynae & Obs (July 26 - July 29)

DateDayTopicsHours
Jul 26Sun (half-day)Obstetrics - Normal pregnancy, ANC, Labour4-5 hrs
Jul 27MonObstetrics - Complications (APH, PPH, Pre-eclampsia, Ectopic)8-9 hrs
Jul 28TueGynaecology - Menstrual disorders, PCOS, Fibroids, Infections8-9 hrs
Jul 29WedGynaecology - Cancers (Cx, Endometrium, Ovary) + Contraception + Revision8-9 hrs

PHASE 4: Paediatrics (July 30 - Aug 1)

DateDayTopicsHours
Jul 30ThuPaediatrics - Neonatology (NNJ, RDS, Birth asphyxia, NEC) + Growth & Development8-9 hrs
Jul 31FriPaediatrics - Nutrition, Infections (Measles, Mumps, Polio), Immunisation8-9 hrs
Aug 1Sat (half-day)Paediatrics - Respiratory, GI + Rapid revision of Paediatrics4-5 hrs

PHASE 5: Final Rapid Revision (Aug 2)

DateDayActivityHours
Aug 2Sun (half-day)Go through your short notes for ALL 4 subjects. Only high-yield topics. NO new topics. Sleep early.4 hrs max

Aug 3 - EXAM DAY 🎯

  • Wake up early, light breakfast
  • Skim your notes for 1 hour max
  • Stay calm - you've put in the work

Key Tips for Success

  1. Make short notes as you go - after each topic, write 10-15 key points. These are gold for Aug 2 revision.
  2. MCQs daily - do 20-30 MCQs each evening on that day's topic. It cements memory fast.
  3. Don't skip the revision days - Phase 1 revision days (Jul 18-19) are built in intentionally.
  4. Prioritise high-yield topics - in Medicine especially, focus on conditions that are common in exams (DM, HTN, IHD, TB, Anaemia).
  5. 8 hours of sleep - non-negotiable. Sleep is when your brain consolidates everything you studied.
  6. Don't start new topics on Aug 2 - only revise what you already know.

You have 22 study days and 4 subjects. This is absolutely doable. Stick to the plan, and you'll cover your maximum syllabus. Good luck on August 3! πŸ’ͺ

Okay, do two things. First is generate a study tracker Excel sheet to mark daily progress. Second is the, find recent high-yield PubMed papers on common exam topics. The third thing is I'll share the syllabus with you. And the thing is I have my first exam of medicine, that's why I have kept, kept the medicine in the last, not in the start. So, yes.

Reading File
Searching PubMed

hypertension diabetes mellitus management guidelines

Searching PubMed

appendicitis surgical management outcomes

Searching PubMed

preeclampsia obstetric complications management

Searching PubMed

neonatal jaundice management paediatrics

Reading File
Searching PubMed

tuberculosis diagnosis treatment guidelines

Searching PubMed

postpartum hemorrhage prevention management

Running Command

mkdir -p /home/daytona/workspace/block-exam-prep && ls /home/daytona/workspace/b…

Writing File

~/block-exam-prep/create_tracker.py

from openpyxl import Workbook
from openpyxl.styles import (Font, PatternFill, Alignment, Border, Side,
                              GradientFill)
from openpyxl.utils import get_column_letter
from openpyxl.formatting.rule import DataBarRule, ColorScaleRule, CellIsRule, FormulaRule
from openpyxl.styles.differential import DifferentialStyle
from openpyxl.formatting.rule import Rule
import io

wb = Workbook()

# ─────────────────────────────────────────────
# HELPERS
# ─────────────────────────────────────────────
def hex_fill(hex_color):
    return PatternFill("solid", start_color=hex_color, fgColor=hex_color)

def thin_border():
    s = Side(style='thin', color='BBBBBB')
    return Border(left=s, right=s, top=s, bottom=s)

def bold_font(size=11, color='000000'):
    return Font(name='Arial', bold=True, size=size, color=color)

def reg_font(size=10, color='000000'):
    return Font(name='Arial', size=size, color=color)

def center():
    return Alignment(horizontal='center', vertical='center', wrap_text=True)

def left():
    return Alignment(horizontal='left', vertical='center', wrap_text=True)

# Color palette
COL_HEADER_DARK   = '1F3864'   # dark navy  – sheet headers
COL_SUBJECT_SURG  = '2E75B6'   # blue       – Surgery
COL_SUBJECT_GYN   = 'C55A11'   # orange     – Gynae & Obs
COL_SUBJECT_PED   = '375623'   # dark green – Paediatrics
COL_SUBJECT_MED   = '7030A0'   # purple     – Medicine
COL_WEEKEND_BG    = 'F2F2F2'   # light grey – weekend row
COL_DONE          = 'E2EFDA'   # soft green – completed
COL_PARTIAL       = 'FFF2CC'   # soft yellow– partial
COL_NOT_DONE      = 'FCE4D6'   # soft red   – not done
COL_ROW_ALT       = 'EEF3FB'   # alt row bg
WHITE             = 'FFFFFF'

SUBJECT_COLORS = {
    'Surgery':       COL_SUBJECT_SURG,
    'Gynae & Obs':   COL_SUBJECT_GYN,
    'Paediatrics':   COL_SUBJECT_PED,
    'Medicine':      COL_SUBJECT_MED,
}

# ─────────────────────────────────────────────
# SHEET 1 : DAILY TRACKER
# ─────────────────────────────────────────────
ws = wb.active
ws.title = "πŸ“… Daily Tracker"
ws.sheet_view.showGridLines = False
ws.freeze_panes = 'A5'   # freeze top 4 rows

# --- Title row ---
ws.merge_cells('A1:K1')
ws['A1'] = 'πŸŽ“  BLOCK EXAM STUDY TRACKER  |  Exam: 3 August 2026'
ws['A1'].font = Font(name='Arial', bold=True, size=16, color=WHITE)
ws['A1'].fill = hex_fill(COL_HEADER_DARK)
ws['A1'].alignment = center()
ws.row_dimensions[1].height = 36

# --- Subtitle row ---
ws.merge_cells('A2:K2')
ws['A2'] = 'Subjects: Surgery  β€’  Gynae & Obs  β€’  Paediatrics  β€’  Medicine'
ws['A2'].font = Font(name='Arial', size=11, color='D9E1F2')
ws['A2'].fill = hex_fill('2F528F')
ws['A2'].alignment = center()
ws.row_dimensions[2].height = 22

# row 3 spacer
ws.row_dimensions[3].height = 6
ws.merge_cells('A3:K3')
ws['A3'].fill = hex_fill('D9E1F2')

# --- Column headers row 4 ---
headers = ['Date', 'Day', 'Subject', 'Topics to Cover', 'Hours\nPlanned',
           'Hours\nActual', 'Status\n(βœ…/πŸ”„/❌)', 'Confidence\n(1-5)',
           'Notes / Doubts', 'MCQs\nDone?', 'Revision\nDone?']
col_widths = [13, 10, 14, 42, 9, 9, 12, 12, 34, 10, 12]

for col_idx, (h, w) in enumerate(zip(headers, col_widths), start=1):
    cell = ws.cell(row=4, column=col_idx, value=h)
    cell.font = bold_font(10, WHITE)
    cell.fill = hex_fill(COL_HEADER_DARK)
    cell.alignment = center()
    cell.border = thin_border()
    ws.column_dimensions[get_column_letter(col_idx)].width = w
ws.row_dimensions[4].height = 30

# ── Schedule data ──────────────────────────────────────────────────────────
schedule = [
    # (date_str, day_str, subject, topics, hrs_planned, day_type)
    # day_type: 'weekday' | 'weekend'
    ('12 Jul', 'Sun',  'Surgery',     'GI Surgery: Appendicitis, Intestinal Obstruction', 4.5, 'weekend'),
    ('13 Jul', 'Mon',  'Surgery',     'Hernias, Peritonitis, Acute Abdomen',               8.5, 'weekday'),
    ('14 Jul', 'Tue',  'Surgery',     'Breast Surgery, Thyroid & Parathyroid',              8.5, 'weekday'),
    ('15 Jul', 'Wed',  'Surgery',     'Fluids & Electrolytes, Burns, Trauma',               8.5, 'weekday'),
    ('16 Jul', 'Thu',  'Surgery',     'Urology (BPH, Renal Calculi) + Surgery MCQ Practice',8.5,'weekday'),
    ('17 Jul', 'Fri',  'Surgery',     'Surgery Rapid Revision + Short Notes',               8.5, 'weekday'),
    ('18 Jul', 'Sat',  'Surgery',     'Surgery Revision (Pending Topics)',                  4.5, 'weekend'),
    ('19 Jul', 'Sun',  'Gynae & Obs', 'Obstetrics: Normal Pregnancy, ANC, Partograph',      4.5, 'weekend'),
    ('20 Jul', 'Mon',  'Gynae & Obs', 'Obstetrics: Labour, Delivery, Puerperium',           8.5, 'weekday'),
    ('21 Jul', 'Tue',  'Gynae & Obs', 'Obs Complications: APH, PPH, Pre-eclampsia',         8.5, 'weekday'),
    ('22 Jul', 'Wed',  'Gynae & Obs', 'Ectopic Pregnancy, Abortion, Molar Pregnancy',       8.5, 'weekday'),
    ('23 Jul', 'Thu',  'Gynae & Obs', 'Gynaecology: PCOS, Fibroids, Endometriosis',         8.5, 'weekday'),
    ('24 Jul', 'Fri',  'Gynae & Obs', 'Gynaecology: Cancers (Cx, Endo, Ovary), Contraception',8.5,'weekday'),
    ('25 Jul', 'Sat',  'Gynae & Obs', 'Gynae & Obs Full Revision + MCQs',                   4.5, 'weekend'),
    ('26 Jul', 'Sun',  'Paediatrics', 'Neonatology: NNJ, Birth Asphyxia, RDS, NEC',         4.5, 'weekend'),
    ('27 Jul', 'Mon',  'Paediatrics', 'Growth & Development, Nutrition (PEM, Vit def.)',     8.5, 'weekday'),
    ('28 Jul', 'Tue',  'Paediatrics', 'Paediatric Infections: Measles, Mumps, Polio, Pertussis',8.5,'weekday'),
    ('29 Jul', 'Wed',  'Paediatrics', 'Immunisation Schedule, Respiratory + GI Diseases',   8.5, 'weekday'),
    ('30 Jul', 'Thu',  'Paediatrics', 'Paediatrics Rapid Revision + MCQ Practice',           8.5, 'weekday'),
    ('31 Jul', 'Fri',  'Medicine',    'Medicine: CVS (HTN, IHD, Heart Failure, Arrhythmias)',8.5,'weekday'),
    ('1 Aug',  'Sat',  'Medicine',    'Medicine: Respiratory (TB, Asthma, COPD, Pneumonia)', 4.5, 'weekend'),
    ('2 Aug',  'Sun',  'Medicine',    'FINAL REVISION – All subjects, High-yield MCQs, Short Notes ONLY',4.0,'weekend'),
]

for row_num, (date, day, subject, topics, hrs_plan, day_type) in enumerate(schedule, start=5):
    r = row_num
    is_weekend = day_type == 'weekend'
    is_final   = date == '2 Aug'

    # Row BG
    if is_final:
        row_bg = 'FFE699'
    elif is_weekend:
        row_bg = 'F2F2F2'
    else:
        row_bg = WHITE if (row_num % 2 == 1) else COL_ROW_ALT

    # subj color
    subj_color = SUBJECT_COLORS.get(subject, '4472C4')

    cells_data = [date, day, subject, topics, hrs_plan, '', '', '', '', 'No', 'No']
    for col_idx, val in enumerate(cells_data, start=1):
        cell = ws.cell(row=r, column=col_idx, value=val)
        cell.border = thin_border()
        cell.font = reg_font(10)
        cell.fill = hex_fill(row_bg)

        if col_idx == 1:   # date
            cell.font = bold_font(10)
            cell.alignment = center()
        elif col_idx == 2: # day
            cell.alignment = center()
            if is_weekend:
                cell.font = Font(name='Arial', size=10, bold=True, color='C00000')
        elif col_idx == 3: # subject
            cell.font = Font(name='Arial', size=10, bold=True, color=WHITE)
            cell.fill = hex_fill(subj_color)
            cell.alignment = center()
        elif col_idx == 4: # topics
            cell.alignment = left()
        elif col_idx in (5, 6, 7, 8, 10, 11):
            cell.alignment = center()
        elif col_idx == 9:
            cell.alignment = left()

    ws.row_dimensions[r].height = 28

# ── Data validation dropdowns ──
from openpyxl.worksheet.datavalidation import DataValidation

# Status dropdown  G5:G26
dv_status = DataValidation(type="list", formula1='"βœ… Done,πŸ”„ Partial,❌ Not Done"', allow_blank=True)
dv_status.sqref = f'G5:G{4+len(schedule)}'
ws.add_data_validation(dv_status)

# Confidence 1-5  H5:H26
dv_conf = DataValidation(type="list", formula1='"1,2,3,4,5"', allow_blank=True)
dv_conf.sqref = f'H5:H{4+len(schedule)}'
ws.add_data_validation(dv_conf)

# MCQ done J, Revision done K
dv_yn = DataValidation(type="list", formula1='"Yes,No,Partial"', allow_blank=True)
dv_yn.sqref = f'J5:K{4+len(schedule)}'
ws.add_data_validation(dv_yn)

# ── Conditional formatting: Status column ──
last_data_row = 4 + len(schedule)
# Done β†’ green
ws.conditional_formatting.add(
    f'G5:G{last_data_row}',
    CellIsRule(operator='equal', formula=['"βœ… Done"'],
               fill=hex_fill(COL_DONE))
)
# Partial β†’ yellow
ws.conditional_formatting.add(
    f'G5:G{last_data_row}',
    CellIsRule(operator='equal', formula=['"πŸ”„ Partial"'],
               fill=hex_fill(COL_PARTIAL))
)
# Not Done β†’ red
ws.conditional_formatting.add(
    f'G5:G{last_data_row}',
    CellIsRule(operator='equal', formula=['"❌ Not Done"'],
               fill=hex_fill(COL_NOT_DONE))
)

# ── Summary strip at bottom ──
summary_row = last_data_row + 2
ws.merge_cells(f'A{summary_row}:C{summary_row}')
ws.cell(summary_row, 1, 'πŸ“Š PROGRESS SUMMARY').font = bold_font(11, WHITE)
ws.cell(summary_row, 1).fill = hex_fill(COL_HEADER_DARK)
ws.cell(summary_row, 1).alignment = center()

labels = ['Days Done', 'Days Partial', 'Days Not Done', 'Days Remaining',
          'Total Planned Hrs', 'Total Actual Hrs']
formulas = [
    f'=COUNTIF(G5:G{last_data_row},"βœ… Done")',
    f'=COUNTIF(G5:G{last_data_row},"πŸ”„ Partial")',
    f'=COUNTIF(G5:G{last_data_row},"❌ Not Done")',
    f'={len(schedule)}-COUNTIF(G5:G{last_data_row},"βœ… Done")-COUNTIF(G5:G{last_data_row},"πŸ”„ Partial")',
    f'=SUM(E5:E{last_data_row})',
    f'=SUM(F5:F{last_data_row})',
]
for i, (lbl, frm) in enumerate(zip(labels, formulas)):
    col_lbl = 4 + i*2 - 1   # D, F, H, J ...
    col_val = col_lbl + 1
    lbl_cell = ws.cell(summary_row, col_lbl, lbl)
    lbl_cell.font = bold_font(10, COL_HEADER_DARK)
    lbl_cell.fill = hex_fill('D9E1F2')
    lbl_cell.alignment = center()
    lbl_cell.border = thin_border()

    val_cell = ws.cell(summary_row, col_val, frm)
    val_cell.font = bold_font(12, '1F3864')
    val_cell.fill = hex_fill('EEF3FB')
    val_cell.alignment = center()
    val_cell.border = thin_border()

ws.row_dimensions[summary_row].height = 28

# ─────────────────────────────────────────────
# SHEET 2 : SUBJECT BREAKDOWN
# ─────────────────────────────────────────────
ws2 = wb.create_sheet("πŸ“š Subject Breakdown")
ws2.sheet_view.showGridLines = False

ws2.merge_cells('A1:G1')
ws2['A1'] = 'SUBJECT-WISE TOPIC BREAKDOWN & PROGRESS'
ws2['A1'].font = bold_font(14, WHITE)
ws2['A1'].fill = hex_fill(COL_HEADER_DARK)
ws2['A1'].alignment = center()
ws2.row_dimensions[1].height = 32

subj_data = {
    'Surgery': [
        ('Appendicitis & Acute Abdomen', 'High'),
        ('Intestinal Obstruction', 'High'),
        ('Hernia (Inguinal, Femoral)', 'High'),
        ('Peritonitis', 'Medium'),
        ('Breast (Carcinoma, Fibroadenoma)', 'High'),
        ('Thyroid & Parathyroid Surgery', 'High'),
        ('Fluids & Electrolytes', 'High'),
        ('Burns – Rule of 9s, Management', 'High'),
        ('Trauma – ATLS principles', 'Medium'),
        ('BPH & Renal Calculi (Urology)', 'Medium'),
    ],
    'Gynae & Obs': [
        ('Normal Pregnancy & ANC', 'High'),
        ('Normal Labour & Partograph', 'High'),
        ('Antepartum Haemorrhage (APH)', 'High'),
        ('Postpartum Haemorrhage (PPH)', 'High'),
        ('Pre-eclampsia & Eclampsia', 'High'),
        ('Ectopic Pregnancy', 'High'),
        ('Abortion Types & Management', 'High'),
        ('Molar Pregnancy', 'Medium'),
        ('PCOS', 'High'),
        ('Fibroids & Endometriosis', 'High'),
        ('Gynaecological Cancers', 'High'),
        ('Contraception', 'Medium'),
    ],
    'Paediatrics': [
        ('Neonatal Jaundice', 'High'),
        ('Birth Asphyxia & Neonatal Resuscitation', 'High'),
        ('Respiratory Distress Syndrome (RDS)', 'High'),
        ('Growth & Development Milestones', 'High'),
        ('Protein Energy Malnutrition (PEM)', 'High'),
        ('Vitamin Deficiencies', 'Medium'),
        ('Immunisation Schedule', 'High'),
        ('Measles, Mumps, Rubella', 'High'),
        ('Polio & Pertussis', 'Medium'),
        ('Paediatric Respiratory Diseases', 'Medium'),
        ('Paediatric GI Diseases', 'Medium'),
    ],
    'Medicine': [
        ('Hypertension', 'High'),
        ('Ischaemic Heart Disease (IHD)', 'High'),
        ('Heart Failure', 'High'),
        ('Arrhythmias', 'High'),
        ('Asthma & COPD', 'High'),
        ('Tuberculosis (TB)', 'High'),
        ('Pneumonia', 'High'),
        ('Diabetes Mellitus (T1 & T2)', 'High'),
        ('Thyroid Disorders', 'High'),
        ('Acute Kidney Injury (AKI)', 'High'),
        ('Chronic Kidney Disease (CKD)', 'High'),
        ('Nephrotic & Nephritic Syndrome', 'High'),
        ('Liver Diseases (Cirrhosis, Hepatitis)', 'High'),
        ('Anaemia (Iron def., B12, Haemolytic)', 'High'),
        ('Malaria, Dengue, Typhoid', 'High'),
        ('Stroke & Epilepsy', 'Medium'),
    ],
}

cur_row = 3
for subj, topics_list in subj_data.items():
    # Subject header
    ws2.merge_cells(f'A{cur_row}:G{cur_row}')
    hdr = ws2.cell(cur_row, 1, f'  {subj.upper()}')
    hdr.font = bold_font(12, WHITE)
    hdr.fill = hex_fill(SUBJECT_COLORS[subj])
    hdr.alignment = left()
    ws2.row_dimensions[cur_row].height = 26
    cur_row += 1

    # Column sub-headers
    col_hdrs = ['#', 'Topic', 'Priority', 'Status', 'Confidence (1-5)', 'Notes', 'Revision Date']
    col_ws   = [5, 38, 10, 14, 16, 30, 14]
    for ci, (ch, cw) in enumerate(zip(col_hdrs, col_ws), start=1):
        c = ws2.cell(cur_row, ci, ch)
        c.font = bold_font(9, WHITE)
        c.fill = hex_fill('2F528F')
        c.alignment = center()
        c.border = thin_border()
        ws2.column_dimensions[get_column_letter(ci)].width = cw
    ws2.row_dimensions[cur_row].height = 22
    cur_row += 1

    for ti, (topic, priority) in enumerate(topics_list, start=1):
        row_bg = WHITE if ti % 2 == 1 else COL_ROW_ALT
        vals = [ti, topic, priority, '', '', '', '']
        for ci, val in enumerate(vals, start=1):
            c = ws2.cell(cur_row, ci, val)
            c.font = reg_font(10)
            c.fill = hex_fill(row_bg)
            c.border = thin_border()
            c.alignment = center() if ci in (1, 3, 4, 5, 7) else left()
        # Priority color
        prio_cell = ws2.cell(cur_row, 3)
        if priority == 'High':
            prio_cell.font = Font(name='Arial', size=10, bold=True, color='C00000')
        else:
            prio_cell.font = Font(name='Arial', size=10, bold=True, color='7030A0')
        ws2.row_dimensions[cur_row].height = 22
        cur_row += 1

    # DV for status col in this subject block
    dv_s2 = DataValidation(type="list", formula1='"βœ… Done,πŸ”„ Partial,❌ Not Done"', allow_blank=True)
    dv_s2.sqref = f'D{cur_row - len(topics_list)}:D{cur_row - 1}'
    ws2.add_data_validation(dv_s2)

    cur_row += 1  # spacer

# ─────────────────────────────────────────────
# SHEET 3 : HIGH-YIELD PUBMED PAPERS
# ─────────────────────────────────────────────
ws3 = wb.create_sheet("πŸ”¬ PubMed Papers")
ws3.sheet_view.showGridLines = False

ws3.merge_cells('A1:F1')
ws3['A1'] = 'HIGH-YIELD RECENT PubMed PAPERS (2023-2026)  |  For Block Exam Preparation'
ws3['A1'].font = bold_font(13, WHITE)
ws3['A1'].fill = hex_fill(COL_HEADER_DARK)
ws3['A1'].alignment = center()
ws3.row_dimensions[1].height = 30

ws3.merge_cells('A2:F2')
ws3['A2'] = 'Use these papers to understand current management guidelines and update exam answers with recent evidence.'
ws3['A2'].font = Font(name='Arial', size=10, italic=True, color='2F528F')
ws3['A2'].fill = hex_fill('D9E1F2')
ws3['A2'].alignment = center()
ws3.row_dimensions[2].height = 20

phdrs = ['Subject', 'PMID', 'Year', 'Title', 'Journal', 'Key Takeaway for Exam']
phdr_w = [14, 10, 6, 58, 22, 48]
for ci, (h, w) in enumerate(zip(phdrs, phdr_w), start=1):
    c = ws3.cell(3, ci, h)
    c.font = bold_font(10, WHITE)
    c.fill = hex_fill('2F528F')
    c.alignment = center()
    c.border = thin_border()
    ws3.column_dimensions[get_column_letter(ci)].width = w
ws3.row_dimensions[3].height = 24

papers = [
    ('Medicine', '37793979', '2023',
     '2023 Clinical Practice Guidelines for Diabetes Mellitus (Korean Diabetes Association)',
     'Diabetes Metab J',
     'Updated DM targets: HbA1c <6.5-7%, individualized BP & lipid goals; GLP-1RA/SGLT2i for CVD risk'),
    ('Medicine', '40840485', '2026',
     'A clinical practice guideline for tuberculous meningitis',
     'Lancet Infect Dis',
     'TB meningitis: dexamethasone adjunct, longer ATT duration, CSF findings – high-yield for Medicine'),
    ('Surgery', '37914953', '2023',
     'Diagnosis and treatment of appendicitis: systematic review and meta-analysis',
     'Surg Endosc',
     'Alvarado score, CT vs USS, laparoscopic appendicectomy as gold standard; antibiotics in uncomplicated'),
    ('Surgery', '38682788', '2024',
     'Appendectomy versus antibiotic treatment for acute appendicitis (Cochrane)',
     'Cochrane Database Syst Rev',
     'Non-operative management of uncomplicated appendicitis feasible; ~30% require surgery within 1 yr'),
    ('Surgery', '41046476', '2026',
     'Reevaluating Non-operative Management for Pediatric Uncomplicated Acute Appendicitis',
     'JAMA Pediatr',
     'In children: antibiotics-first approach safe option; compare with adult data for Surgery Paeds crossover'),
    ('Gynae & Obs', '40237648', '2025',
     'Uterotonic agents for preventing postpartum haemorrhage: a network meta-analysis (Cochrane)',
     'Cochrane Database Syst Rev',
     'Carbetocin > oxytocin for PPH prevention; combination oxytocin+misoprostol useful in resource-limited settings'),
    ('Gynae & Obs', '38965226', '2024',
     'Systematic review and meta-analysis of pregnancy outcomes in women with PCOS',
     'Nat Commun',
     'PCOS β†’ ↑ risk GDM, pre-eclampsia, preterm birth, miscarriage – important obstetric complications to know'),
    ('Gynae & Obs', '38726883', '2024',
     'Magnesium sulphate for women at risk of preterm birth for neuroprotection of the fetus (Cochrane)',
     'Cochrane Database Syst Rev',
     'MgSO4 given <34 wks reduces cerebral palsy risk in preterm neonates – high-yield for PROM/preterm labour'),
    ('Paediatrics', '38804265', '2024',
     'Transcutaneous bilirubinometry for detecting jaundice in term or late preterm neonates (Cochrane)',
     'Cochrane Database Syst Rev',
     'TcB reliable screening tool before serum bilirubin; helps decide phototherapy threshold'),
    ('Paediatrics', '41784088', '2026',
     'High- versus low-dose phototherapy for neonatal jaundice (Cochrane)',
     'Cochrane Database Syst Rev',
     'High-dose phototherapy reduces exchange transfusion rate; no major difference in adverse effects'),
]

for ri, row_data in enumerate(papers, start=4):
    row_bg = WHITE if ri % 2 == 0 else COL_ROW_ALT
    subj = row_data[0]
    subj_col = SUBJECT_COLORS.get(subj, '4472C4')
    for ci, val in enumerate(row_data, start=1):
        c = ws3.cell(ri, ci, val)
        c.font = reg_font(10)
        c.fill = hex_fill(row_bg)
        c.border = thin_border()
        c.alignment = left() if ci in (4, 6) else center()
    # Subject cell colored
    ws3.cell(ri, 1).font = Font(name='Arial', size=10, bold=True, color=WHITE)
    ws3.cell(ri, 1).fill = hex_fill(subj_col)
    ws3.cell(ri, 1).alignment = center()
    ws3.row_dimensions[ri].height = 42

# ─────────────────────────────────────────────
# SHEET 4 : EXAM DAY CHECKLIST
# ─────────────────────────────────────────────
ws4 = wb.create_sheet("βœ… Exam Day Checklist")
ws4.sheet_view.showGridLines = False

ws4.merge_cells('A1:D1')
ws4['A1'] = 'βœ…  EXAM DAY CHECKLIST  |  3 August 2026'
ws4['A1'].font = bold_font(16, WHITE)
ws4['A1'].fill = hex_fill(COL_HEADER_DARK)
ws4['A1'].alignment = center()
ws4.row_dimensions[1].height = 36

checklist = [
    ('NIGHT BEFORE (2 Aug evening)', [
        'Review short notes for all 4 subjects (1 hr max)',
        'Pack exam essentials: pen, admit card, stationery',
        'Set alarm – wake up 1.5 hrs before exam',
        'Sleep by 10 PM – minimum 7-8 hrs sleep',
    ]),
    ('MORNING OF EXAM (3 Aug)', [
        'Light breakfast – avoid heavy/oily food',
        'Glance through key mnemonics only (30 min max)',
        'Reach exam hall 20-30 mins early',
        'No new topics – only revision',
    ]),
    ('DURING EXAM', [
        'Read each question TWICE before answering',
        'Attempt all questions – no negative marking typically',
        'Manage time: 1 min per MCQ, 5-8 min per short note',
        'Start with your strongest subject',
        'If stuck, move on and return later',
    ]),
]

cur_row4 = 3
ws4.column_dimensions['A'].width = 5
ws4.column_dimensions['B'].width = 42
ws4.column_dimensions['C'].width = 14
ws4.column_dimensions['D'].width = 30

for section, items in checklist:
    ws4.merge_cells(f'A{cur_row4}:D{cur_row4}')
    c = ws4.cell(cur_row4, 1, f'  {section}')
    c.font = bold_font(11, WHITE)
    c.fill = hex_fill('2F528F')
    c.alignment = left()
    ws4.row_dimensions[cur_row4].height = 26
    cur_row4 += 1

    # sub headers
    for hdr_txt, col_n, w in [('', 1, 5), ('Item', 2, 42), ('Done?', 3, 14), ('Notes', 4, 30)]:
        c2 = ws4.cell(cur_row4, col_n, hdr_txt)
        c2.font = bold_font(9, WHITE)
        c2.fill = hex_fill(COL_HEADER_DARK)
        c2.alignment = center()
        c2.border = thin_border()
    ws4.row_dimensions[cur_row4].height = 20
    cur_row4 += 1

    dv_ck = DataValidation(type="list", formula1='"βœ… Done,⏳ Pending"', allow_blank=True)

    for item_num, item in enumerate(items, start=1):
        row_bg = WHITE if item_num % 2 == 1 else COL_ROW_ALT
        ws4.cell(cur_row4, 1, item_num).fill = hex_fill(row_bg)
        ws4.cell(cur_row4, 1).font = reg_font(10)
        ws4.cell(cur_row4, 1).alignment = center()
        ws4.cell(cur_row4, 1).border = thin_border()

        c_item = ws4.cell(cur_row4, 2, item)
        c_item.font = reg_font(10)
        c_item.fill = hex_fill(row_bg)
        c_item.alignment = left()
        c_item.border = thin_border()

        c_done = ws4.cell(cur_row4, 3, '⏳ Pending')
        c_done.font = reg_font(10)
        c_done.fill = hex_fill(row_bg)
        c_done.alignment = center()
        c_done.border = thin_border()

        c_note = ws4.cell(cur_row4, 4, '')
        c_note.font = reg_font(10)
        c_note.fill = hex_fill(row_bg)
        c_note.alignment = left()
        c_note.border = thin_border()

        dv_ck.sqref = f'C{cur_row4}'
        ws4.row_dimensions[cur_row4].height = 22
        cur_row4 += 1

    ws4.add_data_validation(dv_ck)
    cur_row4 += 1  # spacer

# ─────────────────────────────────────────────
# SAVE
# ─────────────────────────────────────────────
output_path = '/home/daytona/workspace/block-exam-prep/Block_Exam_Study_Tracker.xlsx'
wb.save(output_path)
print(f"Saved to: {output_path}")
Running Command

cd /home/daytona/workspace/block-exam-prep && python create_tracker.py

Editing File

~/block-exam-prep/create_tracker.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/block-exam-prep/create_tracker.py'
Running Command

cd /home/daytona/workspace/block-exam-prep && python create_tracker.py

Running Command

grep -n "BytesIO\|buf\|wb.save" /home/daytona/workspace/block-exam-prep/create_t…

Running Command

grep -n "DataValidation\|dv_ck\|add_data_validation" /home/daytona/workspace/blo…

Editing File

~/block-exam-prep/create_tracker.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/block-exam-prep/create_tracker.py'
Editing File

~/block-exam-prep/create_tracker.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/block-exam-prep/create_tracker.py'
Editing File

~/block-exam-prep/create_tracker.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/block-exam-prep/create_tracker.py'
Editing File

~/block-exam-prep/create_tracker.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/block-exam-prep/create_tracker.py'
Running Command

cd /home/daytona/workspace/block-exam-prep && python create_tracker.py 2>&1

Editing File

~/block-exam-prep/create_tracker.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/block-exam-prep/create_tracker.py'
Running Command

cd /home/daytona/workspace/block-exam-prep && python create_tracker.py 2>&1

Running Command

python /home/daytona/skills/xlsx/scripts/recalc.py /home/daytona/workspace/block…

Both tasks done! Here's a summary:

Task 1: Excel Study Tracker βœ…

Block Exam Study Tracker

Spreadsheet Β· XLSX

The file has 4 sheets:
SheetWhat it contains
Daily TrackerAll 22 study days (Jul 12 - Aug 2), with dropdown for Status (Done/Partial/Not Done), Confidence score 1-5, MCQs done, Revision done, Notes column. Auto color-codes green/yellow/red based on status. Progress summary at the bottom auto-calculates totals.
Subject BreakdownEvery topic for all 4 subjects, with Priority (High/Medium), Status, Confidence, Notes, and Revision Date columns
PubMed PapersAll 10 high-yield recent papers (see below)
Exam Day ChecklistNight-before and exam-morning checklist with Done/Pending dropdown

Task 2: High-Yield PubMed Papers βœ…

Surgery

  • PMID 37914953 (2023, Surg Endosc) - "Diagnosis and treatment of appendicitis: systematic review" - Alvarado score, CT vs USS, lap appendicectomy as gold standard
  • PMID 38682788 (2024, Cochrane) - "Appendectomy vs antibiotic treatment for acute appendicitis" - Non-operative management feasible; ~30% need surgery within 1 year

Gynae & Obs

  • PMID 40237648 (2025, Cochrane) - "Uterotonic agents for preventing PPH" - Carbetocin > oxytocin; combination useful in resource-limited settings
  • PMID 38965226 (2024, Nature Comms) - "Pregnancy outcomes in PCOS" - PCOS raises risk of GDM, pre-eclampsia, preterm birth, miscarriage
  • PMID 38726883 (2024, Cochrane) - "MgSO4 for fetal neuroprotection in preterm birth" - Given <34 weeks, reduces cerebral palsy risk

Paediatrics

  • PMID 38804265 (2024, Cochrane) - "Transcutaneous bilirubinometry for neonatal jaundice" - Reliable screening before serum bilirubin
  • PMID 41784088 (2026, Cochrane) - "High vs low-dose phototherapy for neonatal jaundice" - High-dose reduces exchange transfusion rate

Medicine

  • PMID 37793979 (2023, Diabetes Metab J) - "2023 Clinical Practice Guidelines for DM" - HbA1c targets, GLP-1RA/SGLT2i for CVD risk reduction
  • PMID 40840485 (2026, Lancet Infect Dis) - "Clinical practice guideline for TB meningitis" - Dexamethasone adjunct, CSF findings, ATT duration

Task 3: Awaiting your syllabus

Also noted - Medicine is your first exam, so I've already placed it last in the schedule (Jul 31 - Aug 2), so it's freshest in your mind when you sit that paper. Go ahead and share your syllabus whenever you're ready!
attachment
attachment

Um, this is the surgery syllabus, which is the major, uh, problem for me because it basically includes the whole surgery. What I was thinking is I'll do the 50/50, like half systemic and half general. I don't know if I am thinking straight or not. Also... You have done-- You have made the Excel sheet. I think you should have made after. I'll share the syllabus and you'll break down the topics, and I'll take them out. Also, I have saved this, uh, Excel sheet in my files, but I can't write or take in, uh, cross anything on that sheet. I don't know what is wrong with it. Also, please go with the option second, create a quick revision cheat sheet for high-yield topics in each subject. Whenever we read a topic, we will do a topic, you will create a cheat sheet for it. The third is generate a Word document with practice MCQ and answers for block exam as well, but do that on the later days when I'll told you. Right now, just, uh, don't do it. Go with the second one. But when we will study, obviously, do then. Also, yes, uh, right now, I sh- I shared this surgery syllabus. After that, I'll share the medicine syllabus, and then the gynae and obs, and then peds.

I can see the full surgery syllabus clearly. Let me address everything you said:
Regarding the Excel sheet - the dropdowns should work when you click on a cell in column G (Status), J (MCQs), or K (Revision). If cells aren't responding, try enabling editing (there's usually a yellow bar at the top in Excel saying "Enable Editing" - click that). The sheet is in "Protected View" by default when downloaded.
Your 50/50 idea (General + Systemic) - yes, you're thinking absolutely right. Mixing both each day keeps it balanced and prevents burnout from doing only one type.
Now let me read the syllabus and plan it out:

Surgery Syllabus Breakdown

From the image, here's what you have:

Systemic Surgery (already had test dates in June - mostly done?)

DateTopic
15 JunOrthopaedics
17 JunKidney + Ureter
19 JunUrinary bladder, Prostate, Seminal vesicles
21 JunUrethra, Penis, Testes, Scrotum
22 JunBreast
23 JunOesophagus
24 JunStomach + Duodenum
25 JunLiver, Pancreas, Spleen
26 JunHepatobiliary System
27 JunPeritoneum, Mesentery, Retroperitoneal space + Intestinal Obstruction
28 JunSmall and Large Intestine
29 JunVermiform Appendix + Rectum & Anal Canal
30 JunHernia, Umbilicus, Abdominal Wall
1 JulEndocrine Surgery

General Surgery (July tests - these are coming up NOW)

DateTopic
2 JulHead & Neck + Neuro Surgeries
3 JulCardiothoracic
4 JulVascular (Arterial + Venous + Lymphatic) + Nerve Disorders
5 JulNutrition
6 JulHaemorrhage & Shock + Wound + Fluids & Electrolytes + Acid-Base
7 JulPre-op + Post-op + Surgical Infections
8 JulPrinciples of Anaesthesia
9 JulPrinciples of Radiology
10 JulBurns + ATLS + Plastic Surgery (skin lesions, grafts, flaps)

Your 50/50 Plan - Here's How to Apply It

Since the General Surgery topics (Jul 2-10) are the ones coming up in your test series, and your block exam is Aug 3, here's the revised Surgery study split per day:
Study DayMorning (General Surgery)Afternoon (Systemic Surgery)
Day 1Haemorrhage, Shock, Fluids & Electrolytes, Acid-BaseIntestinal Obstruction + Hernia + Abdominal Wall
Day 2Pre-op, Post-op, Surgical InfectionsAppendix + Rectum + Anal Canal
Day 3Burns + ATLS + Plastic SurgeryStomach + Duodenum + Oesophagus
Day 4Vascular + Head & Neck + Neuro SurgeryBreast + Endocrine Surgery
Day 5Nutrition + Anaesthesia + RadiologyLiver, Pancreas, Spleen + Hepatobiliary
Day 6 (half-day)Cardiothoracic + revisionKidney, Ureter, Bladder, Prostate revision
This way you're not neglecting either half, and high-yield topics (Shock, Fluids, Appendix, Hernia, Breast) get enough attention.

Cheat Sheet Plan

Now that I have the surgery syllabus, I'll create a cheat sheet for each topic as you study it. Just tell me "I'm starting [topic] today" and I'll generate a tight, high-yield revision sheet for it right away - key facts, mnemonics, investigations, management in bullet points.
Go ahead and share Medicine, Gynae & Obs, and Paeds syllabi whenever you're ready. Once I have all four, I'll have the complete picture and can also update the Excel tracker topics to match your exact syllabus.

Uh, no, I haven't. Uh, this is the reference material for syllabus. The thing which I have done before is the pancreas, spleen, uh, liver, hepatobiliary system, or intestinal obstruction, but I haven't done the, studied the diet from the book. I just studied from the AI, uh, for my VAAT test. Yes. So, I haven't studied properly from the book for MCQs point of view. Okay. Once I'll share the whole syllabus with you of each subject, then you'll divide that syllabus, um, into 22 or 21 days. Mind you, I- Mm-hmm. ... I have, I think, only 20 days on the second of the day, uh, on the s- on the last day, which is 2nd August, please make sure to do, to just re- uh, ma- just have the review because I have traveled back to my hostel or my dorm, so I don't time, uh, find time to st- study. I'll just do the review, and I think, yes. Okay, I have to travel back to my... Also, I'll share the syllabus of the other subject. You will fit them up in the syllabus, in the, sorry, in the schedule. Fit them in the schedule as they share the syllabus of other subject, but at the same time, I'll go with the Excel sheet and check whether it's working or not.

Got it! Let me summarize what I understand so I don't miss anything:
What you've told me:
  1. You've studied Pancreas, Spleen, Liver, Hepatobiliary, Intestinal Obstruction - but only from AI for VIVA/VAAT, not properly from books for MCQs. So these still need proper revision.
  2. Everything else in surgery = not studied at all yet.
  3. Aug 2 = travel day - only light review, no new topics. I'll keep that as revision-only.
  4. You want the full schedule built once all 4 syllabi are shared - I'll wait and fit each subject in as you share it.
  5. The 50/50 General + Systemic Surgery split per day is the plan.
  6. Cheat sheets will be created topic by topic as you study.

My plan going forward:
  • I'll hold the schedule building until you share all 4 syllabi
  • Once I have all 4, I'll divide everything across 20 proper study days (Jul 12 - Aug 1), with Aug 2 as travel + light review only
  • Medicine last (since it's your first exam and needs to be freshest)
  • Surgery 50/50 split (General + Systemic each day)

About the Excel sheet - please check:
  1. When you open it, do you see a yellow bar saying "Enable Editing"? If yes, click it.
  2. Then click on any cell in the Status column (column G) - you should see a small dropdown arrow appear on the right side of the cell.
  3. Click that arrow to select Done / Partial / Not Done.
Let me know if it works! And go ahead and share the Medicine syllabus whenever ready - I'll start fitting things in.
attachment
attachment
attachment
attachment

This is gynae obs syllabus MEDICINE cvs . respiratory . gastro . neuro Maybe Hepato as well but not sure Paeds Development Normal nutrition Malnutrition (kwashiorkor marasmus) Obesity Rickets Immunization topics GIT, Hematology and oncology . Topics include Complete CVS, In Neonatology Prematurity, RDS, Intraventricular hemorrhage , Neonatal Resuscitation, hypoglycemia, normal newborn examination & care And Neonatal Sepsis 1)Growth β€’Anthropometric measurements used to assess growth .Interpret growth charts and percentiles .red flags of abnormal growth .common factors influencing growth 2)Bronchopneumonia 3)Asthma 4)Croup 5)Acute epiglottis 6) Bronchiolitis

Writing File

~/block-exam-prep/create_tracker_v2.py

from openpyxl import Workbook
from openpyxl.styles import Font, PatternFill, Alignment, Border, Side
from openpyxl.utils import get_column_letter
from openpyxl.formatting.rule import CellIsRule
from openpyxl.worksheet.datavalidation import DataValidation
import io as _io

wb = Workbook()

# ─── HELPERS ───────────────────────────────────────────
def hex_fill(h):
    return PatternFill("solid", start_color=h, fgColor=h)

def tb():
    s = Side(style='thin', color='BBBBBB')
    return Border(left=s, right=s, top=s, bottom=s)

def bf(size=11, color='000000'):
    return Font(name='Arial', bold=True, size=size, color=color)

def rf(size=10, color='000000'):
    return Font(name='Arial', size=size, color=color)

def ca():
    return Alignment(horizontal='center', vertical='center', wrap_text=True)

def la():
    return Alignment(horizontal='left', vertical='center', wrap_text=True)

# Colors
NAV   = '1F3864'
WHITE = 'FFFFFF'
ALT   = 'EEF3FB'
WKEND = 'F5F5F5'
TRAVEL= 'FFF3CD'
EXAM  = 'D4EDDA'

SUBJ_COLOR = {
    'Surgery':     '2E75B6',
    'Gynae & Obs': 'C55A11',
    'Paediatrics': '375623',
    'Medicine':    '7030A0',
    'REVIEW':      '595959',
}

COL_DONE    = 'E2EFDA'
COL_PARTIAL = 'FFF2CC'
COL_NOTDONE = 'FCE4D6'

# ─── SHEET 1: DAILY TRACKER ────────────────────────────
ws = wb.active
ws.title = "Daily Tracker"
ws.sheet_view.showGridLines = False
ws.freeze_panes = 'A5'

# Title
ws.merge_cells('A1:L1')
ws['A1'] = 'BLOCK EXAM STUDY TRACKER  |  Exam: 3 August 2026  |  Surgery > Gynae & Obs > Paeds > Medicine'
ws['A1'].font = bf(14, WHITE)
ws['A1'].fill = hex_fill(NAV)
ws['A1'].alignment = ca()
ws.row_dimensions[1].height = 34

ws.merge_cells('A2:L2')
ws['A2'] = '20 Study Days (Jul 12 - Aug 1)  |  Aug 2 = Travel + Review Only  |  Aug 3 = EXAM DAY'
ws['A2'].font = Font(name='Arial', size=10, italic=True, color='D9E1F2')
ws['A2'].fill = hex_fill('2F528F')
ws['A2'].alignment = ca()
ws.row_dimensions[2].height = 20

ws.merge_cells('A3:L3')
ws['A3'].fill = hex_fill('D9E1F2')
ws.row_dimensions[3].height = 5

# Headers
headers = ['Date','Day','Subject','Morning / Block 1 Topics','Afternoon / Block 2 Topics',
           'Hrs\nPlanned','Hrs\nActual','Status','Confidence\n(1-5)','MCQs\nDone?','Notes / Doubts','Revision\nDone?']
col_w   = [11,    9,     13,       38,                         38,
           8,     8,     13,       13,             10,          34,              12]

for ci,(h,w) in enumerate(zip(headers,col_w),1):
    c = ws.cell(4, ci, h)
    c.font = bf(9, WHITE)
    c.fill = hex_fill(NAV)
    c.alignment = ca()
    c.border = tb()
    ws.column_dimensions[get_column_letter(ci)].width = w
ws.row_dimensions[4].height = 30

# ── Schedule rows ──
schedule = [
    # (date, day, subject, morning_topics, afternoon_topics, hrs, day_type)
    # day_type: weekday | weekend | travel
    ('12 Jul','Sun','Surgery',
     'General: Haemorrhage + Shock + Wound Healing',
     'Systemic: Intestinal Obstruction + Hernia + Abdominal Wall',
     4.5,'weekend'),

    ('13 Jul','Mon','Surgery',
     'General: Fluids & Electrolytes + Acid-Base Disorders',
     'Systemic: Appendix + Rectum + Anal Canal',
     8.5,'weekday'),

    ('14 Jul','Tue','Surgery',
     'General: Pre-op + Post-op + Surgical Infections',
     'Systemic: Stomach + Duodenum + Oesophagus',
     8.5,'weekday'),

    ('15 Jul','Wed','Surgery',
     'General: Burns + ATLS + Plastic Surgery (Grafts & Flaps)',
     'Systemic: Breast + Endocrine Surgery (Thyroid, Parathyroid, Adrenal)',
     8.5,'weekday'),

    ('16 Jul','Thu','Surgery',
     'General: Head & Neck + Neuro Surgery + Cardiothoracic',
     'Systemic: Liver + Pancreas + Spleen + Hepatobiliary (Revision - AI-studied, redo from MCQ angle)',
     8.5,'weekday'),

    ('17 Jul','Fri','Surgery',
     'General: Vascular (Arterial + Venous + Lymphatic) + Nutrition',
     'Systemic: Kidney + Ureter + Bladder + Prostate + Urethra + Testes',
     8.5,'weekday'),

    ('18 Jul','Sat','Surgery',
     'General: Principles of Anaesthesia + Radiology + Orthopaedics',
     'Surgery Full Rapid Revision + MCQ Practice (all topics)',
     4.5,'weekend'),

    ('19 Jul','Sun','Gynae & Obs',
     'Obs: ANC + Normal Fetal Development + Fetal Well-being + Prenatal Diagnosis',
     'Gynae: Anatomy of Female Pelvis + Menstrual Cycle + Hormonal Disorders',
     4.5,'weekend'),

    ('20 Jul','Mon','Gynae & Obs',
     'Obs: Antenatal Obstetric Complications + Multiple Pregnancy + Preterm Labour',
     'Gynae: Disorders of Menstrual Bleeding + Contraception & Abortion',
     8.5,'weekday'),

    ('21 Jul','Tue','Gynae & Obs',
     'Obs: Hypertensive Disorders of Pregnancy (Pre-eclampsia, Eclampsia, HELLP)',
     'Gynae: Subfertility + Implantation + Early Pregnancy (Ectopic, Molar)',
     8.5,'weekday'),

    ('22 Jul','Wed','Gynae & Obs',
     'Obs: Normal + Abnormal Labour + Operative Delivery (Forceps, Ventouse, LSCS)',
     'Gynae: Benign Conditions - Ovary (PCOS, Cysts) + Uterus (Fibroids) + Endometriosis',
     8.5,'weekday'),

    ('23 Jul','Thu','Gynae & Obs',
     'Obs: Obstetric Emergencies (APH, PPH) + Puerperium + Neonates (Obstetric chapter)',
     'Gynae: Malignant Disease - Ovary + Uterus + Lower Genital Tract + STIs',
     8.5,'weekday'),

    ('24 Jul','Fri','Gynae & Obs',
     'Obs: Perinatal Infections + Medical Complications of Pregnancy + Full Obs Revision',
     'Gynae: Urogynaecology + Menopause + Full Gynae Revision + MCQs',
     8.5,'weekday'),

    ('25 Jul','Sat','Paediatrics',
     'Growth: Anthropometrics + Growth Charts + Percentiles + Red Flags + Factors',
     'Development Milestones (gross motor, fine motor, speech, social)',
     4.5,'weekend'),

    ('26 Jul','Sun','Paediatrics',
     'Normal Nutrition + Malnutrition: Kwashiorkor + Marasmus + Marasmic-Kwashiorkor',
     'Obesity + Rickets + Vitamin Deficiencies (A, D, C, B12, Iron)',
     4.5,'weekend'),

    ('27 Jul','Mon','Paediatrics',
     'Neonatology: Prematurity + RDS + IVH + Neonatal Resuscitation + Hypoglycaemia',
     'Normal Newborn Exam & Care + Neonatal Sepsis + Immunisation Schedule',
     8.5,'weekday'),

    ('28 Jul','Tue','Paediatrics',
     'Respiratory: Bronchopneumonia + Asthma + Croup + Acute Epiglottitis + Bronchiolitis',
     'Paeds GIT + Haematology & Oncology + Paeds CVS + Full Paeds Revision + MCQs',
     8.5,'weekday'),

    ('29 Jul','Wed','Medicine',
     'CVS: Hypertension + IHD (Angina, MI, ACS) + Heart Failure',
     'CVS: Arrhythmias + Valvular Diseases + Infective Endocarditis',
     8.5,'weekday'),

    ('30 Jul','Thu','Medicine',
     'Respiratory: Asthma + COPD + Tuberculosis + Pneumonia',
     'Respiratory: Pleural Effusion + Lung Cancer + Pneumothorax',
     8.5,'weekday'),

    ('31 Jul','Fri','Medicine',
     'Gastro: Peptic Ulcer Disease + IBD (Crohns + UC) + GI Bleeding',
     'Gastro/Hepato: Cirrhosis + Hepatitis + Jaundice + (Hepato if in syllabus)',
     8.5,'weekday'),

    ('1 Aug','Sat','Medicine',
     'Neuro: Stroke + Epilepsy + Meningitis + Headache',
     'Medicine Full Rapid Revision - ALL topics + High-Yield MCQs',
     4.5,'weekend'),

    ('2 Aug','Sun','REVIEW',
     'TRAVEL DAY - Light Review Only: Skim short notes & cheat sheets for all subjects',
     'NO new topics. Rest, travel, sleep early.',
     3.0,'travel'),
]

for rn,(date,day,subj,morn,aftn,hrs,dtype) in enumerate(schedule, start=5):
    is_travel = dtype == 'travel'
    is_weekend = dtype == 'weekend'
    sc = SUBJ_COLOR.get(subj,'4472C4')

    if is_travel:
        row_bg = TRAVEL
    elif is_weekend:
        row_bg = WKEND
    else:
        row_bg = WHITE if rn%2==1 else ALT

    vals = [date, day, subj, morn, aftn, hrs, '', '', '', 'No', '', 'No']
    for ci,val in enumerate(vals,1):
        c = ws.cell(rn, ci, val)
        c.border = tb()
        c.font = rf(10)
        c.fill = hex_fill(row_bg)

        if ci==1:
            c.font = bf(10)
            c.alignment = ca()
        elif ci==2:
            c.alignment = ca()
            if is_weekend:
                c.font = Font(name='Arial',size=10,bold=True,color='C00000')
            elif is_travel:
                c.font = Font(name='Arial',size=10,bold=True,color='856404')
        elif ci==3:
            c.font = Font(name='Arial',size=10,bold=True,color=WHITE)
            c.fill = hex_fill(sc)
            c.alignment = ca()
        elif ci in (4,5,11):
            c.alignment = la()
        else:
            c.alignment = ca()

    ws.row_dimensions[rn].height = 38

last_row = 4 + len(schedule)

# Data validations
dv_status = DataValidation(type="list", formula1='"Done,Partial,Not Done"', allow_blank=True)
dv_status.sqref = f'H5:H{last_row}'
ws.add_data_validation(dv_status)

dv_conf = DataValidation(type="list", formula1='"1,2,3,4,5"', allow_blank=True)
dv_conf.sqref = f'I5:I{last_row}'
ws.add_data_validation(dv_conf)

dv_yn = DataValidation(type="list", formula1='"Yes,No,Partial"', allow_blank=True)
dv_yn.sqref = f'J5:L{last_row}'
ws.add_data_validation(dv_yn)

# Conditional formatting on Status col H
ws.conditional_formatting.add(f'H5:H{last_row}',
    CellIsRule(operator='equal', formula=['"Done"'], fill=hex_fill(COL_DONE)))
ws.conditional_formatting.add(f'H5:H{last_row}',
    CellIsRule(operator='equal', formula=['"Partial"'], fill=hex_fill(COL_PARTIAL)))
ws.conditional_formatting.add(f'H5:H{last_row}',
    CellIsRule(operator='equal', formula=['"Not Done"'], fill=hex_fill(COL_NOTDONE)))

# Summary
sr = last_row + 2
ws.merge_cells(f'A{sr}:C{sr}')
ws.cell(sr,1,'PROGRESS SUMMARY').font = bf(11,WHITE)
ws.cell(sr,1).fill = hex_fill(NAV)
ws.cell(sr,1).alignment = ca()

sum_labels = ['Days Done','Days Partial','Days Not Done','Days Remaining','Planned Hrs','Actual Hrs']
sum_formulas = [
    f'=COUNTIF(H5:H{last_row},"Done")',
    f'=COUNTIF(H5:H{last_row},"Partial")',
    f'=COUNTIF(H5:H{last_row},"Not Done")',
    f'={len(schedule)}-COUNTIF(H5:H{last_row},"Done")-COUNTIF(H5:H{last_row},"Partial")',
    f'=SUM(F5:F{last_row})',
    f'=SUM(G5:G{last_row})',
]
sr2 = sr + 1
for i,(lbl,frm) in enumerate(zip(sum_labels,sum_formulas)):
    col = 4+i
    lc = ws.cell(sr, col, lbl)
    lc.font = bf(9,NAV); lc.fill = hex_fill('D9E1F2')
    lc.alignment = ca(); lc.border = tb()
    vc = ws.cell(sr2, col, frm)
    vc.font = bf(12,'1F3864'); vc.fill = hex_fill('EEF3FB')
    vc.alignment = ca(); vc.border = tb()

ws.row_dimensions[sr].height = 22
ws.row_dimensions[sr2].height = 28

# ─── SHEET 2: FULL SYLLABUS BREAKDOWN ──────────────────
ws2 = wb.create_sheet("Syllabus Breakdown")
ws2.sheet_view.showGridLines = False

ws2.merge_cells('A1:F1')
ws2['A1'] = 'COMPLETE SYLLABUS BREAKDOWN - All 4 Subjects'
ws2['A1'].font = bf(14,WHITE)
ws2['A1'].fill = hex_fill(NAV)
ws2['A1'].alignment = ca()
ws2.row_dimensions[1].height = 32

syllabus = {
    'Surgery': {
        'color': '2E75B6',
        'General Surgery': [
            ('Haemorrhage & Shock','High'),('Wound Healing','High'),
            ('Fluids & Electrolytes','High'),('Acid-Base Disorders','High'),
            ('Burns - Rule of 9s + Management','High'),('ATLS Principles','High'),
            ('Plastic Surgery - Grafts & Flaps','Medium'),
            ('Pre-op Assessment','High'),('Post-op Complications','High'),
            ('Surgical Infections','High'),
            ('Head & Neck Surgery','Medium'),('Neuro Surgery basics','Medium'),
            ('Cardiothoracic Surgery','Medium'),
            ('Vascular - Arterial + Venous + Lymphatic','High'),
            ('Nutrition in Surgery','Medium'),
            ('Principles of Anaesthesia','High'),
            ('Principles of Radiology','Medium'),
            ('Orthopaedics (basics)','Medium'),
        ],
        'Systemic Surgery': [
            ('Intestinal Obstruction','High'),('Hernia (Inguinal, Femoral, Umbilical)','High'),
            ('Appendix & Appendicitis','High'),('Rectum & Anal Canal (piles, fissure, fistula)','High'),
            ('Stomach & Duodenum (PUD, Ca Stomach)','High'),
            ('Oesophagus (GERD, Carcinoma)','High'),
            ('Breast (Fibroadenoma, Ca Breast)','High'),
            ('Endocrine Surgery - Thyroid','High'),('Endocrine Surgery - Parathyroid + Adrenal','Medium'),
            ('Head & Neck Surgery (Salivary glands, Thyroglossal cyst)','Medium'),
            ('Liver - Abscess, Hydatid, Ca Liver','High'),
            ('Pancreas - Pancreatitis, Ca Pancreas','High'),
            ('Spleen - Splenomegaly, Splenectomy','Medium'),
            ('Hepatobiliary - Gallstones, Cholecystitis','High'),
            ('Kidney + Ureter - Calculi, Hydronephrosis, Tumors','High'),
            ('Bladder + Prostate - BPH, Ca Prostate','High'),
            ('Urethra + Penis + Testes & Scrotum','Medium'),
        ]
    },
    'Gynae & Obs': {
        'color': 'C55A11',
        'Obstetrics': [
            ('Obstetric History & Examination','High'),
            ('Antenatal Care (ANC)','High'),
            ('Normal Fetal Development & Growth','High'),
            ('Assessment of Fetal Well-being (CTG, BPP)','High'),
            ('Prenatal Diagnosis (AFP, amniocentesis)','High'),
            ('Antenatal Obstetric Complications','High'),
            ('Multiple Pregnancy','High'),
            ('Preterm Labour','High'),
            ('Hypertensive Disorders - Pre-eclampsia + Eclampsia + HELLP','High'),
            ('Medical Complications of Pregnancy (DM, cardiac, thyroid)','High'),
            ('Perinatal Infections (TORCH, GBS, HIV)','High'),
            ('Normal Labour + Partograph','High'),
            ('Abnormal Labour + Dystocia','High'),
            ('Operative Delivery (Forceps, Ventouse, LSCS)','High'),
            ('Obstetric Emergencies: APH + PPH','High'),
            ('Obstetric Emergencies: Ectopic Pregnancy + Molar Pregnancy','High'),
            ('Puerperium + Puerperal Sepsis + PPD','High'),
            ('Neonates (Obstetric chapter - normal newborn)','Medium'),
        ],
        'Gynaecology': [
            ('Anatomy of Female Sexual Organs & Pelvis','High'),
            ('Hormonal Control of Menstrual Cycle','High'),
            ('Disorders of Menstrual Bleeding (DUB, amenorrhoea)','High'),
            ('Contraception + Abortion','High'),
            ('Implantation & Early Pregnancy','Medium'),
            ('Subfertility','High'),
            ('Menopause & Post-reproductive Health','Medium'),
            ('STIs and Related Conditions','Medium'),
            ('Urogynaecology & Pelvic Floor Problems','Medium'),
            ('Benign Conditions of Ovary & Pelvis (PCOS, cysts)','High'),
            ('Benign Conditions of Uterus, Cervix & Endometrium (Fibroids)','High'),
            ('Benign Conditions of Vulva & Vagina','Medium'),
            ('Malignant Disease of the Ovary','High'),
            ('Malignant Disease of the Uterus (Endometrial Ca)','High'),
            ('Premalignant + Malignant Disease of Lower Genital Tract (Cx Ca)','High'),
        ]
    },
    'Paediatrics': {
        'color': '375623',
        'Paediatrics': [
            ('Growth - Anthropometric Measurements','High'),
            ('Growth Charts, Percentiles, Red Flags','High'),
            ('Development Milestones (gross/fine motor, speech, social)','High'),
            ('Normal Nutrition in Paediatrics','High'),
            ('Malnutrition - Kwashiorkor + Marasmus','High'),
            ('Obesity in Children','Medium'),
            ('Rickets + Vitamin D Deficiency','High'),
            ('Vitamin Deficiencies (A, C, B12, Iron)','High'),
            ('Immunisation Schedule','High'),
            ('Neonatology - Prematurity + Complications','High'),
            ('Respiratory Distress Syndrome (RDS)','High'),
            ('Intraventricular Haemorrhage (IVH)','High'),
            ('Neonatal Resuscitation (NRP algorithm)','High'),
            ('Neonatal Hypoglycaemia','High'),
            ('Normal Newborn Examination & Care','High'),
            ('Neonatal Sepsis','High'),
            ('Paediatric GIT Diseases','Medium'),
            ('Paediatric Haematology & Oncology','Medium'),
            ('Paediatric CVS','Medium'),
            ('Bronchopneumonia','High'),
            ('Asthma in Children','High'),
            ('Croup (Laryngotracheobronchitis)','High'),
            ('Acute Epiglottitis','High'),
            ('Bronchiolitis','High'),
        ]
    },
    'Medicine': {
        'color': '7030A0',
        'Medicine': [
            ('Hypertension - Classification, Management','High'),
            ('Ischaemic Heart Disease - Angina, MI, ACS','High'),
            ('Heart Failure - Causes, Features, Management','High'),
            ('Arrhythmias - AF, VT, Heart Block','High'),
            ('Valvular Heart Diseases','High'),
            ('Infective Endocarditis','Medium'),
            ('Asthma - Classification, Management, Status asthmaticus','High'),
            ('COPD - GOLD staging, Management','High'),
            ('Tuberculosis - Types, Diagnosis, ATT','High'),
            ('Pneumonia - CAP vs HAP, Management','High'),
            ('Pleural Effusion + Pneumothorax','High'),
            ('Lung Cancer (basics)','Medium'),
            ('Peptic Ulcer Disease + H. pylori','High'),
            ('Inflammatory Bowel Disease - Crohns + UC','High'),
            ('GI Bleeding (upper + lower)','High'),
            ('Cirrhosis - Complications, Management','High'),
            ('Hepatitis (A, B, C, E) - Serology, Management','High'),
            ('Jaundice - Approach','High'),
            ('Hepato topics (if in syllabus)','Medium'),
            ('Stroke - Types, Investigations, Management','High'),
            ('Epilepsy - Classification, Drugs','High'),
            ('Meningitis - Bacterial vs Viral, CSF findings','High'),
        ]
    }
}

cur2 = 3
col_hdrs2 = ['#','Topic','Priority','Status','Confidence (1-5)','Revision Date']
col_w2    = [4, 52, 10, 14, 16, 14]
for ci,(h,w) in enumerate(col_hdrs2,1):
    ws2.column_dimensions[get_column_letter(ci)].width = w

for subj_name, subj_info in syllabus.items():
    sc = subj_info['color']
    # Subject big header
    ws2.merge_cells(f'A{cur2}:F{cur2}')
    c = ws2.cell(cur2,1, f'  {subj_name.upper()}')
    c.font = bf(13,WHITE); c.fill = hex_fill(sc)
    c.alignment = la()
    ws2.row_dimensions[cur2].height = 28
    cur2 += 1

    for section_name, topics in subj_info.items():
        if section_name == 'color': continue

        # Section sub-header
        ws2.merge_cells(f'A{cur2}:F{cur2}')
        c2 = ws2.cell(cur2,1,f'    {section_name}')
        c2.font = bf(10,WHITE)
        c2.fill = hex_fill('2F528F')
        c2.alignment = la()
        ws2.row_dimensions[cur2].height = 22
        cur2 += 1

        # column headers
        for ci,(h,w) in enumerate(zip(col_hdrs2,col_w2),1):
            ch = ws2.cell(cur2,ci,h)
            ch.font = bf(9,WHITE); ch.fill = hex_fill('404040')
            ch.alignment = ca(); ch.border = tb()
        ws2.row_dimensions[cur2].height = 20
        cur2 += 1

        dv = DataValidation(type="list", formula1='"Done,Partial,Not Done"', allow_blank=True)
        ts = cur2
        for ti,(topic,prio) in enumerate(topics,1):
            bg = WHITE if ti%2==1 else ALT
            vals2 = [ti, topic, prio, '', '', '']
            for ci,val in enumerate(vals2,1):
                c = ws2.cell(cur2,ci,val)
                c.font = rf(10); c.fill = hex_fill(bg)
                c.border = tb()
                c.alignment = ca() if ci in (1,3,4,5,6) else la()
            pc = ws2.cell(cur2,3)
            pc.font = Font(name='Arial',size=10,bold=True,
                           color='C00000' if prio=='High' else '7030A0')
            ws2.row_dimensions[cur2].height = 20
            cur2 += 1

        dv.sqref = f'D{ts}:D{cur2-1}'
        ws2.add_data_validation(dv)
        cur2 += 1  # spacer

# ─── SHEET 3: CHEAT SHEET LOG ──────────────────────────
ws3 = wb.create_sheet("Cheat Sheet Log")
ws3.sheet_view.showGridLines = False

ws3.merge_cells('A1:E1')
ws3['A1'] = 'CHEAT SHEET LOG  |  A new cheat sheet is created each time you study a topic'
ws3['A1'].font = bf(12,WHITE); ws3['A1'].fill = hex_fill(NAV)
ws3['A1'].alignment = ca(); ws3.row_dimensions[1].height = 30

ws3.merge_cells('A2:E2')
ws3['A2'] = 'Tell Orris "I am studying [topic] today" and a cheat sheet will be generated for that topic.'
ws3['A2'].font = Font(name='Arial',size=10,italic=True,color='2F528F')
ws3['A2'].fill = hex_fill('D9E1F2'); ws3['A2'].alignment = ca()
ws3.row_dimensions[2].height = 22

log_hdrs = ['Date Studied','Subject','Topic','Cheat Sheet Created?','Notes']
log_w    = [14,13,40,20,35]
for ci,(h,w) in enumerate(zip(log_hdrs,log_w),1):
    c = ws3.cell(3,ci,h)
    c.font = bf(10,WHITE); c.fill = hex_fill(NAV)
    c.alignment = ca(); c.border = tb()
    ws3.column_dimensions[get_column_letter(ci)].width = w
ws3.row_dimensions[3].height = 24

for ri in range(4,30):
    bg = WHITE if ri%2==0 else ALT
    for ci in range(1,6):
        c = ws3.cell(ri,ci,'')
        c.fill = hex_fill(bg); c.border = tb(); c.alignment = ca()
    ws3.row_dimensions[ri].height = 22

dv_cs = DataValidation(type="list", formula1='"Yes,No,Pending"', allow_blank=True)
dv_cs.sqref = 'D4:D29'
ws3.add_data_validation(dv_cs)

# ─── SAVE ──────────────────────────────────────────────
output = '/home/daytona/workspace/block-exam-prep/Block_Exam_Study_Tracker_v2.xlsx'
buf = _io.BytesIO()
wb.save(buf)
with open(output,'wb') as f:
    f.write(buf.getvalue())
print(f"Saved: {output}")
Running Command

cd /home/daytona/workspace/block-exam-prep && python create_tracker_v2.py 2>&1

Editing File

~/block-exam-prep/create_tracker_v2.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/block-exam-prep/create_tracker_v2.py'
Running Command

cd /home/daytona/workspace/block-exam-prep && python create_tracker_v2.py 2>&1

Running Command

python /home/daytona/skills/xlsx/scripts/recalc.py /home/daytona/workspace/block…

Here's the updated tracker with everything built in from your actual syllabi:

Block Exam Study Tracker v2

Spreadsheet Β· XLSX


What's inside (3 sheets):
SheetContents
Daily TrackerAll 22 rows (Jul 12 - Aug 2), split Morning/Afternoon columns, Status dropdown (Done/Partial/Not Done), auto color-coding, Confidence, MCQs, Notes, Revision. Aug 2 row is highlighted yellow as Travel Day.
Syllabus BreakdownEvery single topic from all 4 subjects with Priority (High/Medium) and Status tracking. Surgery split into General + Systemic. Obs and Gynae separate sections.
Cheat Sheet LogA running log you can fill in each time a cheat sheet is created for a topic - so you track which topics have cheat sheets and which don't.

About the dropdown not working - when you open the file, look for a yellow bar at the top that says "Enable Editing" and click it. After that, click any cell in the Status column (H) and a small arrow will appear on the right - click that to select Done/Partial/Not Done.
Ready for cheat sheets! Just tell me: "I'm starting [topic] today" and I'll generate a tight high-yield cheat sheet for it immediately. What are you starting with today - Haemorrhage & Shock, or Intestinal Obstruction + Hernia?
attachment
attachment

When I opened it in iPad, because I have an iPad, so this is what it shows, and there is no toggle. Section for editing, no. Like, no such thing. Like, how do I work in it? Also, yes, you'll do all three things. I'll told you which topic I am sh- starting, like, after some rest, obviously, I'll told you the topic. Second is you will create a quick reference PDF for high yield MCQ answer on today's topic, which I told you. And the last thing you will do that you'll practice MCQ for surgery topic with answer explanation. You'll do all three things.

The sheet is opening in Numbers (Apple's spreadsheet app on iPad) - that's why there's no "Enable Editing" option. Numbers handles Excel files differently from Microsoft Excel.
To fill in the Status/dropdown cells in Numbers on iPad:
  1. Tap any empty cell (like the Status column)
  2. A keyboard will appear at the bottom - just type directly (type "Done", "Partial", or "Not Done")
  3. The color formatting will apply automatically once you type and confirm
The dropdowns work in Microsoft Excel on desktop. On Numbers/iPad, just type the values directly - it still works, just no dropdown arrow.

Great - the sheet is loading perfectly! I can see all 4 subjects with topics and priorities showing correctly.

Now, noted on the 3 things I'll do each time you tell me a topic:
Workflow for each topic you study:
  1. πŸ“‹ Cheat Sheet - high-yield revision notes (key facts, mnemonics, investigations, management)
  2. πŸ“„ Quick Reference PDF - high-yield MCQ-focused answers on that topic
  3. βœ… Practice MCQs - with answer + explanation
Whenever you're rested and ready, just say: "Starting [topic name]"
and I'll do all three immediately.

While you rest, let me give you today's starting point. Based on your Day 1 plan (today, Sunday, half-day), you're covering:
  • Morning: Haemorrhage + Shock + Wound Healing (General Surgery)
  • Afternoon: Intestinal Obstruction + Hernia + Abdominal Wall (Systemic Surgery)
Just say "Starting Haemorrhage and Shock" whenever you're ready and I'll fire all three deliverables for that topic. Rest well! πŸ’ͺ

Okay. I'll start with the intestinal obstruction. Okay, I'll upload the pictures. From the chapter Intestinal Obstruction for you to simplify it for me. And at this, and this, and simultaneously, you'll do all three other, uh, things as well, okay?

Perfect! Go ahead and upload the pictures of the Intestinal Obstruction chapter.
Once you share them, I'll simultaneously do all four things:
  1. πŸ“– Simplify the chapter - explain it in easy, clear language from your book images
  2. πŸ“‹ Cheat Sheet - high-yield revision notes with mnemonics
  3. πŸ“„ Quick Reference PDF - MCQ-focused key points
  4. βœ… Practice MCQs - with answers and explanations
Upload whenever ready! πŸ“Έ
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment

Okay, I have uploaded the picture of half chapter, not the full. The other nine I'll upload once I'm done with these 10 pictures.

Reading File
Writing File

~/block-exam-prep/intestinal_obstruction_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 cm
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table,
                                 TableStyle, HRFlowable, KeepTogether)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
import os

OUTPUT = '/home/daytona/workspace/block-exam-prep/Intestinal_Obstruction_Cheatsheet.pdf'

doc = SimpleDocTemplate(OUTPUT, pagesize=A4,
                        leftMargin=1.8*cm, rightMargin=1.8*cm,
                        topMargin=1.8*cm, bottomMargin=1.8*cm)

W = A4[0] - 3.6*cm  # usable width

# ── Color palette ─────────────────────────────────────
NAV    = colors.HexColor('#1F3864')
BLUE   = colors.HexColor('#2E75B6')
PINK   = colors.HexColor('#C0143C')
GREEN  = colors.HexColor('#375623')
ORANGE = colors.HexColor('#C55A11')
PURPLE = colors.HexColor('#7030A0')
LTBLUE = colors.HexColor('#D9E1F2')
LTYELL = colors.HexColor('#FFF2CC')
LTGRN  = colors.HexColor('#E2EFDA')
LTPINK = colors.HexColor('#FCE4D6')
WHITE  = colors.white
BLACK  = colors.black

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

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

TITLE    = S('TITLE',    fontSize=20, textColor=WHITE,      alignment=TA_CENTER, fontName='Helvetica-Bold', spaceAfter=4)
SUBTITLE = S('SUBTITLE', fontSize=11, textColor=LTBLUE,     alignment=TA_CENTER, fontName='Helvetica',      spaceAfter=2)
H1       = S('H1',       fontSize=13, textColor=WHITE,      alignment=TA_LEFT,   fontName='Helvetica-Bold', spaceAfter=2, spaceBefore=4)
H2       = S('H2',       fontSize=11, textColor=NAV,        alignment=TA_LEFT,   fontName='Helvetica-Bold', spaceAfter=2, spaceBefore=6)
H3       = S('H3',       fontSize=10, textColor=PINK,       alignment=TA_LEFT,   fontName='Helvetica-Bold', spaceAfter=1, spaceBefore=3)
BODY     = S('BODY',     fontSize=9,  textColor=BLACK,      alignment=TA_JUSTIFY,fontName='Helvetica',      spaceAfter=2, leading=13)
BULL     = S('BULL',     fontSize=9,  textColor=BLACK,      alignment=TA_LEFT,   fontName='Helvetica',      spaceAfter=1, leading=12, leftIndent=12)
SMALL    = S('SMALL',    fontSize=8,  textColor=colors.HexColor('#444444'), fontName='Helvetica', leading=11)
MNEM     = S('MNEM',     fontSize=10, textColor=PURPLE,     fontName='Helvetica-Bold', spaceAfter=1, leading=13)
WARN     = S('WARN',     fontSize=9,  textColor=PINK,       fontName='Helvetica-Bold', spaceAfter=1, leading=12)

def hdr_table(text, bg=NAV, style=H1):
    t = Table([[Paragraph(text, style)]], colWidths=[W])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), bg),
        ('ROUNDEDCORNERS', [4]),
        ('TOPPADDING',  (0,0),(-1,-1), 5),
        ('BOTTOMPADDING',(0,0),(-1,-1), 5),
        ('LEFTPADDING', (0,0),(-1,-1), 8),
    ]))
    return t

def sub_hdr(text, bg=BLUE):
    style = S('sh', fontSize=11, textColor=WHITE, fontName='Helvetica-Bold',
              alignment=TA_LEFT, spaceAfter=0)
    t = Table([[Paragraph(text, style)]], colWidths=[W])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), bg),
        ('TOPPADDING',  (0,0),(-1,-1), 4),
        ('BOTTOMPADDING',(0,0),(-1,-1), 4),
        ('LEFTPADDING', (0,0),(-1,-1), 8),
    ]))
    return t

def box(content_rows, bg=LTBLUE, border=BLUE):
    """content_rows: list of Paragraph objects"""
    cells = [[p] for p in content_rows]
    t = Table(cells, colWidths=[W])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0),(-1,-1), bg),
        ('BOX', (0,0),(-1,-1), 1, border),
        ('TOPPADDING',  (0,0),(-1,-1), 3),
        ('BOTTOMPADDING',(0,0),(-1,-1), 3),
        ('LEFTPADDING', (0,0),(-1,-1), 10),
        ('RIGHTPADDING', (0,0),(-1,-1), 6),
    ]))
    return t

def two_col(left_items, right_items, bg_l=LTBLUE, bg_r=LTGRN):
    cw = W/2 - 2
    def make_cell(items, bg):
        rows = [[Paragraph(it, BULL)] for it in items]
        t = Table(rows, colWidths=[cw])
        t.setStyle(TableStyle([
            ('BACKGROUND',(0,0),(-1,-1),bg),
            ('TOPPADDING',(0,0),(-1,-1),2),
            ('BOTTOMPADDING',(0,0),(-1,-1),2),
            ('LEFTPADDING',(0,0),(-1,-1),6),
        ]))
        return t
    outer = Table([[make_cell(left_items, bg_l), make_cell(right_items, bg_r)]],
                  colWidths=[cw+2, cw+2])
    outer.setStyle(TableStyle([
        ('VALIGN',(0,0),(-1,-1),'TOP'),
        ('LEFTPADDING',(0,0),(-1,-1),0),
        ('RIGHTPADDING',(0,0),(-1,-1),0),
    ]))
    return outer

def b(txt): return f'<b>{txt}</b>'
def c(txt, col='#C0143C'): return f'<font color="{col}">{txt}</font>'
def u(txt): return f'<u>{txt}</u>'

# ══════════════════════════════════════════════════════
# BUILD STORY
# ══════════════════════════════════════════════════════
story = []

# ── COVER HEADER ──────────────────────────────────────
cover = Table([[Paragraph('INTESTINAL OBSTRUCTION', TITLE),
                Paragraph('High-Yield Cheat Sheet + MCQ Reference  |  Surgery Block Exam', SUBTITLE)]],
              colWidths=[W])
cover.setStyle(TableStyle([
    ('BACKGROUND',(0,0),(-1,-1), NAV),
    ('TOPPADDING',(0,0),(-1,-1), 10),
    ('BOTTOMPADDING',(0,0),(-1,-1), 10),
    ('LEFTPADDING',(0,0),(-1,-1), 10),
    ('SPAN',(0,0),(0,1)),
]))
story.append(hdr_table('πŸ“‹  INTESTINAL OBSTRUCTION  |  High-Yield Cheat Sheet + MCQ Reference', NAV, H1))
story.append(Spacer(1, 4))

# ══ SECTION 1: CLASSIFICATION ═════════════════════════
story.append(sub_hdr('1.  CLASSIFICATION', BLUE))
story.append(Spacer(1,3))

class_data = [
    [Paragraph(b('TYPE'), BULL), Paragraph(b('DESCRIPTION'), BULL), Paragraph(b('EXAMPLES'), BULL)],
    [Paragraph(c('DYNAMIC','#1F3864'), BULL),
     Paragraph('Peristalsis working <b>against</b> a mechanical block', BULL),
     Paragraph('Adhesions, Hernia, Malignancy, Volvulus, Intussusception, Stricture, Gallstone ileus', BULL)],
    [Paragraph(c('ADYNAMIC','#C0143C'), BULL),
     Paragraph('<b>No</b> mechanical block; peristalsis absent/inadequate', BULL),
     Paragraph('Paralytic ileus, Pseudo-obstruction', BULL)],
]
ct = Table(class_data, colWidths=[W*0.22, W*0.38, W*0.40])
ct.setStyle(TableStyle([
    ('BACKGROUND',(0,0),(-1,0), NAV),
    ('TEXTCOLOR',(0,0),(-1,0), WHITE),
    ('BACKGROUND',(0,1),(-1,1), LTBLUE),
    ('BACKGROUND',(0,2),(-1,2), LTPINK),
    ('BOX',(0,0),(-1,-1),1,BLUE),
    ('INNERGRID',(0,0),(-1,-1),0.5,colors.HexColor('#AAAAAA')),
    ('TOPPADDING',(0,0),(-1,-1),4),
    ('BOTTOMPADDING',(0,0),(-1,-1),4),
    ('LEFTPADDING',(0,0),(-1,-1),6),
    ('VALIGN',(0,0),(-1,-1),'TOP'),
]))
story.append(ct)
story.append(Spacer(1,4))

# Most common causes (pie chart data from book)
story.append(Paragraph(b('Most Common Causes (from book pie chart):'), H2))
causes_data = [
    [Paragraph(b('Cause'), BULL), Paragraph(b('Frequency'), BULL),
     Paragraph(b('Cause'), BULL), Paragraph(b('Frequency'), BULL)],
    [Paragraph('Adhesions', BULL), Paragraph(c('40%','#1F3864'), BULL),
     Paragraph('Faecal impaction', BULL), Paragraph('8%', BULL)],
    [Paragraph('Inflammatory', BULL), Paragraph('15%', BULL),
     Paragraph('Pseudo-obstruction', BULL), Paragraph('5%', BULL)],
    [Paragraph('Carcinoma', BULL), Paragraph('15%', BULL),
     Paragraph('Miscellaneous', BULL), Paragraph('5%', BULL)],
    [Paragraph('Obstructed hernia', BULL), Paragraph('12%', BULL),
     Paragraph('', BULL), Paragraph('', BULL)],
]
caut = Table(causes_data, colWidths=[W*0.3, W*0.2, W*0.3, W*0.2])
caut.setStyle(TableStyle([
    ('BACKGROUND',(0,0),(-1,0), colors.HexColor('#2F528F')),
    ('TEXTCOLOR',(0,0),(-1,0), WHITE),
    ('ROWBACKGROUNDS',(0,1),(-1,-1),[LTBLUE, WHITE]),
    ('BOX',(0,0),(-1,-1),1,BLUE),
    ('INNERGRID',(0,0),(-1,-1),0.5,colors.HexColor('#CCCCCC')),
    ('TOPPADDING',(0,0),(-1,-1),3),('BOTTOMPADDING',(0,0),(-1,-1),3),
    ('LEFTPADDING',(0,0),(-1,-1),6),
    ('VALIGN',(0,0),(-1,-1),'MIDDLE'),
]))
story.append(caut)
story.append(box([Paragraph(f'πŸ”‘  {b("MCQ TIP:")} Adhesions = #1 cause of SBO in western countries (40%). '
                            f'Carcinoma = most common cause of {b("large")} bowel obstruction.', WARN)], LTYELL, ORANGE))
story.append(Spacer(1,4))

# ══ SECTION 2: PATHOPHYSIOLOGY ════════════════════════
story.append(sub_hdr('2.  PATHOPHYSIOLOGY  (Simple)', BLUE))
story.append(Spacer(1,3))
path_steps = [
    '1.  Obstruction occurs β†’ bowel PROXIMAL distends, bowel DISTAL collapses',
    '2.  Gas accumulates (90% = Nitrogen + Hydrogen sulphide) due to aerobic + anaerobic bacterial overgrowth',
    '3.  Fluid accumulates (saliva 500 mL + bile 500 mL + pancreatic 500 mL + gastric 1 L = ~2.5 L/day) β†’ cannot be absorbed β†’ dehydration + electrolyte loss',
    '4.  Proximal peristalsis ↑ (trying to overcome) β†’ eventually fatigues β†’ flaccidity + paralysis',
    '5.  If strangulation β†’ blood supply cut off β†’ ischaemia β†’ necrosis β†’ perforation β†’ peritonitis β†’ DEATH',
]
story.append(box([Paragraph(p, BULL) for p in path_steps], LTBLUE, BLUE))
story.append(Spacer(1,4))

# ══ SECTION 3: STRANGULATION ══════════════════════════
story.append(sub_hdr('3.  STRANGULATION  ⚠️  SURGICAL EMERGENCY', PINK))
story.append(Spacer(1,3))
story.append(Paragraph(b('Causes of strangulation:'), H3))
story.append(two_col(
    [b('Direct pressure on bowel wall:'), 'β€’ Hernial orifices', 'β€’ Adhesions/bands'],
    [b('Interrupted mesenteric flow:'), 'β€’ Volvulus', 'β€’ Intussusception',
     b('Increased intraluminal P:'), 'β€’ Closed-loop obstruction']
))
story.append(Spacer(1,3))
story.append(box([
    Paragraph(f'⚠️  {b("Clinical features of STRANGULATION")} (Summary Box 78.8):', WARN),
    Paragraph('β€’ Constant, severe pain (not colicky - RED FLAG)', BULL),
    Paragraph('β€’ Tenderness with rigidity and peritonism', BULL),
    Paragraph('β€’ Shock', BULL),
    Paragraph(f'{b("KEY:")} In strangulation, pain may be ABSENT (bowel is dead). Fever + tachycardia are late signs.', WARN),
], LTPINK, PINK))
story.append(Spacer(1,4))

# ══ SECTION 4: CLINICAL FEATURES ══════════════════════
story.append(sub_hdr('4.  CLINICAL FEATURES  -  The Classic QUARTET', BLUE))
story.append(Spacer(1,3))

quartet = [
    [Paragraph(b('SYMPTOM'), BULL), Paragraph(b('SMALL BOWEL'), BULL), Paragraph(b('LARGE BOWEL'), BULL)],
    [Paragraph(c('Pain','#7030A0'), BULL),
     Paragraph('Colicky, central/periumbilical, EARLY, severe', BULL),
     Paragraph('Lower abdomen, less severe, late onset', BULL)],
    [Paragraph(c('Vomiting','#7030A0'), BULL),
     Paragraph('EARLY, profuse, causes rapid dehydration; becomes faeculent (bacterial overgrowth)', BULL),
     Paragraph('LATE or absent in low obstruction', BULL)],
    [Paragraph(c('Distension','#7030A0'), BULL),
     Paragraph('Minimal in HIGH SBO; marked in LOW SBO. Visible peristalsis may be seen', BULL),
     Paragraph('EARLY and pronounced. Colon proximal to obstruction distended on X-ray', BULL)],
    [Paragraph(c('Absolute Constipation','#7030A0'), BULL),
     Paragraph('Present in complete obstruction (neither faeces NOR flatus passed)', BULL),
     Paragraph('Cardinal feature. May pass flatus/faeces early (distal bowel evacuation)', BULL)],
]
qt = Table(quartet, colWidths=[W*0.2, W*0.40, W*0.40])
qt.setStyle(TableStyle([
    ('BACKGROUND',(0,0),(-1,0), NAV),
    ('TEXTCOLOR',(0,0),(-1,0), WHITE),
    ('ROWBACKGROUNDS',(0,1),(-1,-1),[colors.HexColor('#F3E8FF'), WHITE]),
    ('BOX',(0,0),(-1,-1),1,PURPLE),
    ('INNERGRID',(0,0),(-1,-1),0.5,colors.HexColor('#CCCCCC')),
    ('TOPPADDING',(0,0),(-1,-1),4),('BOTTOMPADDING',(0,0),(-1,-1),4),
    ('LEFTPADDING',(0,0),(-1,-1),6),
    ('VALIGN',(0,0),(-1,-1),'TOP'),
]))
story.append(qt)
story.append(Spacer(1,3))

story.append(box([
    Paragraph(f'πŸ”‘  {b("Absolute constipation does NOT apply in:")}', WARN),
    Paragraph("Richter's hernia | Gallstone ileus | Mesenteric vascular occlusion | "
              "Functional obstruction with pelvic abscess | Partial obstruction", BULL),
], LTYELL, ORANGE))
story.append(Spacer(1,4))

# ══ SECTION 5: SPECIAL TYPES ══════════════════════════
story.append(sub_hdr('5.  SPECIAL TYPES OF MECHANICAL OBSTRUCTION', BLUE))
story.append(Spacer(1,3))

spec_data = [
    [Paragraph(b('TYPE'), BULL), Paragraph(b('KEY FACTS'), BULL), Paragraph(b('MCQ POINTS'), BULL)],
    [Paragraph(c('Closed-loop\nObstruction','#1F3864'), BULL),
     Paragraph('Bowel obstructed at BOTH ends. Distension confined to loop. Classic = malignant stricture of colon + competent ileocaecal valve', BULL),
     Paragraph('Ileocaecal valve competent β†’ caecal distension greatest (most vulnerable to ischaemia)', BULL)],
    [Paragraph(c('Volvulus','#C0143C'), BULL),
     Paragraph('Twisting >180Β° (obstruction) or >360Β° (vascular occlusion). Most common spontaneous type in adults = SIGMOID. Neonatal midgut = life-threatening', BULL),
     Paragraph('Sigmoid: anticlockwise rotation. Predisposed by: African population, high-residue diet, chronic constipation. Coffee-bean sign on X-ray', BULL)],
    [Paragraph(c('Intussusception','#375623'), BULL),
     Paragraph('One segment invaginates into adjacent. Peak: 5-10 months. 90% idiopathic in children. Most common type = ILEOCOLIC (77%)', BULL),
     Paragraph('"Redcurrant jelly" stool. Sausage-shaped lump. Sign of Dance (emptiness RIF). Target sign on CT/USS. Radiological reduction first-line in children', BULL)],
    [Paragraph(c('Adhesions','#7030A0'), BULL),
     Paragraph('#1 cause of SBO in western world. Forms within hours of abdominal surgery. Most common site: lower small bowel', BULL),
     Paragraph('Risk of adhesional SBO after any laparotomy = 4%. Risk of laparotomy for adhesions = 2%', BULL)],
    [Paragraph(c('Gallstone Ileus','#C55A11'), BULL),
     Paragraph('Large gallstone erodes through gallbladder β†’ duodenum β†’ impacts ~60 cm proximal to ileocaecal valve', BULL),
     Paragraph("Rigler's Triad: SBO + pneumobilia + ectopic gallstone shadow. Seen in 40-50% of cases", BULL)],
]
st = Table(spec_data, colWidths=[W*0.18, W*0.42, W*0.40])
st.setStyle(TableStyle([
    ('BACKGROUND',(0,0),(-1,0), NAV),
    ('TEXTCOLOR',(0,0),(-1,0), WHITE),
    ('ROWBACKGROUNDS',(0,1),(-1,-1),[LTBLUE, WHITE, LTGRN, WHITE, LTYELL]),
    ('BOX',(0,0),(-1,-1),1,BLUE),
    ('INNERGRID',(0,0),(-1,-1),0.5,colors.HexColor('#CCCCCC')),
    ('TOPPADDING',(0,0),(-1,-1),4),('BOTTOMPADDING',(0,0),(-1,-1),4),
    ('LEFTPADDING',(0,0),(-1,-1),6),
    ('VALIGN',(0,0),(-1,-1),'TOP'),
]))
story.append(st)
story.append(Spacer(1,4))

# ══ SECTION 6: IMAGING ════════════════════════════════
story.append(sub_hdr('6.  IMAGING  -  HIGH YIELD RADIOLOGY', BLUE))
story.append(Spacer(1,3))
story.append(Paragraph(b('Plain X-ray (Supine Abdominal Film) - Summary Box 78.9:'), H3))

img_data = [
    [Paragraph(b('BOWEL'), BULL), Paragraph(b('RADIOLOGICAL FEATURE'), BULL)],
    [Paragraph('Jejunum', BULL), Paragraph('Valvulae conniventes - cross ENTIRE width of bowel, regularly spaced β†’ "Concertina / Ladder pattern"', BULL)],
    [Paragraph('Ileum', BULL), Paragraph('Featureless (no markings)', BULL)],
    [Paragraph('Colon', BULL), Paragraph('Haustral folds - do NOT cross entire width, irregularly spaced', BULL)],
    [Paragraph('Caecum', BULL), Paragraph('Rounded gas shadow in RIGHT ILIAC FOSSA', BULL)],
    [Paragraph('SBO on erect film', BULL), Paragraph('"Stepladder" fluid levels with gas above', BULL)],
]
it = Table(img_data, colWidths=[W*0.2, W*0.8])
it.setStyle(TableStyle([
    ('BACKGROUND',(0,0),(-1,0), colors.HexColor('#2F528F')),
    ('TEXTCOLOR',(0,0),(-1,0), WHITE),
    ('ROWBACKGROUNDS',(0,1),(-1,-1),[LTBLUE, WHITE]),
    ('BOX',(0,0),(-1,-1),1,BLUE),
    ('INNERGRID',(0,0),(-1,-1),0.5,colors.HexColor('#CCCCCC')),
    ('TOPPADDING',(0,0),(-1,-1),3),('BOTTOMPADDING',(0,0),(-1,-1),3),
    ('LEFTPADDING',(0,0),(-1,-1),6),
    ('VALIGN',(0,0),(-1,-1),'TOP'),
]))
story.append(it)
story.append(Spacer(1,3))

story.append(box([
    Paragraph(f'πŸ”‘  {b("CT features of strangulation (Summary Box 78.10):")}', WARN),
    Paragraph('β€’ Reduced bowel wall enhancement on CT β†’ ↑ probability of strangulation', BULL),
    Paragraph('β€’ Absence of mesenteric fluid on CT β†’ ↓ probability of strangulation', BULL),
    Paragraph('β€’ CT is most accurate overall for diagnosing intestinal obstruction (gold standard)', BULL),
    Paragraph(f'β€’ {b("Barium follow-through is CONTRAINDICATED")} in acute obstruction (life-threatening)', BULL),
], LTYELL, ORANGE))
story.append(Spacer(1,4))

# ══ SECTION 7: TREATMENT ══════════════════════════════
story.append(sub_hdr('7.  TREATMENT  -  Summary Box 78.11', GREEN))
story.append(Spacer(1,3))

treat_data = [
    [Paragraph(b('STEP'), BULL), Paragraph(b('ACTION'), BULL), Paragraph(b('DETAILS'), BULL)],
    [Paragraph(c('1','#375623'), BULL),
     Paragraph('Resuscitation (GI Drainage)', BULL),
     Paragraph('NGT (nasogastric tube) - "drip and suck". Fluid replacement. Catheter for urine output monitoring', BULL)],
    [Paragraph(c('2','#375623'), BULL),
     Paragraph('Fluid & Electrolyte correction', BULL),
     Paragraph('IV fluids (Normal saline + K+ replacement). Monitor dehydration, electrolytes, urine output', BULL)],
    [Paragraph(c('3','#375623'), BULL),
     Paragraph('Relief of obstruction', BULL),
     Paragraph('Conservative first in simple SBO (adhesions may resolve). SURGERY if: complete, strangulation, closed-loop, or no improvement in 24-48h', BULL)],
]
tt = Table(treat_data, colWidths=[W*0.08, W*0.28, W*0.64])
tt.setStyle(TableStyle([
    ('BACKGROUND',(0,0),(-1,0), GREEN),
    ('TEXTCOLOR',(0,0),(-1,0), WHITE),
    ('ROWBACKGROUNDS',(0,1),(-1,-1),[LTGRN, WHITE]),
    ('BOX',(0,0),(-1,-1),1,GREEN),
    ('INNERGRID',(0,0),(-1,-1),0.5,colors.HexColor('#CCCCCC')),
    ('TOPPADDING',(0,0),(-1,-1),4),('BOTTOMPADDING',(0,0),(-1,-1),4),
    ('LEFTPADDING',(0,0),(-1,-1),6),
    ('VALIGN',(0,0),(-1,-1),'TOP'),
]))
story.append(tt)
story.append(Spacer(1,3))

story.append(box([
    Paragraph(f'⚠️  {b("ABSOLUTE indications for immediate surgery:")}', WARN),
    Paragraph('β€’ Strangulation (or suspected strangulation)', BULL),
    Paragraph('β€’ Closed-loop obstruction', BULL),
    Paragraph('β€’ Complete LBO (large bowel obstruction) - does not resolve with conservative management', BULL),
    Paragraph('β€’ Caecal diameter >9-10 cm (risk of perforation)', BULL),
], LTPINK, PINK))
story.append(Spacer(1,4))

# ══ SECTION 8: MNEMONICS ══════════════════════════════
story.append(sub_hdr('8.  MNEMONICS  🧠', PURPLE))
story.append(Spacer(1,3))

mnemonics = [
    ('Classic Quartet of Obstruction:', '"PAVD" - Pain, Absolute constipation, Vomiting, Distension'),
    ("Causes of Dynamic SBO (Intraluminal):", '"FBI Go" - Faecal impaction, Bezoars, Intussusception, Gallstones, Objects (foreign bodies)'),
    ("Rigler's Triad (Gallstone Ileus):", '"PSE" - Pneumobilia, SBO (stepladder), Ectopic gallstone'),
    ('Causes of Strangulation:', '"HBV + CI" - Hernia, Bands/adhesions, Volvulus, Intussusception, Closed-loop'),
    ('Intussusception in Children (Classic 4):', '"RSSD" - Redcurrant jelly stool, Screaming baby, Sausage lump, Sign of Dance (empty RIF)'),
    ('Sigmoid Volvulus vs Caecal Volvulus:', 'Sigmoid = anticlockwise; Caecal = clockwise; Sigmoid = more common in adults/Africa'),
]
for title, content in mnemonics:
    story.append(box([
        Paragraph(f'πŸ”‘  {b(title)}', MNEM),
        Paragraph(content, BULL),
    ], colors.HexColor('#F3E8FF'), PURPLE))
    story.append(Spacer(1,2))

story.append(Spacer(1,4))

# ══ SECTION 9: MCQ PRACTICE ═══════════════════════════
story.append(sub_hdr('9.  PRACTICE MCQs WITH EXPLANATIONS', PINK))
story.append(Spacer(1,3))

mcqs = [
    {
        'q': 'Q1. A 65-year-old man presents with colicky abdominal pain, vomiting, distension and absolute constipation. Plain X-ray shows dilated small bowel loops with a "stepladder" fluid level pattern. What is the MOST LIKELY cause?',
        'options': ['A. Paralytic ileus', 'B. Adhesions from previous appendicectomy', 'C. Carcinoma of sigmoid colon', 'D. Volvulus of sigmoid colon'],
        'answer': 'B. Adhesions',
        'explanation': 'Adhesions are the #1 cause of small bowel obstruction (40%). The stepladder pattern = SBO on erect AXR. Paralytic ileus has no mechanical cause. Carcinoma causes LBO not SBO typically. Volvulus would show a coffee-bean sign.',
        'color': LTGRN,
    },
    {
        'q': 'Q2. An 8-month-old baby presents with intermittent episodes of screaming, drawing up of legs, pallor, and passing "redcurrant jelly" stool. The most likely diagnosis is:',
        'options': ['A. Hirschsprung disease', 'B. Meckel diverticulum', 'C. Intussusception', 'D. Malrotation'],
        'answer': 'C. Intussusception',
        'explanation': 'Classic intussusception triad: screaming baby (intermittent colic), redcurrant jelly stool (blood + mucus), sausage-shaped abdominal lump. Peak age 5-10 months. 90% idiopathic. Most common type = ileocolic (77%).',
        'color': LTBLUE,
    },
    {
        'q': "Q3. Which of the following is the PATHOGNOMONIC radiological sign of gallstone ileus?",
        'options': ["A. Stepladder pattern", "B. Coffee-bean sign", "C. Rigler's triad (SBO + pneumobilia + ectopic stone)", "D. Target sign"],
        'answer': "C. Rigler's Triad",
        'explanation': "Rigler's triad = SBO + pneumobilia (gas in biliary tree) + ectopic gallstone shadow on X-ray. Found in 40-50% of gallstone ileus cases. Gallstone erodes through gallbladder β†’ duodenum β†’ impacts 60cm proximal to ileocaecal valve.",
        'color': LTYELL,
    },
    {
        'q': 'Q4. A 70-year-old African male presents with features of large bowel obstruction. X-ray shows a grossly distended loop of bowel in the left side of abdomen resembling a "coffee bean." Most likely diagnosis:',
        'options': ['A. Caecal volvulus', 'B. Sigmoid volvulus', 'C. Carcinoma colon', 'D. Pseudo-obstruction'],
        'answer': 'B. Sigmoid volvulus',
        'explanation': 'Sigmoid volvulus is the most common cause of LBO in African and Eastern European populations. Coffee-bean sign = pathognomonic on AXR. The sigmoid rotates anticlockwise. Predisposing factors: high-residue diet, chronic constipation, elderly. Treatment: rectal tube decompression / sigmoidoscopy first, then surgery.',
        'color': LTPINK,
    },
    {
        'q': 'Q5. Which finding on CT scan INCREASES the probability of strangulation in intestinal obstruction?',
        'options': ['A. Absence of mesenteric fluid', 'B. Reduced bowel wall enhancement', 'C. Free gas in abdomen', 'D. Multiple air-fluid levels'],
        'answer': 'B. Reduced bowel wall enhancement',
        'explanation': 'Reduced bowel wall enhancement on CT = compromised blood supply = ischaemia/strangulation. Absence of mesenteric fluid DECREASES probability of strangulation. Free gas = perforation (not specifically strangulation). CT is the gold standard for diagnosing obstruction and strangulation.',
        'color': LTGRN,
    },
    {
        'q': 'Q6. A patient with intestinal obstruction has a competent ileocaecal valve. Which part of the bowel is at GREATEST risk of perforation?',
        'options': ['A. Terminal ileum', 'B. Sigmoid colon', 'C. Caecum', 'D. Rectum'],
        'answer': 'C. Caecum',
        'explanation': 'In LBO with a competent ileocaecal valve β†’ closed-loop obstruction. Gas cannot decompress into small bowel. The caecum is widest and has greatest wall tension (Law of Laplace). Caecal diameter >9-10 cm = risk of perforation β†’ emergency surgery.',
        'color': LTBLUE,
    },
    {
        'q': 'Q7. Which of the following is a CONTRAINDICATION in suspected acute intestinal obstruction?',
        'options': ['A. CT scan abdomen', 'B. Erect chest X-ray', 'C. Barium follow-through', 'D. Water-soluble contrast enema'],
        'answer': 'C. Barium follow-through',
        'explanation': 'Barium is contraindicated in acute obstruction because if perforation occurs, barium leakage into peritoneal cavity is life-threatening (barium peritonitis). Water-soluble contrast (e.g., Gastrografin) is safe and can also be therapeutic in adhesional SBO. CT is the investigation of choice.',
        'color': LTYELL,
    },
    {
        'q': 'Q8. Absolute constipation is NOT a feature in which of the following?',
        'options': ["A. Complete SBO", "B. Complete LBO with incompetent ileocaecal valve", "C. Richter's hernia", "D. High SBO"],
        'answer': "C. Richter's hernia",
        'explanation': "Absolute constipation does NOT apply in: Richter's hernia (only part of bowel wall is trapped, lumen not fully blocked), gallstone ileus, mesenteric vascular occlusion, functional obstruction with pelvic abscess, and partial obstruction. In Richter's hernia, bowel lumen is not fully obstructed so flatus/stool may still pass.",
        'color': LTPINK,
    },
]

for i, mcq in enumerate(mcqs):
    q_rows = [
        [Paragraph(mcq['q'], BODY)],
    ]
    for opt in mcq['options']:
        q_rows.append([Paragraph(f'    {opt}', BULL)])
    q_rows.append([Paragraph(f'βœ…  {b("Answer:")} {mcq["answer"]}', WARN)])
    q_rows.append([Paragraph(f'πŸ’‘  {b("Explanation:")} {mcq["explanation"]}', SMALL)])

    qt = Table(q_rows, colWidths=[W])
    qt.setStyle(TableStyle([
        ('BACKGROUND',(0,0),(-1,-1), mcq['color']),
        ('BACKGROUND',(0,0),(0,0), colors.HexColor('#2F528F')),
        ('TEXTCOLOR',(0,0),(0,0), WHITE),
        ('BOX',(0,0),(-1,-1),1,BLUE),
        ('TOPPADDING',(0,0),(-1,-1),3),('BOTTOMPADDING',(0,0),(-1,-1),3),
        ('LEFTPADDING',(0,0),(-1,-1),8),('RIGHTPADDING',(0,0),(-1,-1),6),
        ('VALIGN',(0,0),(-1,-1),'TOP'),
    ]))
    story.append(KeepTogether(qt))
    story.append(Spacer(1,5))

# ══ FOOTER ════════════════════════════════════════════
story.append(HRFlowable(width=W, thickness=1, color=NAV))
story.append(Paragraph(
    'Block Exam Prep  |  Surgery: Intestinal Obstruction  |  Source: Bailey & Love Chapter 78  |  Created by Orris',
    S('footer', fontSize=7, textColor=colors.HexColor('#888888'), alignment=TA_CENTER)
))

# ── BUILD ──────────────────────────────────────────────
doc.build(story)
print(f"PDF saved: {OUTPUT}")
Running Command

cd /home/daytona/workspace/block-exam-prep && python intestinal_obstruction_pdf.…

All four things done! Here's everything:

πŸ“„ Download Your PDF

Intestinal Obstruction Cheatsheet

PDF Document Β· PDF

The PDF contains the cheat sheet, MCQ reference, mnemonics, and all 8 practice MCQs with explanations - all in one printable file.

πŸ“– Chapter Simplified - Full Summary

1. Classification

  • Dynamic = peristalsis working against a physical block (adhesions, hernia, tumour, volvulus)
  • Adynamic = no physical block but bowel not moving (paralytic ileus, pseudo-obstruction)

2. Causes (Know the pie chart %)

Cause%
Adhesions40% (most common SBO)
Inflammatory15%
Carcinoma15% (most common LBO)
Obstructed hernia12%
Faecal impaction8%

3. Pathophysiology (in simple words)

Bowel above obstruction β†’ fills with gas (Nβ‚‚ + Hβ‚‚S) + fluid (2.5 L/day from saliva, bile, pancreas, stomach) β†’ can't be absorbed β†’ dehydration + electrolytes lost β†’ bowel tries harder β†’ exhausts β†’ paralysis. If blood supply cut = strangulation β†’ ischaemia β†’ necrosis β†’ perforation β†’ death.

4. Clinical Features - The Quartet "PAVD"

Small BowelLarge Bowel
PainEarly, severe, central, colickyLate, lower abdomen, less severe
VomitingEarly, profuse β†’ faeculentLate or absent
DistensionMinimal (high) / Marked (low)Early, pronounced
Absolute ConstipationPresent (complete)Cardinal feature
Absolute constipation NOT present in: Richter's hernia, gallstone ileus, mesenteric vascular occlusion, partial obstruction.

5. Strangulation - RED FLAGS

  • Constant pain (not colicky) + peritonism + shock = strangulation
  • Causes: hernial orifices, adhesions/bands, volvulus, intussusception, closed-loop
  • Pain may disappear when bowel dies - don't be fooled!

6. Special Types

TypeKey FactMCQ Point
Closed-loopBoth ends blockedCaecum most vulnerable (Laplace's Law) β†’ ruptures first
Volvulus - SigmoidMost common adult typeAnticlockwise twist, African population, coffee-bean sign
Volvulus - CaecalClockwise, 4th-5th decadeTympanic swelling in midline/left side
IntussusceptionPeak 5-10 months, 90% idiopathicRedcurrant jelly stool, sausage lump, ileocolic = 77%
Gallstone IleusStone erodes into duodenumRigler's triad: SBO + pneumobilia + ectopic stone
Adhesions#1 SBO cause (western)Risk post-laparotomy = 4% SBO, 2% need laparotomy

7. Imaging

  • Plain X-ray: Stepladder pattern (SBO), coffee-bean sign (sigmoid volvulus)
  • Jejunum: Valvulae conniventes = "concertina/ladder" - cross full width, regularly spaced
  • Ileum: Featureless
  • Colon: Haustra - irregular, don't cross full width
  • CT scan: Gold standard - shows site, cause, strangulation
  • Barium contraindicated in acute obstruction (barium peritonitis if perforated)

8. Treatment

  1. Drip and suck - IV fluids + NGT decompression
  2. Correct electrolytes - especially K⁺
  3. Conservative vs Surgery:
    • SBO from adhesions β†’ try 24-48h conservative first
    • Immediate surgery if: strangulation, closed-loop, no improvement, caecal diameter >9-10 cm

🧠 Mnemonics

  • Quartet = PAVD (Pain, Absolute constipation, Vomiting, Distension)
  • Rigler's Triad = PSE (Pneumobilia, SBO stepladder, Ectopic stone)
  • Intussusception 4 = RSSD (Redcurrant jelly, Screaming baby, Sausage lump, Sign of Dance)
  • Strangulation causes = HBV+CI (Hernia, Bands, Volvulus, Intussusception, Closed-loop)

Upload the next 10 pages whenever ready and I'll continue! πŸ’ͺ

Um, I think you haven't explained all the things, uh, enough. Like, I have uploaded pictures for your convenience, by the way, and you skipped them altogether. You just explained the first page. Then what about the strangulation? You didn't explain this. And then special types of mechanical obstruction, like, you didn't follow the format which I shared. Please don't do it. Also, there is no stress. First explain everything, then I'll read. When I, when, uh, you explain first, only explain the thing, then you will do the other, your work on all three deliverable which I told you. First, just simply explain. In this way, your works gets easier for you, and there is no pressure on you to do four things altogether simultaneously. How about this?

You're absolutely right, and I apologize. I rushed and didn't do justice to your chapter. The pictures you uploaded are detailed and important - I should follow them properly.
New workflow going forward:
  1. You upload pictures β†’ I explain everything thoroughly first
  2. Once you've read and are happy β†’ I create the cheat sheet + PDF + MCQs
Let me now properly explain the full chapter from all 10 pages you already uploaded. I'll go section by section, following the book exactly.

CHAPTER 78 - INTESTINAL OBSTRUCTION

Complete Explanation


πŸ“Œ CLASSIFICATION

The book divides intestinal obstruction into two types:
1. Dynamic Obstruction Peristalsis is present and working normally, but it is working against a physical mechanical block. Think of it like trying to push water through a blocked pipe - the pump is working fine, but the pipe is blocked. This can be acute or chronic.
Causes are divided into three groups based on where the block is:
  • Intraluminal (block is inside the bowel lumen): Faecal impaction, foreign bodies, bezoars, gallstones
  • Intramural (block is in the wall of the bowel itself): Stricture, malignancy, intussusception, volvulus
  • Extramural (block is outside the bowel, pressing on it): Bands/adhesions, hernia
2. Adynamic Obstruction Here there is NO mechanical block at all. The problem is that peristalsis itself is absent or inadequate. Two types:
  • Paralytic ileus - bowel is completely paralysed (after surgery, peritonitis, electrolyte imbalance)
  • Pseudo-obstruction - bowel appears obstructed clinically and on X-ray but no block exists

πŸ“Œ MOST COMMON CAUSES (Pie Chart - Figure 78.1)

Your book shows a pie chart with these frequencies - memorise these numbers:
Cause%
Adhesions40% - single most common cause
Inflammatory15%
Carcinoma15%
Obstructed hernia12%
Faecal impaction8%
Pseudo-obstruction5%
Miscellaneous5%

πŸ“Œ PATHOPHYSIOLOGY

When a dynamic (mechanical) obstruction occurs, here is what happens step by step:
Above the obstruction (proximal bowel): The bowel dilates and fills with two things - gas and fluid.
Gas accumulation: There is massive overgrowth of aerobic and anaerobic bacteria. They produce enormous amounts of gas. After oxygen and carbon dioxide are reabsorbed, what remains is mostly nitrogen (90%) and hydrogen sulphide. This is why the bowel becomes so distended.
Fluid accumulation: Every day, your gut receives a huge amount of digestive secretions:
  • Saliva = 500 mL
  • Bile = 500 mL
  • Pancreatic secretions = 500 mL
  • Gastric secretions = 1 litre
Normally all this gets reabsorbed. But when obstruction occurs, the gut cannot absorb it anymore. This fluid accumulates inside the obstructed bowel. The patient loses fluid through:
  • Reduced oral intake
  • Defective intestinal absorption
  • Vomiting
  • Sequestration inside the bowel lumen
  • Transudation into the peritoneal cavity
This leads to severe dehydration and electrolyte loss - which is why these patients need aggressive IV fluid replacement.
What happens to peristalsis: Initially, the proximal bowel increases its peristaltic activity trying to overcome the obstruction. If the obstruction is not relieved, the bowel continues to dilate. Eventually it becomes exhausted - peristalsis reduces in strength, then flaccidity and paralysis set in.
Below the obstruction (distal bowel): The distal bowel continues to function normally, absorbing what is there, and eventually empties and collapses.

πŸ“Œ STRANGULATION

This is one of the most important parts of the chapter. The book says: obstruction is NOT immediately life-threatening unless strangulation is superimposed. When strangulation occurs, the blood supply to the bowel is cut off and the bowel becomes ischaemic.
How does strangulation happen? Three mechanisms:
1. Direct pressure on the bowel wall:
  • Hernial orifices - the tight ring of the hernia compresses the bowel wall
  • Adhesions/bands - a tight band compresses the bowel from outside
2. Interrupted mesenteric blood flow:
  • Volvulus - the mesentery twists, kinking the blood vessels
  • Intussusception - the invaginated bowel compresses its own mesenteric vessels
3. Increased intraluminal pressure:
  • Closed-loop obstruction - both ends blocked, pressure builds inside
What happens once blood supply is cut: The distended bowel creates high pressure within the wall. This impairs local perfusion first. Once arterial supply is compromised, haemorrhagic infarction occurs. As bowel viability is lost, bacteria and endotoxins translocate from the bowel lumen into the bloodstream - causing systemic sepsis.
The morbidity and mortality of strangulation depends on:
  • Duration of ischaemia
  • Extent of bowel involved
Even a short length of strangulated bowel can cause significant systemic effects through sepsis. Bowel distension and fluid sequestration cause dehydration. When bowel involvement is extensive, circulatory failure is common.
Clinical features of strangulation (Summary Box 78.8):
  • Constant, severe pain - not colicky anymore. This is the key red flag. Colicky pain means bowel is trying to push through. Constant pain means the bowel is dying.
  • Tenderness with rigidity and peritonism - bowel wall is dying, peritoneum is inflamed
  • Shock - systemic sepsis and dehydration
Important points the book makes:
  • Presence of shock suggests underlying ischaemia
  • In impending/established strangulation, pain may be completely absent - because the bowel is dead and no longer generating pain signals. Do not be reassured by absence of pain!
  • Any tenderness, however mild, needs frequent reassessment
  • Generalised tenderness + rigidity = need for early laparotomy
  • In an external hernia with strangulation: lump is tense, tender, irreducible, no cough impulse, skin may show erythema or discolouration

πŸ“Œ CLOSED-LOOP OBSTRUCTION

This is a specific and dangerous type of dynamic obstruction where the bowel is obstructed at both the proximal and distal points simultaneously. The gas and fluid distension is confined to just the closed loop - the proximal bowel does NOT show marked distension, which can make diagnosis tricky.
Classic example: Malignant stricture of the colon with a competent ileocaecal valve. The obstructing tumour blocks the distal end, and the competent valve blocks the proximal end. The colon between them forms a closed loop.
Why is this dangerous? The caecum receives the distension and has the greatest wall tension. It can rupture (caecal blow-out) - a surgical catastrophe.
This can also occur with lesions as far distal as the rectum. The distended colon cannot decompress into the small bowel - small bowel results in an increase in luminal pressure, greatest at the caecum.

πŸ“Œ SPECIAL TYPES - MECHANICAL OBSTRUCTION

Internal Hernia

Occurs when a portion of small intestine becomes trapped in one of the retroperitoneal fossae through a congenital mesenteric defect.
Potential sites (all rare):
  • Foramen of Winslow
  • Defect in mesentery or transverse mesocolon
  • Defects in broad ligament
  • Congenital or acquired diaphragmatic hernia
  • Duodenal, caecal/appendiceal, intersigmoid retroperitoneal fossae
Preoperative diagnosis is unusual. Treatment is to release the constricting agent - but be careful around the foramen of Winslow and paraduodenal/duodenojejunal fossae because major blood vessels run near the constriction ring. Decompress the distended loop first before reducing it.

Obstruction from Enteric Strictures

Small bowel strictures usually occur secondary to tuberculosis or Crohn's disease. Malignant strictures (carcinoma, sarcoma) are rare.
Presentation is usually subacute or chronic.
Standard surgical treatment: Resection and anastomosis. In Crohn's disease, strictureplasty may be used when there are short multiple strictures without active sepsis.

Bolus Obstruction

Obstruction inside the small bowel caused by:
  • Gallstones (gallstone ileus)
  • Trichobezoars (hair balls - from hair chewing, often psychiatric patients)
  • Phytobezoars (vegetable fibre balls - high fibre diet, inadequate chewing, previous gastric surgery)
  • Stercoliths (found with jejunal diverticulum or ileal stricture)
  • Worms (Ascaris lumbricoides - common in children in tropics)
  • Food bolus (fruit/vegetables passing after gastrectomy)
Gallstone Ileus - Important Details:
  • Large gallstone erodes through the gallbladder wall directly into the duodenum (cholecystoduodenal fistula)
  • The stone travels down the small bowel and gets stuck ~60 cm proximal to the ileocaecal valve
  • Patient may have recurrent attacks (ball-valve effect - stone partially blocks and releases)
  • Rigler's Triad on X-ray: SBO + pneumobilia (air in bile ducts) + ectopic gallstone shadow
  • Rigler's triad is found in 40-50% of cases - considered pathognomonic
  • At surgery: milk the stone proximally away from impaction site. Try to crush it in lumen first. If not possible, open bowel and remove. Check for other enteric stones.
  • Do NOT explore the gallbladder at the same operation.
Worms (Ascaris):
  • Cause low SBO particularly in children in tropics
  • May see tangled worms in gas-filled loops on plain radiograph
  • At laparotomy: knead the mass into caecum; if not possible, remove. Worms may cause perforation (especially if bowel weakened by amoebiasis).

Adhesions and Bands

In western countries, these are the most common cause of intestinal obstruction overall.
  • Lifetime risk of adhesional SBO after any abdominal surgery = 4%
  • Risk of laparotomy for adhesions = 2%
  • Adhesions form within hours of abdominal surgery
Common causes of intra-abdominal adhesions (Table 78.1):
  • Acute inflammation: sites of anastomoses, re-peritonealisation of raw areas, trauma, ischaemia
  • Foreign material: talc, starch, gauze, silk sutures
  • Infection: peritonitis, tuberculosis
  • Chronic inflammatory conditions: Crohn's disease
  • Radiation enteritis
Prevention of adhesions (Summary Box 78.3):
  • Good surgical technique
  • Washing peritoneal cavity with saline to remove clots
  • Minimising contact with gauze
  • Covering anastomoses and raw peritoneal surfaces
  • Numerous substances have been tried (hyaluronic acid, hydrocortisone, silicone, dextran) but none convincingly shown to be effective
Adhesions are either early fibrinous (may disappear) or late fibrous (become vascularised, permanent).
Bands: Usually only one band is responsible:
  • Congenital (e.g. obliterated vitellointestinal duct)
  • A string band from previous abdominal surgery or peritoneal inflammation
  • A portion of greater omentum adherent to parietes

Acute Intussusception

One portion of gut invaginates into the immediately adjacent segment - almost always the proximal part telescopes into the distal.
Epidemiology:
  • Most common in children, peak age 5-10 months
  • 90% are idiopathic in children (associated upper respiratory tract infection or gastroenteritis may precede it - thought that hyperplasia of Peyer's patches in terminal ileum initiates it)
  • After age 2 years, a pathological lead point is found in at least 1/3 of children (Meckel's diverticulum, polyp, duplication, Henoch-SchΓΆnlein purpura, appendix)
  • In adults: almost always associated with a lead point = usually a polyp (e.g. Peutz-Jeghers syndrome), submucosal lipoma, or other tumour
Types (Table 78.2 - in children, n=702):
Type%
Ileocolic77% - most common
Ileoileocolic12%
Ileoileal5%
Colocolic2%
Multiple1%
Retrograde0.2%
Others2.8%
Pathology: An intussusception has three parts:
  • Inner tube (intussusceptum)
  • Returning/middle tube
  • Outer sheath (intussuscipiens)
The apex = the advancing part. The mass = the intussusception itself. The neck = junction of entering layer with the mass.
The degree of ischaemia depends on how tight the invagination is - worst at the ileocaecal valve.
Clinical features of intussusception:
  • Screaming baby - episodic, sudden, severe colicky pain with drawing up of legs
  • Baby appears pale during attacks, listless between attacks
  • Vomiting may or may not occur initially; becomes bile-stained with time
  • Stool: initially normal, then blood + mucus = "redcurrant jelly" stool - this is the classic but appears late
  • Sausage-shaped lump felt in abdomen - in 60% of cases, hardens on palpation
  • Sign of Dance - feeling of emptiness in RIGHT ILIAC FOSSA (because terminal ileum has been pulled out of its normal position)
  • On rectal examination: blood-stained mucus on the finger
  • In extensive ileocolic or colocolic cases: apex may be palpable or even protrude from anus
Differential diagnosis of intussusception:
  • Acute gastroenteritis - diarrhoea is prominent, faecal matter in stool (not just blood/mucus)
  • Henoch-SchΓΆnlein purpura - characteristic rash + abdominal pain
Imaging:
  • Plain abdominal X-ray: evidence of SBO, absent caecal gas shadow
  • Target sign on CT - pathognomonic (bull's eye appearance of layers of bowel within bowel)
  • Ultrasound: doughnut appearance
Treatment:
  • Children: Radiological (pneumatic/hydrostatic) reduction is first-line in most paediatric cases
  • Adults: Surgery - adults presenting acutely require surgery because there is almost always a pathological lead point that must be resected

Volvulus

A volvulus is twisting or axial rotation of a segment of bowel about its mesentery.
  • 180Β° twist β†’ obstruction of lumen
  • 360Β° twist β†’ vascular occlusion (strangulation)
Bacterial fermentation adds to distension, increasing intraluminal pressure β†’ mesenteric veins become obstructed β†’ capillary perfusion impaired β†’ ischaemia.
Types:
  • Primary volvulus - congenital malrotation of the gut, abnormal mesenteric attachments or congenital bands. Examples: volvulus neonatorum, caecal volvulus, sigmoid volvulus
  • Secondary volvulus - more common, rotation of bowel around an acquired adhesion or stoma
Volvulus neonatorum: Secondary to intestinal malrotation - potentially catastrophic.
Sigmoid Volvulus:
  • Uncommon in Europe/USA but most common cause of LBO in eastern Europe and Africa (indigenous black African population)
  • Rotation is nearly always anticlockwise
  • Predisposing factors: high-residue diet, chronic constipation, elderly, psychotropic drug use
  • Can be fulminant (sudden, severe, rapid deterioration) or indolent (slow, insidious, progressive)
  • Treatment: decompression per anum (rectal tube/sigmoidoscopy) first to relieve acute episode; surgery to prevent recurrence
Caecal Volvulus:
  • Occurs as part of volvulus neonatorum or de novo
  • Usually clockwise twist
  • More common in females, 4th and 5th decades
  • Presents acutely with obstruction features; ischaemia is common
  • Palpable tympanic swelling in midline or LEFT side of abdomen (caecum lies in left upper quadrant)
  • Diagnosis usually NOT made preoperatively
Compound Volvulus (Ileosigmoid Knotting):
  • Rare condition - ileum twists around sigmoid colon
  • Patient presents with acute intestinal obstruction but distension is comparatively mild
  • Plain X-ray: distended ileal loops in a distended sigmoid colon
  • Treatment: decompression, resection, anastomosis at operation

πŸ“Œ CLINICAL FEATURES OF INTESTINAL OBSTRUCTION

Dynamic Obstruction

Based on the classic quartet - Pain, Distension, Vomiting, Absolute Constipation.
Clinical features vary according to:
  • Location of obstruction
  • Duration of obstruction
  • Underlying pathology
  • Presence or absence of ischaemia
Pain:
  • First symptom - occurs suddenly and severely
  • Colicky in nature (comes in waves)
  • Centred on umbilicus (small bowel) or lower abdomen (large bowel)
  • With increasing distension β†’ colicky pain replaced by constant diffuse pain
  • Development of severe constant pain = strangulation
  • Colicky pain does NOT occur in postoperative simple mechanical obstruction or paralytic ileus
Vomiting:
  • More distal the obstruction = longer interval before vomiting starts
  • Character changes: starts as digested food β†’ becomes faeculent (brown, faecal smell) = enteric bacterial overgrowth
Distension:
  • Small bowel: degree depends on site - minimal in high SBO, marked in low SBO
  • Large bowel: later feature, may be minimal/absent with mesenteric vascular occlusion
  • Visible peristalsis may be seen in thin patients
Constipation:
  • Absolute constipation = neither faeces NOR flatus passed = cardinal feature of complete obstruction
  • Relative constipation = only flatus passed
  • Absolute constipation does NOT apply in: Richter's hernia, gallstone ileus, mesenteric vascular occlusion, functional obstruction with pelvic abscess, partial obstruction
High SBO vs Low SBO vs LBO (Summary Box 78.6):
  • High SBO: Vomiting early, profuse, rapid dehydration. Distension minimal. Little evidence of dilated loops on X-ray
  • Low SBO: Pain predominant. Vomiting later. Multiple dilated small bowel loops on X-ray. Central distension
  • LBO: Distension early and pronounced. Pain less severe. Vomiting and dehydration later. Colon proximal to obstruction distended on X-ray. Small bowel distended if ileocaecal valve is incompetent

Other Manifestations

Dehydration: Most commonly in SBO (repeated vomiting + fluid sequestration). Signs: dry skin and tongue, poor venous filling, sunken eyes, oliguria. Blood urea and haematocrit rise (secondary polycythaemia).
Hypokalaemia: NOT common in simple mechanical obstruction. Rise in serum K⁺, amylase or lactate dehydrogenase may indicate strangulation.
Pyrexia: Indicates onset of ischaemia, intestinal perforation, or inflammation/abscess.
Hypothermia: Indicates septicaemic shock or neglected long-duration case.
Abdominal tenderness: Localised = impending/established ischaemia. Peritonism = infarction/perforation. In LBO especially: examine right iliac fossa as caecum is most vulnerable.
Bowel sounds: High-pitched (tinkling) = obstruction. Normal bowel sounds have negative predictive value. Absent sounds if longstanding or bowel is inactive.

πŸ“Œ IMAGING

Plain abdominal X-ray (supine): The radiological appearances allow small and large bowel to be distinguished:
  • Jejunum: Valvulae conniventes cross the entire width, are regularly spaced β†’ "concertina/ladder pattern"
  • Ileum: Featureless (no markings visible)
  • Caecum: Rounded gas shadow in RIGHT ILIAC FOSSA
  • Colon: Haustral folds are irregular, spaced irregularly, do NOT cross whole diameter, indentations placed opposite each other
  • SBO on erect film: "Stepladder" pattern - fluid levels with gas above
Fluid levels:
  • Appear later than gas (takes time for gas and fluid to separate)
  • Two constant fluid levels in adults are normal (duodenal cap + terminal ileum)
  • More numerous fluid levels = more advanced obstruction
  • Number of fluid levels in SBO is proportional to degree of obstruction
Water-soluble contrast (Gastrografin): If contrast reaches the colon within 4-24 hours of administration (50-100 mL given) β†’ sensitivity 96%, specificity 98% for predicting resolution of SBO. If contrast does NOT reach colon β†’ surgery required in ~90% of patients. Also reduces need for surgery and shortens hospital stay.
Barium: CONTRAINDICATED in acute obstruction (life-threatening barium peritonitis if perforation occurs).
CT scan: Now used widely for all forms of intestinal obstruction. Highly accurate. Limitations: poor at diagnosing ischaemia.
CT features suggesting strangulation (Summary Box 78.10):
  • Reduced bowel wall enhancement β†’ increases probability of strangulation
  • Absence of mesenteric fluid β†’ decreases probability of strangulation
  • Clinical reliability of other CT signs for strangulation is doubtful
Imaging in intussusception:
  • Plain X-ray: SBO + absent caecal gas shadow
  • Target sign on CT = pathognomonic
  • Barium enema: doughnut appearance
  • USS: doughnut/target appearance
  • CT currently the preferred diagnostic method
Imaging in volvulus:
  • Caecal volvulus: caecal dilatation (72-88%), small bowel dilatation, absent gas in distal colon
  • Sigmoid volvulus: coffee-bean sign - grossly distended loop of sigmoid with two fluid levels on erect film; essentially gasless distal colon

That's the complete explanation of everything from all 10 pages. Take your time to read through this. When you're done and happy, tell me and I'll then create:
  1. The cheat sheet
  2. The PDF quick reference
  3. The practice MCQs
Also, upload the next 10 pages whenever you're ready! πŸ“–
This is a shared conversation. Sign in to Orris to start your own chat.