I want to do a case writer on appendicitis. So, uh, I should include the, um, uh, history, physical examination complete, and then the investigations and the management done in the hospital. I really want, uh, a real case. Can you give me?
| Parameter | Value |
|---|---|
| Temperature | 37.9 °C (low-grade pyrexia) |
| Heart Rate | 98 bpm (regular) |
| Blood Pressure | 118/76 mmHg |
| Respiratory Rate | 18 breaths/min |
| O2 Saturation | 99% on room air |
| GCS | 15/15 |
| Feature | Score |
|---|---|
| Migration of pain to RIF | 1 |
| Anorexia | 1 |
| Nausea/vomiting | 1 |
| RIF tenderness | 2 |
| Rebound tenderness | 1 |
| Elevated temperature (>37.3°C) | 1 |
| Leukocytosis (WBC >10,000) | 2 |
| Shift of WBC to left | 1 |
| Total | 9/10 |
| Investigation | Result | Reference Range |
|---|---|---|
| WBC (White Blood Cell Count) | 14.2 × 10⁹/L | 4.0-11.0 × 10⁹/L |
| Neutrophils | 11.8 × 10⁹/L (83%) | 2.0-7.5 × 10⁹/L |
| Haemoglobin | 14.1 g/dL | 13.0-17.0 g/dL |
| Haematocrit | 42% | 40-54% |
| Platelets | 248 × 10⁹/L | 150-400 × 10⁹/L |
| CRP (C-Reactive Protein) | 38 mg/L | <5 mg/L |
| Serum Urea | 4.8 mmol/L | 2.5-6.7 mmol/L |
| Serum Creatinine | 78 µmol/L | 62-115 µmol/L |
| Serum Amylase | 52 U/L | 30-110 U/L |
| Serum Bilirubin | 11 µmol/L | <21 µmol/L |
| ALT | 22 U/L | 7-40 U/L |
| Serum Electrolytes | Na 138, K 3.9 | Within normal limits |
| Blood Glucose | 5.4 mmol/L | 3.9-5.6 mmol/L |
| Coagulation screen (PT/APTT) | Normal | - |
| Blood group & save | Group O+, antibody screen negative | - |
Note: Amylase within normal limits -- pancreatitis effectively excluded. Leucocytosis with neutrophilia is consistent with acute bacterial inflammation.

