Make into flow chart
A clean medical flowchart titled "SHOCK" as the central top node. The chart branches into two main sections: LEFT BRANCH - "EFFECTS OF SHOCK" with sub-nodes for each organ system: - Heart: Low perfusion → low venous return → decreased cardiac output → hypotension → tachycardia → release of myocardial depressants → cardiac damage - Lung: Interstitial oedema → decreased gaseous exchange → pulmonary arteriovenous shunting → tachypnoea → ARDS and pulmonary oedema - Metabolic: Hypoxia → anaerobic metabolism → lactic acidosis; ADH released → water reabsorption from renal tubules - Cellular changes: Lysosomal enzymes released → altered cell membrane permeability → cell death (sick cell syndrome) - Brain: Last organ to be underperfused; decreased perfusion → drowsiness - Kidneys: GFR decreases → tubular reabsorption of salt and water; severe cases → tubular necrosis → irreversible damage - Blood: DIC → bleeding from all organs - GI Tract: Mucosal ischaemia → haematemesis, malaena; Hepatic ischaemia → increased enzyme levels RIGHT BRANCH - "TYPES OF SHOCK" with 4 type nodes: 1. Vasovagal Shock: Sudden dilatation of peripheral and splanchnic vessels → reduced cardiac output → shock → hypoxia 2. Neurogenic Shock: Spinal cord injury → dilatation of splanchnic vessels → bradycardia, hypotension, arrhythmias, decreased cardiac output; Treatment: vasoconstrictors, dopamine, phenylephrine 3. Hypovolaemic Shock (Haemorrhagic): Causes: haemorrhage (liver/spleen/bone fractures), vomiting/diarrhoea, burns; Types: (a) Covert compensated mild <15%, (b) Overt compensated moderate 15-40%, (c) Decompensated severe >40% → MODS 4. Cardiogenic Shock: Circulatory failure → diminished forward flow → tissue hypoxia; SBP <90 mmHg for 30 min; Cardiac index <2.2; Develops within 24h of MI when 50% of LV wall damaged; Diagnosis: ECG, echocardiography, ABG, cardiac enzymes, PCWP Also include STAGES OF SHOCK: - Decompensatory (Progressive): Compensatory mechanism fails → cell perfusion decreases → raised intracellular sodium, low intracellular potassium → kidney, liver, lung failure - Irreversible (Refractory): Cellular ATP metabolism lost → MODS and MOF Use a professional medical color scheme with blue header boxes, green for types, orange for effects, red for severe outcomes. Clear arrows connecting all nodes. White background.

Create a PDF reference card summarizing shock types and management
ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or not found"
mkdir -p /home/daytona/workspace/shock-reference && python3 -c "from reportlab.lib import colors; print('reportlab OK')"
~/shock-reference/build_shock_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import mm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT
from reportlab.platypus import KeepTogether
OUTPUT = "/home/daytona/workspace/shock-reference/Shock_Reference_Card.pdf"
# ── Colour palette ──────────────────────────────────────────────────────────
NAVY = colors.HexColor("#1A237E")
TEAL = colors.HexColor("#006064")
RED_DARK = colors.HexColor("#B71C1C")
AMBER = colors.HexColor("#E65100")
GREEN_DK = colors.HexColor("#1B5E20")
PURPLE = colors.HexColor("#4A148C")
BLUE_LT = colors.HexColor("#E3F2FD")
TEAL_LT = colors.HexColor("#E0F7FA")
RED_LT = colors.HexColor("#FFEBEE")
AMBER_LT = colors.HexColor("#FFF3E0")
GREEN_LT = colors.HexColor("#F1F8E9")
PURPLE_LT = colors.HexColor("#F3E5F5")
GREY_LT = colors.HexColor("#F5F5F5")
WHITE = colors.white
BLACK = colors.black
# ── Styles ───────────────────────────────────────────────────────────────────
base = getSampleStyleSheet()
def S(name, **kw):
return ParagraphStyle(name, **kw)
title_style = S("title",
fontName="Helvetica-Bold", fontSize=22,
textColor=WHITE, alignment=TA_CENTER, spaceAfter=2)
subtitle_style = S("subtitle",
fontName="Helvetica", fontSize=10,
textColor=WHITE, alignment=TA_CENTER)
sec_head = S("sechead",
fontName="Helvetica-Bold", fontSize=12,
textColor=WHITE, alignment=TA_CENTER, leading=16)
col_head = S("colhead",
fontName="Helvetica-Bold", fontSize=9,
textColor=WHITE, alignment=TA_CENTER, leading=12)
body = S("body",
fontName="Helvetica", fontSize=8,
textColor=BLACK, leading=11, spaceAfter=2)
body_b = S("bodyb",
fontName="Helvetica-Bold", fontSize=8,
textColor=BLACK, leading=11)
small = S("small",
fontName="Helvetica", fontSize=7.5,
textColor=BLACK, leading=10)
small_b = S("smallb",
fontName="Helvetica-Bold", fontSize=7.5,
textColor=BLACK, leading=10)
bullet = S("bullet",
fontName="Helvetica", fontSize=7.5,
textColor=BLACK, leading=10, leftIndent=8, bulletIndent=0)
warn = S("warn",
fontName="Helvetica-Bold", fontSize=7.5,
textColor=RED_DARK, leading=10)
# ── Helpers ──────────────────────────────────────────────────────────────────
def hdr_cell(text, style=sec_head):
return Paragraph(text, style)
def bc(text, sty=body):
return Paragraph(text, sty)
def bb(text):
return Paragraph(text, body_b)
def bl(items, color=None):
"""Bullet list as a single Paragraph string."""
lines = []
for it in items:
lines.append(f"• {it}")
return Paragraph("<br/>".join(lines), small)
def colored_table(data, col_widths, hdr_bg, alt_bg=GREY_LT):
"""Build a styled table with a coloured header row."""
ts = TableStyle([
("BACKGROUND", (0,0), (-1,0), hdr_bg),
("TEXTCOLOR", (0,0), (-1,0), WHITE),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,0), 8),
("ALIGN", (0,0), (-1,0), "CENTER"),
("VALIGN", (0,0), (-1,-1), "TOP"),
("FONTNAME", (0,1), (-1,-1), "Helvetica"),
("FONTSIZE", (0,1), (-1,-1), 7.5),
("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, alt_bg]),
("GRID", (0,0), (-1,-1), 0.4, colors.grey),
("LEFTPADDING", (0,0), (-1,-1), 4),
("RIGHTPADDING", (0,0), (-1,-1), 4),
("TOPPADDING", (0,0), (-1,-1), 3),
("BOTTOMPADDING",(0,0), (-1,-1), 3),
])
t = Table(data, colWidths=col_widths)
t.setStyle(ts)
return t
def section_banner(text, bg):
t = Table([[Paragraph(text, sec_head)]], colWidths=[178*mm])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), bg),
("LEFTPADDING", (0,0), (-1,-1), 6),
("RIGHTPADDING", (0,0), (-1,-1), 6),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING",(0,0), (-1,-1), 4),
]))
return t
# ── Document ─────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
OUTPUT, pagesize=A4,
leftMargin=16*mm, rightMargin=16*mm,
topMargin=14*mm, bottomMargin=14*mm)
story = []
W = 178*mm # usable width
# ════════════════════════════════════════════════════════════════════
# TITLE BANNER
# ════════════════════════════════════════════════════════════════════
title_tbl = Table(
[[Paragraph("SHOCK", title_style)],
[Paragraph("Types · Pathophysiology · Management | SRB's Manual of Surgery – Ch. 5", subtitle_style)]],
colWidths=[W])
title_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), NAVY),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING", (0,0), (-1,-1), 8),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING",(0,0), (-1,-1), 6),
]))
story.append(title_tbl)
story.append(Spacer(1, 4*mm))
# ════════════════════════════════════════════════════════════════════
# 1. TYPES OF SHOCK – 4-column overview table
# ════════════════════════════════════════════════════════════════════
story.append(section_banner("1. TYPES OF SHOCK", TEAL))
story.append(Spacer(1, 2*mm))
types_data = [
[Paragraph("TYPE", col_head), Paragraph("CAUSE", col_head),
Paragraph("KEY FEATURES", col_head), Paragraph("MANAGEMENT", col_head)],
[bb("Vasovagal"),
bc("Sudden dilatation of peripheral & splanchnic vessels"),
bc("Reduced cardiac output; may be life-threatening due to hypoxia"),
bc("Lay flat, O2, IV fluids; treat underlying cause")],
[bb("Neurogenic"),
bc("Spinal cord injury → splanchnic vessel dilatation"),
bl(["Bradycardia", "Hypotension", "Arrhythmias", "Decreased cardiac output"]),
bl(["BP & O2 control", "IV fluids + airway", "Vasoconstrictors (dopamine, phenylephrine – α agonist)", "Methylprednisolone"])],
[bb("Hypovolaemic\n(Haemorrhagic)"),
bl(["Haemorrhage (liver, spleen, bone fractures, vascular injury)", "Vomiting / diarrhoea (Na⁺ & water loss)", "Burns (extravascular fluid sequestration)"]),
bl(["Mild <15%: no significant change in HR/CO", "Moderate 15-40%: cold periphery, tachycardia, hypotension (postural), metabolic acidosis", "Severe >40%: hypotension, tachycardia, sweating, oliguria, drowsiness → SIRS → MODS"]),
bl(["Stop haemorrhage", "IV fluid resuscitation (crystalloids/colloids/blood)", "Treat underlying cause", "Monitor urine output"])],
[bb("Cardiogenic"),
bl(["Acute MI (≥50% LV wall damage)", "Aortic dissection", "Mitral/aortic stenosis", "Congestive cardiac failure", "Massive pulmonary embolism"]),
bl(["Circulatory failure → tissue hypoxia", "SBP <90 mmHg for ≥30 min", "Cardiac index <2.2 L/min/m²", "PCWP >15 mmHg", "Pulmonary oedema + severe hypoxia", "Mortality >50%"]),
bl(["ECG, echocardiography", "ABG, cardiac enzymes, PCWP, electrolytes", "Inotropic support", "Revascularisation (PCI/CABG)", "Correct hypokalaemia & hypomagnesaemia"])],
]
cw = [28*mm, 42*mm, 60*mm, 48*mm]
types_tbl = colored_table(types_data, cw, TEAL, TEAL_LT)
story.append(types_tbl)
story.append(Spacer(1, 4*mm))
# ════════════════════════════════════════════════════════════════════
# 2. STAGES OF SHOCK
# ════════════════════════════════════════════════════════════════════
story.append(section_banner("2. STAGES OF SHOCK", AMBER))
story.append(Spacer(1, 2*mm))
stages_data = [
[Paragraph("STAGE", col_head), Paragraph("MECHANISM", col_head), Paragraph("FEATURES", col_head)],
[bb("Compensatory\n(Early)"),
bc("Sympathetic activation; ADH, ACTH, prostaglandins, histamine released; blood flow redirected to heart, brain, lungs"),
bc("Tachycardia, vasoconstriction, oliguria; normal or slightly low BP")],
[bb("Decompensatory\n(Progressive)"),
bc("Compensatory mechanisms fail; cell perfusion decreases; raised intracellular Na⁺, low intracellular K⁺"),
bc("Kidney, liver & lung failure begin; microcirculation failure; capillary dysfunction")],
[bb("Irreversible\n(Refractory)"),
bc("Cellular ATP metabolism lost completely"),
Paragraph("MODS (Multi-Organ Dysfunction Syndrome) and MOF (Multi-Organ Failure) – death if untreated", warn)],
]
stages_tbl = colored_table(stages_data, [35*mm, 80*mm, 63*mm], AMBER, AMBER_LT)
story.append(stages_tbl)
story.append(Spacer(1, 4*mm))
# ════════════════════════════════════════════════════════════════════
# 3. EFFECTS OF SHOCK – organ by organ
# ════════════════════════════════════════════════════════════════════
story.append(section_banner("3. EFFECTS OF SHOCK – Organ Systems", RED_DARK))
story.append(Spacer(1, 2*mm))
effects_data = [
[Paragraph("ORGAN", col_head), Paragraph("PATHOPHYSIOLOGY & CONSEQUENCES", col_head)],
[bb("Heart"),
bc("Low perfusion → ↓ venous return → ↓ cardiac output → hypotension → tachycardia → myocardial depressants released → worsening cardiac damage")],
[bb("Lungs"),
bc("Interstitial oedema → ↓ gaseous exchange → pulmonary A-V shunting → tachypnoea → ARDS + pulmonary oedema")],
[bb("Metabolic"),
bc("Hypoxia → anaerobic metabolism → lactic acidosis. ADH released → ↑ water reabsorption from renal tubules. Also: ACTH, prostaglandins, histamine, bradykinin, serotonin released.")],
[bb("Cellular"),
bc("Lysosomal enzymes released in persistent shock → altered cell membrane permeability → cell death (sick cell syndrome). Sympathetic overactivity alters microcirculation → capillary dysfunction.")],
[bb("Brain"),
bc("Last organ to be underperfused. Decreased perfusion → drowsiness. Severe: loss of consciousness.")],
[bb("Kidneys"),
bc("GFR decreases + tubular reabsorption ↑ (compensatory). Severe: acute tubular necrosis → irreversible renal damage.")],
[bb("Blood"),
bc("Platelet & cellular alterations → DIC (Disseminated Intravascular Coagulation) → bleeding from all organs.")],
[bb("GI Tract"),
bc("Mucosal ischaemia → haematemesis & malaena (aggravated by DIC). Hepatic ischaemia → ↑ liver enzymes.")],
]
effects_tbl = colored_table(effects_data, [28*mm, 150*mm], RED_DARK, RED_LT)
story.append(effects_tbl)
story.append(Spacer(1, 4*mm))
# ════════════════════════════════════════════════════════════════════
# 4. HYPOVOLAEMIA SEVERITY GRADING
# ════════════════════════════════════════════════════════════════════
story.append(section_banner("4. HYPOVOLAEMIC SHOCK – Severity Grading", GREEN_DK))
story.append(Spacer(1, 2*mm))
hv_data = [
[Paragraph("GRADE", col_head), Paragraph("BLOOD LOSS", col_head),
Paragraph("HEART RATE", col_head), Paragraph("BP", col_head),
Paragraph("FEATURES", col_head)],
[bb("Mild\n(Covert Compensated)"), bc("<15%"),
bc("No significant change"), bc("Normal"), bc("Cardiac output & splanchnic blood compensate; no significant clinical change")],
[bb("Moderate\n(Overt Compensated)"),bc("15–40%"),
bc("Tachycardia"), bc("Systolic well-maintained\n(postural drop)"),
bc("Cold periphery, tachycardia, confusion, hyponatraemia, metabolic acidosis")],
[bb("Severe\n(Decompensated)"), bc(">40%"),
bc("Tachycardia"), Paragraph("Hypotension", warn),
Paragraph("Sweating, tachypnoea, oliguria, drowsiness, SIRS → MODS → Irreversible shock", warn)],
]
hv_tbl = colored_table(hv_data, [32*mm, 22*mm, 28*mm, 34*mm, 62*mm], GREEN_DK, GREEN_LT)
story.append(hv_tbl)
story.append(Spacer(1, 4*mm))
# ════════════════════════════════════════════════════════════════════
# 5. QUICK NOTES
# ════════════════════════════════════════════════════════════════════
story.append(section_banner("5. QUICK NOTES", PURPLE))
story.append(Spacer(1, 2*mm))
notes_data = [
[Paragraph("CONCEPT", col_head), Paragraph("DEFINITION / NOTES", col_head)],
[bb("Distributive Shock"),
bc("Vasodilatation + ↓ vascular resistance + altered microvascular perfusion. Seen in septic shock, spinal trauma, adrenal crisis, anaphylaxis.")],
[bb("Obstructive Shock"),
bc("Mechanical impediment to circulation: pulmonary embolism, tension pneumothorax, cardiac tamponade, aortic stenosis.")],
[bb("Cardiogenic – Diagnosis"),
bc("ECG + Echocardiography + ABG + Cardiac enzymes + PCWP + Electrolytes (hypokalaemia & hypomagnesaemia common).")],
[bb("Neurogenic – Key Drug"),
bc("Dopamine and Phenylephrine (α-agonist) – used to bring up blood pressure by vasoconstriction.")],
[bb("DIC"),
bc("Disseminated Intravascular Coagulation: complication of persistent shock. Platelets and coagulation factors consumed → bleeding from all organs.")],
[bb("Sick Cell Syndrome"),
bc("Lysosomal enzyme release in persistent shock alters cell membrane permeability → irreversible cell death.")],
]
notes_tbl = colored_table(notes_data, [40*mm, 138*mm], PURPLE, PURPLE_LT)
story.append(notes_tbl)
story.append(Spacer(1, 4*mm))
# ── Footer ────────────────────────────────────────────────────────────────────
story.append(HRFlowable(width=W, thickness=0.5, color=colors.grey))
story.append(Spacer(1, 1*mm))
footer = Paragraph(
"Reference: SRB's Manual of Surgery, Chapter 5 – Shock | For educational purposes only | Always follow current institutional protocols",
S("footer", fontName="Helvetica-Oblique", fontSize=7, textColor=colors.grey, alignment=TA_CENTER))
story.append(footer)
# ── Build ─────────────────────────────────────────────────────────────────────
doc.build(story)
print("PDF created:", OUTPUT)
python3 /home/daytona/workspace/shock-reference/build_shock_pdf.py
ls -lh /home/daytona/workspace/shock-reference/
Shock Reference Card
PDF Document · PDF
| Section | Color | Content |
|---|---|---|
| 1. Types of Shock | Teal | Vasovagal, Neurogenic, Hypovolaemic, Cardiogenic - causes, features, management |
| 2. Stages of Shock | Amber | Compensatory → Decompensatory → Irreversible with mechanisms |
| 3. Effects by Organ | Red | Heart, Lung, Metabolic, Cellular, Brain, Kidney, Blood, GI - pathophysiology cascade |
| 4. Hypovolaemia Grading | Green | Mild (<15%), Moderate (15-40%), Severe (>40%) with HR/BP/clinical features |
| 5. Quick Notes | Purple | Distributive, Obstructive, DIC, Sick Cell Syndrome, key drugs |