Make it as a pdf
ls /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or missing"
mkdir -p /home/daytona/workspace/appendicitis-case
~/appendicitis-case/generate_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_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import PageBreak
import urllib.request
import os
OUTPUT = "/home/daytona/workspace/appendicitis-case/Appendicitis_Case_WriteUp.pdf"
# ── Styles ──────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()
title_style = ParagraphStyle(
"CaseTitle",
parent=styles["Title"],
fontSize=20,
textColor=colors.HexColor("#1a3a5c"),
spaceAfter=4,
alignment=TA_CENTER,
fontName="Helvetica-Bold",
)
subtitle_style = ParagraphStyle(
"CaseSubtitle",
parent=styles["Normal"],
fontSize=11,
textColor=colors.HexColor("#444444"),
spaceAfter=2,
alignment=TA_CENTER,
)
section_style = ParagraphStyle(
"SectionHead",
parent=styles["Heading1"],
fontSize=13,
textColor=colors.white,
backColor=colors.HexColor("#1a3a5c"),
spaceBefore=14,
spaceAfter=6,
leftIndent=-6,
rightIndent=-6,
borderPad=5,
fontName="Helvetica-Bold",
)
sub_section_style = ParagraphStyle(
"SubSectionHead",
parent=styles["Heading2"],
fontSize=11,
textColor=colors.HexColor("#1a3a5c"),
spaceBefore=10,
spaceAfter=4,
fontName="Helvetica-Bold",
)
sub2_style = ParagraphStyle(
"Sub2Head",
parent=styles["Heading3"],
fontSize=10,
textColor=colors.HexColor("#2d6a9f"),
spaceBefore=8,
spaceAfter=3,
fontName="Helvetica-Bold",
)
body_style = ParagraphStyle(
"Body",
parent=styles["Normal"],
fontSize=9.5,
leading=14,
textColor=colors.HexColor("#222222"),
alignment=TA_JUSTIFY,
spaceAfter=4,
)
bullet_style = ParagraphStyle(
"Bullet",
parent=body_style,
leftIndent=14,
bulletIndent=4,
spaceAfter=2,
)
note_style = ParagraphStyle(
"Note",
parent=body_style,
fontSize=8.5,
textColor=colors.HexColor("#555555"),
leftIndent=12,
fontName="Helvetica-Oblique",
)
caption_style = ParagraphStyle(
"Caption",
parent=body_style,
fontSize=8,
textColor=colors.HexColor("#555555"),
alignment=TA_CENTER,
fontName="Helvetica-Oblique",
)
# ── Helper: section header ───────────────────────────────────────────────────
def section(text):
return Paragraph(f" {text}", section_style)
def sub(text):
return Paragraph(text, sub_section_style)
def sub2(text):
return Paragraph(text, sub2_style)
def body(text):
return Paragraph(text, body_style)
def note(text):
return Paragraph(f"<i>{text}</i>", note_style)
def bullet(text):
return Paragraph(f"• {text}", bullet_style)
def sp(h=4):
return Spacer(1, h)
def hr():
return HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#cccccc"), spaceAfter=4)
# ── Table helper ─────────────────────────────────────────────────────────────
HEADER_BG = colors.HexColor("#1a3a5c")
ROW_ALT = colors.HexColor("#eaf2fb")
ROW_WHITE = colors.white
def make_table(headers, rows, col_widths=None, highlight_last=False):
data = [headers] + rows
t = Table(data, colWidths=col_widths, repeatRows=1)
style = [
("BACKGROUND", (0, 0), (-1, 0), HEADER_BG),
("TEXTCOLOR", (0, 0), (-1, 0), colors.white),
("FONTNAME", (0, 0), (-1, 0), "Helvetica-Bold"),
("FONTSIZE", (0, 0), (-1, 0), 9),
("ALIGN", (0, 0), (-1, -1), "LEFT"),
("VALIGN", (0, 0), (-1, -1), "MIDDLE"),
("ROWBACKGROUNDS", (0, 1), (-1, -1), [ROW_WHITE, ROW_ALT]),
("FONTNAME", (0, 1), (-1, -1), "Helvetica"),
("FONTSIZE", (0, 1), (-1, -1), 9),
("GRID", (0, 0), (-1, -1), 0.4, colors.HexColor("#bbbbbb")),
("TOPPADDING", (0, 0), (-1, -1), 4),
("BOTTOMPADDING",(0, 0), (-1, -1), 4),
("LEFTPADDING", (0, 0), (-1, -1), 6),
]
if highlight_last:
style += [
("BACKGROUND", (0, -1), (-1, -1), colors.HexColor("#d0e8f5")),
("FONTNAME", (0, -1), (-1, -1), "Helvetica-Bold"),
]
t.setStyle(TableStyle(style))
return t
# ── Download appendix image ──────────────────────────────────────────────────
IMG_URL = "https://cdn.orris.care/cdss_images/16bcbb75ec5c1d98fe01c729cf8c147c7280c4a162c9934cc326d4e5ee2be642.png"
IMG_PATH = "/home/daytona/workspace/appendicitis-case/appendix_histo.png"
try:
urllib.request.urlretrieve(IMG_URL, IMG_PATH)
img_ok = True
except Exception as e:
print(f"Image download failed: {e}")
img_ok = False
# ── Build document ───────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
leftMargin=2.2*cm,
rightMargin=2.2*cm,
topMargin=2.2*cm,
bottomMargin=2.2*cm,
title="Appendicitis Case Write-Up",
author="Orris Medical AI",
)
story = []
# ─── Cover / Header ──────────────────────────────────────────────────────────
story.append(sp(8))
story.append(Paragraph("CASE WRITE-UP", ParagraphStyle("CW", parent=subtitle_style,
fontSize=10, textColor=colors.HexColor("#888888"), spaceAfter=2,
fontName="Helvetica", alignment=TA_CENTER)))
story.append(Paragraph("Acute Appendicitis", title_style))
story.append(Paragraph("Surgical Case Report · July 11, 2026", subtitle_style))
story.append(sp(6))
story.append(HRFlowable(width="100%", thickness=2, color=colors.HexColor("#1a3a5c"), spaceAfter=6))
# Patient banner
banner_data = [[
Paragraph("<b>Patient:</b> Mr. K.O.", body_style),
Paragraph("<b>Age:</b> 22 years", body_style),
Paragraph("<b>Sex:</b> Male", body_style),
Paragraph("<b>Admission:</b> July 11, 2026", body_style),
]]
banner = Table(banner_data, colWidths=[4.5*cm, 2.5*cm, 2.5*cm, 5*cm])
banner.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,-1), colors.HexColor("#eaf2fb")),
("GRID", (0,0),(-1,-1), 0, colors.white),
("TOPPADDING", (0,0),(-1,-1), 6),
("BOTTOMPADDING",(0,0),(-1,-1), 6),
("LEFTPADDING",(0,0),(-1,-1), 8),
("ROUNDEDCORNERS", [4]),
]))
story.append(banner)
story.append(sp(10))
# ─── 1. HISTORY ──────────────────────────────────────────────────────────────
story.append(section("1. HISTORY"))
story.append(sp(4))
story.append(sub("Presenting Complaint"))
story.append(body("Right iliac fossa (RIF) pain of 18 hours duration."))
story.append(sub("History of Presenting Illness"))
story.append(body(
"Mr. K.O. is a 22-year-old male university student who presented to the Emergency "
"Department with an 18-hour history of abdominal pain. The pain began the previous "
"afternoon as poorly localised, colicky discomfort in the <b>periumbilical region</b>, "
"initially mild-to-moderate and intermittent in character."
))
story.append(body(
"He noted <b>anorexia</b> from onset and vomited once approximately 2 hours after the "
"pain started — he correctly described the vomiting as following, not preceding, the onset "
"of pain (Murphy's sequence). Over 8–10 hours, the pain gradually shifted from the central "
"abdomen, becoming localised to the <b>right iliac fossa</b>, and changed in character from "
"colicky to <b>constant and more intense</b>. Coughing and walking exacerbated the pain; "
"he was most comfortable lying still with his right hip slightly flexed."
))
story.append(body(
"He denies change in bowel habit, diarrhoea, haematuria, urinary frequency, or dysuria. "
"No similar previous episodes. No recent foreign travel. No sick contacts."
))
story.append(sub("Systemic Review"))
syst_rows = [
["Gastrointestinal", "Anorexia since onset. One episode of vomiting. No diarrhoea, no rectal bleeding."],
["Genitourinary", "No dysuria, no haematuria, no urethral discharge."],
["Respiratory", "No cough, no shortness of breath."],
["All other systems","Unremarkable."],
]
story.append(make_table(["System", "Findings"], syst_rows, col_widths=[4*cm, 12.5*cm]))
story.append(sp(6))
story.append(sub("Past Medical / Surgical History"))
story.append(bullet("No previous abdominal surgery."))
story.append(bullet("No known medical conditions."))
story.append(bullet("No known drug allergies (NKDA)."))
story.append(sub("Drug History"))
story.append(bullet("Nil regular medications."))
story.append(bullet("Paracetamol 1 g PO taken ~6 hours before presentation — minimal relief."))
story.append(sub("Family History"))
story.append(bullet("No first-degree relatives with IBD or colorectal malignancy."))
story.append(bullet("Father had a hernia repair in his 40s."))
story.append(sub("Social History"))
story.append(bullet("Non-smoker."))
story.append(bullet("Occasional alcohol (weekends). No illicit drug use."))
story.append(bullet("Lives in university accommodation."))
# ─── 2. PHYSICAL EXAMINATION ─────────────────────────────────────────────────
story.append(section("2. PHYSICAL EXAMINATION"))
story.append(sp(4))
story.append(sub("General Inspection"))
story.append(body(
"Alert and oriented. Appears flushed and uncomfortable, lying still on the trolley "
"with right hip slightly flexed. Not jaundiced, not pale, not cyanosed. "
"No peripheral lymphadenopathy."
))
story.append(sub("Vital Signs"))
vs_rows = [
["Temperature", "37.9 °C", "Low-grade pyrexia"],
["Heart Rate", "98 bpm", "Regular"],
["Blood Pressure", "118/76 mmHg","Within normal limits"],
["Respiratory Rate", "18 br/min", "Normal"],
["O₂ Saturation", "99%", "Room air"],
["GCS", "15/15", "Fully alert"],
]
story.append(make_table(["Parameter", "Value", "Comment"], vs_rows,
col_widths=[5.5*cm, 3*cm, 8*cm]))
story.append(sp(6))
story.append(sub("Abdominal Examination"))
story.append(sub2("Inspection"))
story.append(body(
"Flat abdomen, moves with respiration. No distension. No visible peristalsis. "
"No scars or hernias. Mild guarding on deep inspiration."
))
story.append(sub2("Palpation"))
palpation_data = [
["Tenderness", "Maximum tenderness at <b>McBurney's point</b> (1/3 from ASIS to umbilicus)."],
["Pointing sign", "<b>Positive</b> — patient points directly to McBurney's point with one finger."],
["Rovsing's sign", "<b>Positive</b> — palpation of LIF produces pain in the RIF."],
["Psoas sign", "<b>Positive</b> — passive extension of right hip produces RIF pain."],
["Obturator sign", "Equivocal — internal rotation of flexed right hip causes mild RIF discomfort."],
["Rebound tenderness", "<b>Present</b> at McBurney's point — indicates parietal peritoneal irritation."],
["Mass", "No palpable mass. No organomegaly."],
]
t2 = Table([[Paragraph(r[0], ParagraphStyle("k", parent=body_style, fontName="Helvetica-Bold")),
Paragraph(r[1], body_style)] for r in palpation_data],
colWidths=[4.5*cm, 12*cm])
t2.setStyle(TableStyle([
("ROWBACKGROUNDS", (0,0),(-1,-1), [colors.white, ROW_ALT]),
("GRID", (0,0),(-1,-1), 0.4, 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), "MIDDLE"),
]))
story.append(t2)
story.append(sp(4))
story.append(sub2("Percussion"))
story.append(body("Percussion tenderness over RIF. No shifting dullness."))
story.append(sub2("Auscultation"))
story.append(body("Bowel sounds present but diminished. No bruits."))
story.append(sub2("Rectal Examination"))
story.append(body(
"Tenderness in the right side of the rectovesical pouch. No mass. Glove: no blood."
))
story.append(sub2("Genitalia"))
story.append(body(
"Both testes palpated normally in the scrotal sac — no tenderness, no swelling. "
"Testicular torsion excluded."
))
story.append(sub("Other Systems"))
story.append(bullet("<b>Cardiovascular:</b> Heart sounds I and II, no added sounds. No peripheral oedema."))
story.append(bullet("<b>Respiratory:</b> Chest clear bilaterally. No crackles or wheeze."))
story.append(bullet("<b>Neurological:</b> No focal deficit."))
# ─── 3. INVESTIGATIONS ───────────────────────────────────────────────────────
story.append(section("3. INVESTIGATIONS"))
story.append(sp(4))
story.append(sub("Alvarado Score (MANTRELS)"))
alv_rows = [
["Migration of pain to RIF", "1"],
["Anorexia", "1"],
["Nausea / Vomiting", "1"],
["RIF tenderness on palpation", "2"],
["Rebound tenderness", "1"],
["Elevated temperature (>37.3 °C)", "1"],
["Leucocytosis (WBC >10,000)", "2"],
["Shift of WBC to left (neutrophilia)","1"],
["TOTAL", "9 / 10"],
]
story.append(make_table(["Feature", "Score"], alv_rows, col_widths=[13*cm, 3.5*cm],
highlight_last=True))
story.append(note("Score 7–10 = High probability of appendicitis. Score ≥7 warrants surgical consultation."))
story.append(sp(6))
story.append(sub("Blood Tests"))
blood_rows = [
["WBC", "14.2 × 10⁹/L ▲", "4.0–11.0 × 10⁹/L"],
["Neutrophils", "11.8 × 10⁹/L (83%) ▲", "2.0–7.5 × 10⁹/L"],
["Haemoglobin", "14.1 g/dL", "13.0–17.0 g/dL"],
["Haematocrit", "42%", "40–54%"],
["Platelets", "248 × 10⁹/L", "150–400 × 10⁹/L"],
["CRP", "38 mg/L ▲", "<5 mg/L"],
["Urea", "4.8 mmol/L", "2.5–6.7 mmol/L"],
["Creatinine", "78 µmol/L", "62–115 µmol/L"],
["Amylase", "52 U/L", "30–110 U/L (pancreatitis excluded)"],
["Bilirubin", "11 µmol/L", "<21 µmol/L"],
["ALT", "22 U/L", "7–40 U/L"],
["Electrolytes", "Na 138 / K 3.9", "Within normal limits"],
["Blood Glucose","5.4 mmol/L", "3.9–5.6 mmol/L"],
["Coagulation", "Normal", "—"],
["Group & Save", "O+, antibody screen negative", "—"],
]
story.append(make_table(["Investigation", "Result", "Reference Range"], blood_rows,
col_widths=[4.5*cm, 5*cm, 7*cm]))
story.append(sp(6))
story.append(sub("Urine Analysis"))
story.append(body(
"Midstream urine (MSU) dipstick: <b>Negative</b> for nitrites, leucocytes, blood, "
"and protein. Renal/ureteric colic effectively excluded. Urine MC&S sent — pending."
))
story.append(sub("Imaging"))
story.append(sub2("Erect Chest X-Ray"))
story.append(body(
"No free gas under the diaphragm (no visceral perforation). No consolidation, no "
"pneumothorax. Normal cardiac silhouette."
))
story.append(sub2("Abdominal Ultrasound"))
story.append(body(
"Non-compressible tubular structure in the RIF measuring <b>8 mm outer diameter</b> "
"(>6 mm is abnormal). Increased echogenicity of periappendiceal fat (fat stranding). "
"No appendicolith. No free pelvic fluid. "
"<b>Conclusion: Sonographic findings consistent with acute appendicitis.</b>"
))
story.append(sub2("CT Abdomen & Pelvis (with IV contrast)"))
story.append(body(
"Dilated, thickened appendix measuring 9 mm with periappendiceal fat stranding. "
"No free gas, no abscess, no appendicolith. No other intra-abdominal pathology. "
"<b>Conclusion: Acute uncomplicated appendicitis.</b>"
))
# ─── 4. DIAGNOSIS ─────────────────────────────────────────────────────────────
story.append(section("4. DIAGNOSIS"))
story.append(sp(4))
story.append(body(
"<b>Primary Diagnosis:</b> Acute uncomplicated appendicitis (Alvarado Score 9/10)"
))
story.append(sp(4))
story.append(sub("Differential Diagnoses Considered and Excluded"))
dd_rows = [
["Mesenteric adenitis", "No recent URTI; no bilateral tenderness"],
["Renal / ureteric colic", "Clean urine dipstick; pain character not colicky-to-loin"],
["Meckel's diverticulitis","Same operative management; excluded intraoperatively"],
["Acute pancreatitis", "Serum amylase 52 U/L — normal"],
["Testicular torsion", "Both testes palpated normally; no scrotal tenderness"],
["Perforated peptic ulcer","No free air on CXR; normal amylase"],
]
story.append(make_table(["Differential Diagnosis", "Reason Excluded"], dd_rows,
col_widths=[6*cm, 10.5*cm]))
# ─── 5. MANAGEMENT ───────────────────────────────────────────────────────────
story.append(section("5. MANAGEMENT IN HOSPITAL"))
story.append(sp(4))
story.append(sub("5a. Immediate Resuscitation & Pre-operative Preparation"))
pre_op = [
["IV Access", "16G cannula, right antecubital fossa. Bloods drawn simultaneously."],
["IV Fluids", "0.9% NaCl 1000 mL over 1 hour, then 125 mL/hour maintenance."],
["NBM", "Patient made Nil By Mouth in preparation for theatre."],
["Analgesia", "IV Morphine 5 mg + IV Ondansetron 4 mg (anti-emetic). Analgesia not withheld."],
["Pre-op Antibiotics","IV Co-amoxiclav 1.2 g at induction (covers Gram-negatives + anaerobes)."],
["DVT Prophylaxis", "TED stockings + Enoxaparin 40 mg SC pre-operatively."],
["Catheter", "IDC inserted for intra-operative monitoring and bladder decompression."],
["Consent", "Full informed written consent obtained. Risks explained."],
["Anaesthetic Review","ASA Grade I. No anticipated airway difficulty."],
]
story.append(make_table(["Step", "Detail"], pre_op, col_widths=[4.5*cm, 12*cm]))
story.append(sp(6))
story.append(sub("5b. Operative Management — Laparoscopic Appendectomy"))
story.append(body(
"Taken to theatre approximately 8 hours post-diagnosis. "
"<b>Laparoscopic appendectomy</b> performed under general anaesthesia."
))
story.append(sp(4))
op_rows = [
["Ports", "3-port technique: 10 mm umbilical (camera), 5 mm LIF, 5 mm suprapubic."],
["Operative Finding","Appendix retrocaecal, hyperaemic, oedematous with fibrinous and early "
"purulent exudate on the mesoappendix. No perforation. No free pus."],
["Technique", "Mesoappendix divided and ligated. Base doubly ligated with Endo-loops "
"and divided. Appendix retrieved in Endo-bag. Cavity irrigated with warm saline."],
["Operative Time", "45 minutes."],
["Blood Loss", "Minimal (<20 mL)."],
["Specimen", "Appendix sent for histopathology."],
]
story.append(make_table(["Detail", "Description"], op_rows, col_widths=[4.5*cm, 12*cm]))
# Histology image
if img_ok:
from reportlab.platypus import Image as RLImage
story.append(sp(8))
img_elem = RLImage(IMG_PATH, width=9*cm, height=6.5*cm)
img_table = Table([[img_elem]], colWidths=[16.5*cm])
img_table.setStyle(TableStyle([("ALIGN",(0,0),(-1,-1),"CENTER")]))
story.append(img_table)
story.append(Paragraph(
"<i>Histopathology of acutely inflamed appendix: pus-filled lumen (L) with acute "
"inflammatory infiltrate extending through all layers to the inflamed serosa (S). "
"(From Bailey & Love's Short Practice of Surgery, 28th ed.)</i>",
caption_style))
story.append(sp(6))
story.append(sub("5c. Post-operative Management"))
post_op = [
["Day 0 (Surgery Day)",
"Monitored hourly (HR, BP, RR, SpO₂, urine output). IV fluids continued. "
"Regular IV Paracetamol 1 g QDS + Ibuprofen 400 mg TDS. Morphine PRN. "
"NBM until alert, then sips, then free fluids. IDC removed once ambulant."],
["Day 1 Post-op",
"Afebrile (36.8 °C). Tolerating light diet. IV fluids stopped. Mobilised with "
"physiotherapy. Wound sites clean. Post-op antibiotics NOT continued "
"(single pre-op dose sufficient for uncomplicated appendicitis)."],
["Day 2 Post-op",
"Fully ambulant. Normal diet. Bowel sounds present. No fever. Pain controlled "
"on oral analgesia. Repeat WBC 9.8 × 10⁹/L (trending down)."],
["Discharge (Day 2)",
"Discharged home in good condition."],
]
story.append(make_table(["Timepoint", "Actions"], post_op, col_widths=[3.5*cm, 13*cm]))
story.append(sp(6))
story.append(sub("Discharge Medications & Advice"))
story.append(bullet("Paracetamol 1 g PO QDS PRN × 5 days."))
story.append(bullet("Ibuprofen 400 mg PO TDS with food PRN × 5 days."))
story.append(bullet("No heavy lifting or strenuous activity for 2 weeks."))
story.append(bullet("Keep wounds dry for 48 hours."))
story.append(bullet("Return to ED if: fever >38 °C, increasing pain, wound redness/discharge, vomiting."))
story.append(bullet("Follow-up in surgical outpatient clinic at 2 weeks (wound review + histology result)."))
story.append(sp(6))
story.append(sub("Histology Result (at 2-week follow-up)"))
story.append(body(
"Confirmed <b>acute suppurative appendicitis</b> with neutrophilic transmural inflammation. "
"No evidence of malignancy. No features of Crohn's disease."
))
# ─── Summary Box ─────────────────────────────────────────────────────────────
story.append(sp(10))
story.append(HRFlowable(width="100%", thickness=1.5, color=colors.HexColor("#1a3a5c"), spaceAfter=4))
summary_head = Paragraph(
"<b>CASE SUMMARY</b>",
ParagraphStyle("SH", parent=body_style, fontSize=10, textColor=colors.HexColor("#1a3a5c"),
fontName="Helvetica-Bold", spaceAfter=4)
)
summary_body = Paragraph(
"A 22-year-old male presented with the classic triad of periumbilical pain migrating to "
"the RIF, anorexia, and a single episode of vomiting following pain onset, accompanied by "
"low-grade pyrexia, leucocytosis (WBC 14.2, neutrophilia 83%), and elevated CRP (38 mg/L). "
"Alvarado score was 9/10. USS confirmed an 8 mm non-compressible appendix with fat stranding; "
"CT confirmed uncomplicated appendicitis. He underwent uncomplicated laparoscopic appendectomy "
"and was discharged home on post-operative day 2. Histology confirmed acute suppurative appendicitis.",
body_style
)
summary_tbl = Table([[summary_head], [summary_body]], colWidths=[16.5*cm])
summary_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,-1), colors.HexColor("#eaf2fb")),
("BOX", (0,0),(-1,-1), 1, colors.HexColor("#1a3a5c")),
("TOPPADDING", (0,0),(-1,-1), 8),
("BOTTOMPADDING",(0,0),(-1,-1), 8),
("LEFTPADDING",(0,0),(-1,-1), 10),
("RIGHTPADDING",(0,0),(-1,-1), 10),
]))
story.append(summary_tbl)
story.append(sp(10))
# ─── Sources ─────────────────────────────────────────────────────────────────
story.append(HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#cccccc"), spaceAfter=4))
story.append(Paragraph("<b>References</b>", ParagraphStyle("Ref",parent=body_style,
fontSize=9, fontName="Helvetica-Bold")))
refs = [
"Bailey & Love's Short Practice of Surgery, 28th Edition — Chapter 76 (Appendicitis).",
"Sabiston Textbook of Surgery: The Biological Basis of Modern Surgical Practice — Treatment of Appendicitis.",
"Schwartz's Principles of Surgery, 11th Edition — The Appendix.",
"Tintinalli's Emergency Medicine: A Comprehensive Study — Clinical Features of Appendicitis.",
"Robbins & Kumar Basic Pathology — Acute Appendicitis (Morphology & Clinical Features).",
]
for r in refs:
story.append(Paragraph(f"• {r}", ParagraphStyle("RL", parent=body_style,
fontSize=8.5, textColor=colors.HexColor("#555555"), leftIndent=10, spaceAfter=2)))
# ── Build ────────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF written to: {OUTPUT}")
cd /home/daytona/workspace/appendicitis-case && python generate_pdf.py 2>&1
ls -lh /home/daytona/workspace/appendicitis-case/Appendicitis_Case_WriteUp.pdf
Appendicitis Case WriteUp
PDF Document · PDF