Steps to cpr

Reading File
Searching the Web

CPR steps 2024 AHA guidelines adult

Finding Sources
Reading Web Page

https://www.redcross.org/take-a-class/cpr/performing-cpr/cpr…

Here is a complete, step-by-step guide to performing CPR on an adult, based on current American Red Cross and AHA guidelines:

Steps to Perform CPR (Adult)

1. Check the Scene

Make sure the environment is safe for you to approach. Put on gloves or PPE if available.

2. Check for Responsiveness

Tap the person's shoulders firmly and shout "Are you okay?" twice (shout-tap-shout).

3. Call for Help

If there is no response and the person is not breathing (or only gasping):
  • Call 911 immediately, or direct someone specific to call ("You in the blue shirt - call 911!")
  • Send someone to get an AED if one is nearby

4. Position the Person

Lay the person on their back on a firm, flat surface. Kneel beside them.

5. Give 30 Chest Compressions

  • Place the heel of one hand on the center of the chest (lower half of the breastbone)
  • Place your other hand on top, interlacing your fingers
  • Keep arms straight, lean directly over your hands
  • Push hard and fast - compress at least 2 inches deep
  • Rate: 100-120 compressions per minute (roughly the beat of "Stayin' Alive")
  • Let the chest fully recoil between compressions - don't lean on the chest

6. Open the Airway

  • Tilt the head back gently by placing one hand on the forehead
  • Lift the chin with two fingers of the other hand (head-tilt/chin-lift)

7. Give 2 Rescue Breaths

  • Pinch the nose shut
  • Create a complete seal over the person's mouth
  • Give a breath lasting about 1 second - watch for the chest to rise
  • If the first breath doesn't make the chest rise, retilt the head and try again before giving the second breath

8. Continue the Cycle

  • 30 compressions : 2 breaths - repeat continuously
  • Minimize any breaks in compressions to less than 10 seconds

9. Use an AED When Available

As soon as an AED arrives, turn it on and follow the voice prompts. Do not delay defibrillation - it dramatically improves survival odds.

10. Keep Going

Continue CPR until:
  • The person shows signs of life (breathing, movement)
  • A trained medical responder takes over
  • You are physically unable to continue
  • An AED advises you to stop for a shock

Key Numbers to Remember

ParameterValue
Compression rate100-120 per minute
Compression depth (adults)At least 2 inches (5 cm)
Compression-to-breath ratio30:2
Check breathing for no more than10 seconds
Pause between compressionsLess than 10 seconds

Hands-only CPR (compressions without rescue breaths) is also acceptable and effective for adult bystander CPR if you are not comfortable giving breaths. The Red Cross CPR guidelines and AHA 2025 guidelines are the authoritative sources for current recommendations. Taking a certified CPR course is strongly recommended so you can practice these skills under guidance.

Create a CPR quick reference guide PDF I can print

Reading File
Running Command

mkdir -p /home/daytona/workspace/cpr-guide && ls /home/daytona/workspace/cpr-guide/

Writing File

~/cpr-guide/generate_cpr_pdf.py

from reportlab.lib.pagesizes import letter
from reportlab.lib import colors
from reportlab.lib.units import inch
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/cpr-guide/CPR_Quick_Reference.pdf"

# ── Colours ───────────────────────────────────────────────────────────────────
RED       = colors.HexColor("#CC1F1A")
DARK_RED  = colors.HexColor("#8B0000")
LIGHT_RED = colors.HexColor("#FDECEA")
DARK_GRAY = colors.HexColor("#2B2B2B")
MID_GRAY  = colors.HexColor("#555555")
LIGHT_GRAY= colors.HexColor("#F4F4F4")
WHITE     = colors.white
TEAL      = colors.HexColor("#0B6E7C")

# ── Document ──────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=letter,
    leftMargin=0.6*inch,
    rightMargin=0.6*inch,
    topMargin=0.5*inch,
    bottomMargin=0.5*inch,
)

styles = getSampleStyleSheet()

# Custom styles
title_style = ParagraphStyle(
    "Title", fontSize=26, fontName="Helvetica-Bold",
    textColor=WHITE, alignment=TA_CENTER, spaceAfter=2
)
subtitle_style = ParagraphStyle(
    "Subtitle", fontSize=11, fontName="Helvetica",
    textColor=WHITE, alignment=TA_CENTER, spaceAfter=0
)
section_header = ParagraphStyle(
    "SectionHeader", fontSize=12, fontName="Helvetica-Bold",
    textColor=WHITE, alignment=TA_LEFT, leftIndent=6, spaceAfter=0
)
step_num_style = ParagraphStyle(
    "StepNum", fontSize=18, fontName="Helvetica-Bold",
    textColor=WHITE, alignment=TA_CENTER
)
step_title_style = ParagraphStyle(
    "StepTitle", fontSize=12, fontName="Helvetica-Bold",
    textColor=DARK_RED, spaceAfter=2
)
step_body_style = ParagraphStyle(
    "StepBody", fontSize=9.5, fontName="Helvetica",
    textColor=DARK_GRAY, leading=14, spaceAfter=0
)
note_style = ParagraphStyle(
    "Note", fontSize=8.5, fontName="Helvetica-Oblique",
    textColor=MID_GRAY, leading=12
)
key_num_style = ParagraphStyle(
    "KeyNum", fontSize=22, fontName="Helvetica-Bold",
    textColor=RED, alignment=TA_CENTER
)
key_label_style = ParagraphStyle(
    "KeyLabel", fontSize=8, fontName="Helvetica",
    textColor=MID_GRAY, alignment=TA_CENTER
)
footer_style = ParagraphStyle(
    "Footer", fontSize=7.5, fontName="Helvetica",
    textColor=MID_GRAY, alignment=TA_CENTER
)

story = []

# ── HEADER BANNER ─────────────────────────────────────────────────────────────
header_data = [[
    Paragraph("❤  CPR QUICK REFERENCE GUIDE", title_style),
    Paragraph("Adult Cardiopulmonary Resuscitation  |  AHA / Red Cross Guidelines 2025", subtitle_style),
]]
header_table = Table(header_data, colWidths=[7.3*inch])
header_table.setStyle(TableStyle([
    ("BACKGROUND",  (0,0), (-1,-1), RED),
    ("ROUNDEDCORNERS", [8]),
    ("TOPPADDING",  (0,0), (-1,-1), 10),
    ("BOTTOMPADDING",(0,0),(-1,-1), 10),
    ("LEFTPADDING", (0,0), (-1,-1), 14),
    ("RIGHTPADDING",(0,0), (-1,-1), 14),
    ("VALIGN",      (0,0), (-1,-1), "MIDDLE"),
]))
story.append(header_table)
story.append(Spacer(1, 10))

# ── EMERGENCY CALLOUT ─────────────────────────────────────────────────────────
callout_data = [[
    Paragraph("☎  CALL 911 FIRST (or direct a bystander to call) — then begin CPR", ParagraphStyle(
        "Callout", fontSize=11, fontName="Helvetica-Bold",
        textColor=DARK_RED, alignment=TA_CENTER
    ))
]]
callout_table = Table(callout_data, colWidths=[7.3*inch])
callout_table.setStyle(TableStyle([
    ("BACKGROUND",  (0,0),(-1,-1), LIGHT_RED),
    ("BOX",         (0,0),(-1,-1), 1.5, RED),
    ("ROUNDEDCORNERS",[6]),
    ("TOPPADDING",  (0,0),(-1,-1), 8),
    ("BOTTOMPADDING",(0,0),(-1,-1), 8),
]))
story.append(callout_table)
story.append(Spacer(1, 10))

# ── STEPS ─────────────────────────────────────────────────────────────────────
steps = [
    ("1", "CHECK THE SCENE",
     "Ensure the environment is safe. Use gloves or PPE if available."),
    ("2", "CHECK FOR RESPONSIVENESS",
     "Tap shoulders firmly. Shout 'Are you okay?' twice.\nIf no response and not breathing normally → proceed."),
    ("3", "CALL 911 & GET AN AED",
     "Call 911 or send someone to call. Send a second person\nto retrieve an AED from the nearest location."),
    ("4", "POSITION THE PERSON",
     "Place them on their back on a firm, flat surface.\nKneel beside their chest."),
    ("5", "30 CHEST COMPRESSIONS",
     "• Heel of hand on center of chest (lower sternum)\n• Second hand on top, fingers interlaced\n• Arms straight, lean directly over hands\n• Compress ≥ 2 inches deep at 100–120/min\n• Allow full chest recoil between compressions"),
    ("6", "OPEN THE AIRWAY",
     "Head-tilt / chin-lift:\n• One hand on forehead, tilt back gently\n• Two fingers under chin, lift upward"),
    ("7", "2 RESCUE BREATHS",
     "• Pinch nose shut, seal mouth completely\n• Give 1 breath over 1 second — watch chest rise\n• If chest does not rise, retilt head and retry once"),
    ("8", "REPEAT 30:2 CYCLE",
     "Continue sets of 30 compressions + 2 breaths.\nMinimize any pause to < 10 seconds."),
    ("9", "USE AED WHEN AVAILABLE",
     "Power on AED → attach pads as shown → follow voice prompts.\nDeliver shock if advised, then immediately resume CPR."),
    ("10","KEEP GOING",
     "Stop only when:\n• Person shows clear signs of life\n• Trained EMS takes over\n• You are physically unable to continue"),
]

# Build steps as a 2-column grid: 5 rows × 2 cols
def make_step_cell(num, title, body):
    num_table = Table([[Paragraph(num, step_num_style)]], colWidths=[0.42*inch])
    num_table.setStyle(TableStyle([
        ("BACKGROUND",  (0,0),(-1,-1), RED),
        ("ROUNDEDCORNERS",[20]),
        ("TOPPADDING",  (0,0),(-1,-1), 5),
        ("BOTTOMPADDING",(0,0),(-1,-1), 5),
    ]))
    text_block = [
        Paragraph(title, step_title_style),
        Paragraph(body.replace("\n", "<br/>"), step_body_style),
    ]
    inner = Table(
        [[num_table, [Paragraph(title, step_title_style),
                      Paragraph(body.replace("\n","<br/>"), step_body_style)]]],
        colWidths=[0.48*inch, 3.0*inch]
    )
    inner.setStyle(TableStyle([
        ("VALIGN",      (0,0),(-1,-1), "TOP"),
        ("LEFTPADDING", (0,0),(0,-1), 0),
        ("RIGHTPADDING",(0,0),(0,-1), 6),
        ("LEFTPADDING", (1,0),(1,-1), 4),
        ("TOPPADDING",  (0,0),(-1,-1), 0),
        ("BOTTOMPADDING",(0,0),(-1,-1), 0),
    ]))
    wrapper = Table([[inner]], colWidths=[3.6*inch])
    wrapper.setStyle(TableStyle([
        ("BACKGROUND",  (0,0),(-1,-1), LIGHT_GRAY),
        ("BOX",         (0,0),(-1,-1), 0.5, colors.HexColor("#DDDDDD")),
        ("ROUNDEDCORNERS",[6]),
        ("TOPPADDING",  (0,0),(-1,-1), 8),
        ("BOTTOMPADDING",(0,0),(-1,-1), 8),
        ("LEFTPADDING", (0,0),(-1,-1), 8),
        ("RIGHTPADDING",(0,0),(-1,-1), 8),
    ]))
    return wrapper

# Pair steps into rows of 2
step_rows = []
for i in range(0, len(steps), 2):
    left  = make_step_cell(*steps[i])
    right = make_step_cell(*steps[i+1]) if i+1 < len(steps) else Spacer(1,1)
    step_rows.append([left, right])

steps_table = Table(step_rows, colWidths=[3.65*inch, 3.65*inch], hAlign="CENTER")
steps_table.setStyle(TableStyle([
    ("VALIGN",      (0,0),(-1,-1), "TOP"),
    ("LEFTPADDING", (0,0),(-1,-1), 0),
    ("RIGHTPADDING",(0,0),(-1,-1), 0),
    ("TOPPADDING",  (0,0),(-1,-1), 0),
    ("BOTTOMPADDING",(0,0),(-1,-1), 6),
    ("COLPADDING",  (0,0),(-1,-1), 6),
]))
story.append(steps_table)
story.append(Spacer(1, 10))

# ── KEY NUMBERS ───────────────────────────────────────────────────────────────
kn_header = Table(
    [[Paragraph("KEY NUMBERS TO REMEMBER", section_header)]],
    colWidths=[7.3*inch]
)
kn_header.setStyle(TableStyle([
    ("BACKGROUND",  (0,0),(-1,-1), TEAL),
    ("ROUNDEDCORNERS",[5]),
    ("TOPPADDING",  (0,0),(-1,-1), 5),
    ("BOTTOMPADDING",(0,0),(-1,-1), 5),
]))
story.append(kn_header)
story.append(Spacer(1, 6))

key_items = [
    ("100–120", "compressions\nper minute"),
    ("≥ 2\"",   "compression\ndepth"),
    ("30 : 2",  "compressions\nto breaths"),
    ("< 10 sec","max pause\nbetween compressions"),
    ("1 sec",   "per rescue\nbreath"),
]

kn_cells = []
for val, lbl in key_items:
    kn_cells.append(
        Table([
            [Paragraph(val, key_num_style)],
            [Paragraph(lbl.replace("\n","<br/>"), key_label_style)],
        ], colWidths=[1.36*inch])
    )

kn_table = Table([kn_cells], colWidths=[1.46*inch]*5)
kn_table.setStyle(TableStyle([
    ("BACKGROUND",  (0,0),(-1,-1), WHITE),
    ("BOX",         (0,0),(-1,-1), 0.5, colors.HexColor("#CCCCCC")),
    ("INNERGRID",   (0,0),(-1,-1), 0.5, colors.HexColor("#EEEEEE")),
    ("VALIGN",      (0,0),(-1,-1), "MIDDLE"),
    ("TOPPADDING",  (0,0),(-1,-1), 6),
    ("BOTTOMPADDING",(0,0),(-1,-1), 6),
]))
story.append(kn_table)
story.append(Spacer(1, 8))

# ── HANDS-ONLY NOTE ───────────────────────────────────────────────────────────
ho_data = [[
    Paragraph(
        "<b>HANDS-ONLY CPR:</b> If you are untrained or uncomfortable giving rescue breaths, "
        "continuous chest compressions alone (100–120/min) are still effective for adult bystander CPR. "
        "Any CPR is better than no CPR.",
        note_style
    )
]]
ho_table = Table(ho_data, colWidths=[7.3*inch])
ho_table.setStyle(TableStyle([
    ("BACKGROUND",  (0,0),(-1,-1), colors.HexColor("#EEF7F8")),
    ("BOX",         (0,0),(-1,-1), 1, TEAL),
    ("ROUNDEDCORNERS",[5]),
    ("TOPPADDING",  (0,0),(-1,-1), 7),
    ("BOTTOMPADDING",(0,0),(-1,-1), 7),
    ("LEFTPADDING", (0,0),(-1,-1), 10),
    ("RIGHTPADDING",(0,0),(-1,-1), 10),
]))
story.append(ho_table)
story.append(Spacer(1, 6))

# ── FOOTER ────────────────────────────────────────────────────────────────────
story.append(HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#CCCCCC")))
story.append(Spacer(1, 4))
story.append(Paragraph(
    "Based on 2025 AHA Guidelines for CPR & ECC and American Red Cross CPR Guidelines  |  "
    "This card is a quick reference only — formal CPR training is strongly recommended  |  "
    "Call 911 in all emergencies",
    footer_style
))

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

cd /home/daytona/workspace/cpr-guide && python generate_cpr_pdf.py 2>&1

Your printable CPR quick reference guide is ready!

CPR Quick Reference

PDF Document · PDF

What's included on the single-page guide:
  • Red header banner with the guide title
  • Bold "CALL 911 FIRST" callout box
  • All 10 CPR steps in a clean 2-column grid with numbered circles
  • Key numbers panel (100-120/min rate, 2" depth, 30:2 ratio, etc.)
  • Hands-only CPR note for untrained bystanders
  • Footer citing AHA 2025 / Red Cross guidelines
It's formatted for standard letter-size paper (8.5" x 11") and prints cleanly in color or black-and-white.

Shock

Reading File
Finding Sources
Searching the Web

types of shock pathophysiology classification clinical features management

Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
Reading File
Reading File
Excellent depth of content from multiple textbooks. Now I have enough to write a thorough, well-cited answer.

Shock

Shock is a state of acute circulatory failure in which tissue perfusion is inadequate to meet cellular metabolic demands, leading to cellular hypoxia and, if uncorrected, irreversible organ injury and death. As Rosen's Emergency Medicine puts it: "shock can be viewed as a transition between life and death."

Definition

"Shock is defined as a state of systemic tissue hypoperfusion resulting from reduced cardiac output and/or reduced effective circulating blood volume."
  • Robbins, Cotran & Kumar Pathologic Basis of Disease, p. 134
At the subcellular level, shock first strikes the mitochondria - the organelles that consume >95% of the body's oxygen. When oxygen delivery falls, aerobic metabolism is replaced by anaerobic glycolysis, lactic acid accumulates, and the cell eventually dies. - Rosen's Emergency Medicine

Classification (4 Major Types)

TypeCore MechanismCommon Causes
HypovolemicLow blood/fluid volumeHemorrhage, burns, vomiting, diarrhea, trauma
CardiogenicPump failureMI (>40% myocardium lost), arrhythmia, tamponade, PE
DistributiveVasodilation / maldistributionSepsis, anaphylaxis, neurogenic (spinal injury)
ObstructiveMechanical outflow blockPulmonary embolism, tension pneumothorax, cardiac tamponade
Robbins, Cotran & Kumar Pathologic Basis of Disease, p. 134; Rosen's Emergency Medicine

Three Stages of Shock

Shock progresses through three sequential stages - most clearly documented in hypovolemic shock but common to all types:

Stage 1 - Compensated (Nonprogressive)

  • Baroreceptors, catecholamines, ADH, and the renin-angiotensin-aldosterone system activate
  • Results in tachycardia, peripheral vasoconstriction, renal fluid conservation
  • Vital organ perfusion (heart, brain) is preserved by shunting blood away from skin and gut
  • Skin becomes cool, pale, and clammy (in septic shock, early skin may be warm/flushed)
  • May have no overt organ dysfunction yet, but lactate or creatinine may be mildly elevated
  • Harrison's Principles of Internal Medicine 22E, p. 2355

Stage 2 - Progressive (Decompensated)

  • Compensatory mechanisms are overwhelmed
  • Widespread tissue hypoxia triggers anaerobic glycolysis → lactic acidosis
  • Falling pH blunts vasomotor responses; arterioles dilate; blood pools in the microcirculation
  • Peripheral pooling worsens cardiac output further (vicious cycle)
  • Endothelial injury and DIC can develop
  • Vital organs (kidney, heart, bowel) begin to fail
  • Robbins, Cotran & Kumar, p. 135

Stage 3 - Irreversible

  • Lysosomal enzyme leakage amplifies cell destruction
  • Myocardial contractility falls (partly from increased nitric oxide synthesis)
  • Ischemic bowel allows gut flora into circulation → bacteremic shock superimposed
  • Renal failure ensues; multisystem organ dysfunction
  • Death occurs even if hemodynamics are corrected
  • Robbins, Cotran & Kumar, p. 135

Pathogenesis of Septic Shock (in Detail)

Septic shock deserves special attention as it involves more complex mechanisms than simply low volume or pump failure:
  1. Microbial triggers - endotoxin (LPS), staphylococcal enterotoxins, and fungal antigens activate Toll-like receptors (TLRs) on macrophages, neutrophils, and dendritic cells via PAMPs/DAMPs
  2. Cytokine storm - NF-kB activation upregulates TNF, IL-1, IL-12, IL-18, IFN-γ, HMGB1, prostaglandins, and PAF
  3. Complement activation - C3a, C5a (anaphylatoxins), and C3b (opsonin) amplify inflammation
  4. Endothelial injury - cytokines increase adhesion molecules, trigger coagulation via factor XII → widespread microvascular thrombosis and DIC
  5. Counter-regulatory immunosuppression - lymphocyte apoptosis and shift from Th1 to Th2 cytokines; patients may oscillate between hyperinflammatory and immunosuppressed states
  6. Metabolic dysregulation - insulin resistance, mitochondrial dysfunction, cellular energy failure
The mortality of septic shock remains approximately 40% despite modern care. It is most commonly triggered by gram-positive bacteria, then gram-negative bacteria, then fungi. - Robbins, Cotran & Kumar, p. 135

Diagnosis

Clinical Red Flags (Rosen's Empirical Criteria)

  • Ill appearance or altered mental status
  • Heart rate >100 beats/min
  • Respiratory rate >20 breaths/min or PaCO2 <32 mmHg
  • Arterial base deficit < -4 mEq/L or lactate >4 mmol/L
  • Urine output <0.5 mL/kg/h
  • Arterial hypotension (SBP <90 or MAP <65) sustained >30 min
Important: Shock can occur with normal blood pressure, especially early or in distributive states. The base deficit and lactate are more reliable early markers than BP alone. - Rosen's Emergency Medicine

Key Lab Markers

MarkerSignificance
Serum lactate >4 mmol/LTissue hypoperfusion; predicts organ failure
Base deficit < -4 mEq/LEquivalent to lactate; indicates ongoing acidosis
Rising lactate + worsening base deficitPersistent or worsening shock despite resuscitation
Urine output <0.5 mL/kg/hSevere renal hypoperfusion

Management Principles

General approach regardless of cause:
  1. Secure airway and breathing - supplemental O2; intubate if unable to protect airway
  2. IV access - large-bore peripheral lines (x2) or central line
  3. Volume resuscitation - isotonic crystalloids (balanced solutions preferred); blood products for hemorrhagic shock (balanced ratio of pRBC:FFP:platelets)
  4. Identify and treat the cause - source control for sepsis, revascularization for cardiogenic, decompression for obstructive, epinephrine for anaphylaxis
  5. Vasopressors - norepinephrine is first-line for septic/distributive shock; dopamine/dobutamine for cardiogenic
  6. Monitor response - serial lactate, base deficit, urine output, and hemodynamics

Specific Treatments by Type

TypePrimary Intervention
HemorrhagicBlood products (pRBC + FFP + platelets in 1:1:1), control bleeding
SepticEarly antibiotics + IV fluids + norepinephrine; target MAP ≥65 mmHg
CardiogenicInotropes, revascularization (PCI for STEMI), mechanical support if refractory
NeurogenicIV fluids, vasopressors (phenylephrine/norepinephrine), spinal stabilization
AnaphylacticEpinephrine IM (first-line), IV fluids, antihistamines, steroids
Obstructive (PE)Anticoagulation, thrombolytics, embolectomy; needle decompression for tension pneumo
  • Rosen's Emergency Medicine, p. 60; Harrison's Principles of Internal Medicine 22E

Organ Morphology in Shock (Pathology)

The cellular/tissue effects are essentially those of hypoxic injury. Most vulnerable organs:
  • Brain - ischemic encephalopathy
  • Heart - subendocardial infarction
  • Kidneys - acute tubular necrosis (most common cause of AKI in shock)
  • Adrenals - cortical lipid depletion (steroid synthesis exhaustion)
  • Lungs - "shock lung" (diffuse alveolar damage / ARDS) especially in septic/traumatic shock
  • GI tract - hemorrhagic enteropathy; ischemic bowel enables bacterial translocation
Except for neurons and cardiomyocytes, affected tissues can recover if the patient survives. - Robbins, Cotran & Kumar, p. 136

Notes with comparison chart

Asking for Preferences
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Reading File
Reading File
Writing File

~/cpr-guide/generate_shock_notes.py

from reportlab.lib.pagesizes import letter
from reportlab.lib import colors
from reportlab.lib.units import inch
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether, PageBreak
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT

OUTPUT = "/home/daytona/workspace/cpr-guide/Shock_Notes_USMLE.pdf"

# ── Colour palette ────────────────────────────────────────────────────────────
NAVY      = colors.HexColor("#0D2137")
BLUE      = colors.HexColor("#1565C0")
LIGHT_BLUE= colors.HexColor("#E3F2FD")
MED_BLUE  = colors.HexColor("#BBDEFB")
TEAL      = colors.HexColor("#00695C")
LIGHT_TEAL= colors.HexColor("#E0F2F1")
RED       = colors.HexColor("#C62828")
LIGHT_RED = colors.HexColor("#FFEBEE")
ORANGE    = colors.HexColor("#E65100")
LIGHT_ORANGE = colors.HexColor("#FFF3E0")
PURPLE    = colors.HexColor("#6A1B9A")
LIGHT_PURPLE = colors.HexColor("#F3E5F5")
DARK_GRAY = colors.HexColor("#212121")
MID_GRAY  = colors.HexColor("#616161")
LIGHT_GRAY= colors.HexColor("#F5F5F5")
BORDER    = colors.HexColor("#CFD8DC")
WHITE     = colors.white
GOLD      = colors.HexColor("#F9A825")
LIGHT_GOLD= colors.HexColor("#FFFDE7")

# ── Doc setup ─────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT, pagesize=letter,
    leftMargin=0.55*inch, rightMargin=0.55*inch,
    topMargin=0.45*inch, bottomMargin=0.45*inch,
)

# ── Styles ────────────────────────────────────────────────────────────────────
def mks(name, **kw):
    base = dict(fontName="Helvetica", fontSize=9, textColor=DARK_GRAY, leading=13, spaceAfter=0, spaceBefore=0)
    base.update(kw)
    return ParagraphStyle(name, **base)

doc_title   = mks("DocTitle",   fontSize=22, fontName="Helvetica-Bold", textColor=WHITE, alignment=TA_CENTER, leading=26)
doc_sub     = mks("DocSub",     fontSize=10, fontName="Helvetica",       textColor=WHITE, alignment=TA_CENTER)
sec_hdr     = mks("SecHdr",     fontSize=11, fontName="Helvetica-Bold",  textColor=WHITE, alignment=TA_LEFT)
sub_hdr     = mks("SubHdr",     fontSize=10, fontName="Helvetica-Bold",  textColor=NAVY,  spaceAfter=2)
body        = mks("Body",       fontSize=8.5, leading=13)
body_bold   = mks("BodyBold",   fontSize=8.5, fontName="Helvetica-Bold", leading=13)
bullet_style= mks("Bullet",     fontSize=8.5, leading=13, leftIndent=10)
small       = mks("Small",      fontSize=7.5, textColor=MID_GRAY, leading=11)
tbl_hdr     = mks("TblHdr",     fontSize=8,   fontName="Helvetica-Bold", textColor=WHITE, alignment=TA_CENTER, leading=11)
tbl_cell    = mks("TblCell",    fontSize=8,   leading=11, alignment=TA_CENTER)
tbl_cell_l  = mks("TblCellL",   fontSize=8,   leading=11, alignment=TA_LEFT)
tbl_label   = mks("TblLabel",   fontSize=8,   fontName="Helvetica-Bold", leading=11, alignment=TA_LEFT)
footer_s    = mks("Footer",     fontSize=7,   textColor=MID_GRAY, alignment=TA_CENTER)
key_box     = mks("KeyBox",     fontSize=8.5, fontName="Helvetica-Bold", textColor=RED, alignment=TA_CENTER)
note_s      = mks("Note",       fontSize=8,   fontName="Helvetica-Oblique", textColor=MID_GRAY, leading=11)

story = []

# ══════════════════════════════════════════════════════════════════════════════
# PAGE HEADER
# ══════════════════════════════════════════════════════════════════════════════
hdr = Table([[
    Paragraph("SHOCK", doc_title),
    Paragraph("Medical Student / USMLE Notes  |  Pathophysiology · Classification · Hemodynamics · Management", doc_sub),
]], colWidths=[doc.width])
hdr.setStyle(TableStyle([
    ("BACKGROUND",   (0,0),(-1,-1), NAVY),
    ("TOPPADDING",   (0,0),(-1,-1), 10),
    ("BOTTOMPADDING",(0,0),(-1,-1), 10),
    ("LEFTPADDING",  (0,0),(-1,-1), 14),
]))
story.append(hdr)
story.append(Spacer(1,8))

# helper: coloured section bar
def sec_bar(text, colour=BLUE):
    t = Table([[Paragraph(text, sec_hdr)]], colWidths=[doc.width])
    t.setStyle(TableStyle([
        ("BACKGROUND",   (0,0),(-1,-1), colour),
        ("TOPPADDING",   (0,0),(-1,-1), 4),
        ("BOTTOMPADDING",(0,0),(-1,-1), 4),
        ("LEFTPADDING",  (0,0),(-1,-1), 8),
    ]))
    return t

def colored_box(content_rows, bg=LIGHT_BLUE, border=BLUE):
    t = Table(content_rows, colWidths=[doc.width])
    t.setStyle(TableStyle([
        ("BACKGROUND",   (0,0),(-1,-1), bg),
        ("BOX",          (0,0),(-1,-1), 0.8, border),
        ("TOPPADDING",   (0,0),(-1,-1), 5),
        ("BOTTOMPADDING",(0,0),(-1,-1), 5),
        ("LEFTPADDING",  (0,0),(-1,-1), 8),
        ("RIGHTPADDING", (0,0),(-1,-1), 8),
    ]))
    return t

# ══════════════════════════════════════════════════════════════════════════════
# 1. DEFINITION
# ══════════════════════════════════════════════════════════════════════════════
story.append(sec_bar("1.  DEFINITION"))
story.append(Spacer(1,5))
def_box = colored_box([[
    Paragraph(
        "<b>Shock</b> = a state of <b>acute circulatory failure</b> causing <b>tissue hypoperfusion</b> "
        "and cellular hypoxia. Oxygen delivery to tissues is insufficient to meet metabolic demands, "
        "resulting in anaerobic metabolism, lactic acidosis, and — if uncorrected — irreversible organ failure and death.",
        body)
]], LIGHT_BLUE, BLUE)
story.append(def_box)
story.append(Spacer(1,4))

# Key formula
formula_data = [
    [Paragraph("Oxygen Delivery (DO<sub rise='2'>2</sub>)", tbl_hdr),
     Paragraph("= Cardiac Output (CO) × Arterial O<sub rise='2'>2</sub> Content (CaO<sub rise='2'>2</sub>)", tbl_cell)],
    [Paragraph("CO = HR × Stroke Volume", tbl_hdr),
     Paragraph("CaO<sub rise='2'>2</sub> = (Hb × 1.34 × SaO<sub rise='2'>2</sub>) + (0.003 × PaO<sub rise='2'>2</sub>)", tbl_cell)],
]
formula_t = Table(formula_data, colWidths=[2.5*inch, 5.0*inch])
formula_t.setStyle(TableStyle([
    ("BACKGROUND",   (0,0),(0,-1), NAVY),
    ("BACKGROUND",   (1,0),(1,-1), LIGHT_BLUE),
    ("TEXTCOLOR",    (0,0),(0,-1), WHITE),
    ("GRID",         (0,0),(-1,-1), 0.5, BORDER),
    ("TOPPADDING",   (0,0),(-1,-1), 4),
    ("BOTTOMPADDING",(0,0),(-1,-1), 4),
    ("LEFTPADDING",  (0,0),(-1,-1), 6),
]))
story.append(formula_t)
story.append(Spacer(1,8))

# ══════════════════════════════════════════════════════════════════════════════
# 2. CLASSIFICATION
# ══════════════════════════════════════════════════════════════════════════════
story.append(sec_bar("2.  CLASSIFICATION OF SHOCK"))
story.append(Spacer(1,5))

class_colours = [BLUE, RED, TEAL, PURPLE]
class_data_raw = [
    ("HYPOVOLEMIC", BLUE, LIGHT_BLUE,
     "Low intravascular volume → ↓ preload → ↓ CO",
     "Hemorrhage, severe burns, vomiting/diarrhea, third-spacing, dehydration",
     "Tachycardia, ↓BP, cool/clammy skin, flat neck veins, oliguria",
     "IV fluids; blood products (pRBC:FFP:plt 1:1:1) for hemorrhage; control bleeding"),
    ("CARDIOGENIC", RED, LIGHT_RED,
     "Pump failure → ↓ CO despite normal/high volume",
     "MI (>40% LV loss), arrhythmia, myocarditis, valvular failure, cardiac tamponade",
     "Tachycardia, ↓BP, pulmonary edema (crackles), JVD, cool/clammy skin, S3",
     "Inotropes (dobutamine), vasopressors (NE); PCI for STEMI; IABP/MCS if refractory"),
    ("DISTRIBUTIVE", TEAL, LIGHT_TEAL,
     "Pathological vasodilation → ↓ SVR → relative hypovolemia; includes septic, anaphylactic, neurogenic",
     "Sepsis/bacteremia, anaphylaxis (IgE), spinal cord injury, adrenal crisis",
     "Septic: fever, warm/flushed skin early; Anaphylactic: urticaria, bronchospasm; Neurogenic: bradycardia + hypotension",
     "Septic: NE + broad antibiotics + fluids; Anaphylactic: IM epinephrine (FIRST LINE); Neurogenic: NE/phenylephrine"),
    ("OBSTRUCTIVE", PURPLE, LIGHT_PURPLE,
     "Mechanical block of cardiac output",
     "Massive PE, tension pneumothorax, cardiac tamponade, aortic dissection",
     "Tension PTX: absent breath sounds, tracheal deviation, JVD; Tamponade: Beck's triad; PE: pleuritic chest pain, hypoxia",
     "Tension PTX: needle decompression → chest tube; Tamponade: pericardiocentesis; Massive PE: anticoag ± thrombolytics"),
]

for name, col, light, mech, causes, sx, tx in class_data_raw:
    row1 = Table([[Paragraph(name, mks("TN", fontSize=10, fontName="Helvetica-Bold", textColor=WHITE, alignment=TA_LEFT))]], colWidths=[doc.width])
    row1.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),col),("TOPPADDING",(0,0),(-1,-1),3),("BOTTOMPADDING",(0,0),(-1,-1),3),("LEFTPADDING",(0,0),(-1,-1),8)]))
    inner = [
        [Paragraph("<b>Mechanism:</b>", body_bold), Paragraph(mech, body)],
        [Paragraph("<b>Causes:</b>", body_bold),    Paragraph(causes, body)],
        [Paragraph("<b>Signs/Sx:</b>", body_bold),  Paragraph(sx, body)],
        [Paragraph("<b>Treatment:</b>", body_bold), Paragraph(tx, body)],
    ]
    inner_t = Table(inner, colWidths=[1.1*inch, doc.width-1.1*inch])
    inner_t.setStyle(TableStyle([
        ("BACKGROUND",   (0,0),(-1,-1), light),
        ("TOPPADDING",   (0,0),(-1,-1), 3),
        ("BOTTOMPADDING",(0,0),(-1,-1), 3),
        ("LEFTPADDING",  (0,0),(-0,-1), 8),
        ("LEFTPADDING",  (1,0),(1,-1), 4),
        ("VALIGN",       (0,0),(-1,-1), "TOP"),
    ]))
    story.append(KeepTogether([row1, inner_t]))
    story.append(Spacer(1, 5))

story.append(Spacer(1,4))

# ══════════════════════════════════════════════════════════════════════════════
# 3. HEMODYNAMIC COMPARISON CHART
# ══════════════════════════════════════════════════════════════════════════════
story.append(sec_bar("3.  HEMODYNAMIC COMPARISON CHART  ★ HIGH-YIELD", ORANGE))
story.append(Spacer(1,5))

hdrs = ["Parameter", "Hypovolemic", "Cardiogenic", "Distributive\n(Septic)", "Obstructive\n(Tamponade/PE)"]
hdr_cols = [NAVY, BLUE, RED, TEAL, PURPLE]

rows = [
    ["CO / CI",       "↓↓",      "↓↓↓",    "↑↑ (early)\n↓ (late)", "↓↓"],
    ["SVR",           "↑↑",      "↑↑",     "↓↓",           "↑↑"],
    ["CVP / PCWP",    "↓↓",      "↑↑",     "↓ or normal",  "↑ (PCWP)\n↑ (CVP)"],
    ["HR",            "↑",       "↑",      "↑↑",           "↑"],
    ["BP (Systolic)", "↓",       "↓",      "↓",            "↓"],
    ["Pulse pressure","Narrow",  "Narrow", "Wide (early)",  "Narrow (pulsus paradoxus)"],
    ["SvO₂",         "↓",       "↓",      "↑ (early)\n↓ (late)", "↓"],
    ["Skin",         "Cool/pale","Cool/clammy","Warm/flushed\n(early)", "Cool/pale"],
    ["JVD",          "Absent",   "Present","Absent",        "Present"],
    ["Lung sounds",  "Clear",    "Crackles","Clear",         "Clear (tamponade)\nAbsent (PTX)"],
    ["Urine output", "↓",       "↓",      "↓",             "↓"],
    ["Lactate",      "↑",       "↑",      "↑",             "↑"],
    ["1st-line Rx",  "IV fluids\n+ blood products","Dobutamine\n+ NE + PCI","NE + antibiotics\n+ fluids","Decompress /\npericardiocentesis"],
]

col_w = [1.55*inch, 1.4*inch, 1.4*inch, 1.4*inch, 1.65*inch]

# Header row
hdr_row = [Paragraph(h.replace("\n","<br/>"), tbl_hdr) for h in hdrs]
all_rows = [hdr_row]

# Alternating shading
alt = [colors.HexColor("#EEF2FF"), WHITE]
for i, r in enumerate(rows):
    bg = alt[i % 2]
    all_rows.append([
        Paragraph("<b>" + r[0] + "</b>", tbl_label),
        *[Paragraph(c.replace("\n","<br/>"), tbl_cell) for c in r[1:]]
    ])

hd_table = Table(all_rows, colWidths=col_w)

ts = TableStyle([
    ("GRID",          (0,0),(-1,-1), 0.4, BORDER),
    ("TOPPADDING",    (0,0),(-1,-1), 4),
    ("BOTTOMPADDING", (0,0),(-1,-1), 4),
    ("LEFTPADDING",   (0,0),(-1,-1), 4),
    ("RIGHTPADDING",  (0,0),(-1,-1), 4),
    ("VALIGN",        (0,0),(-1,-1), "MIDDLE"),
    # header row backgrounds by type
    ("BACKGROUND", (0,0),(0,0), NAVY),
    ("BACKGROUND", (1,0),(1,0), BLUE),
    ("BACKGROUND", (2,0),(2,0), RED),
    ("BACKGROUND", (3,0),(3,0), TEAL),
    ("BACKGROUND", (4,0),(4,0), PURPLE),
    # param col
    ("BACKGROUND", (0,1),(0,-1), colors.HexColor("#ECEFF1")),
])
# alternating row fill
for i in range(len(rows)):
    bg = colors.HexColor("#EEF2FF") if i % 2 == 0 else WHITE
    ts.add("BACKGROUND", (1, i+1), (-1, i+1), bg)

hd_table.setStyle(ts)
story.append(hd_table)
story.append(Spacer(1, 6))

# ══════════════════════════════════════════════════════════════════════════════
# 4. THREE STAGES OF SHOCK
# ══════════════════════════════════════════════════════════════════════════════
story.append(sec_bar("4.  THREE STAGES OF SHOCK", colors.HexColor("#37474F")))
story.append(Spacer(1, 5))

stage_data = [
    ["Stage 1\nCOMPENSATED\n(Nonprogressive)", colors.HexColor("#1565C0"), LIGHT_BLUE,
     "Baroreceptors activate → catecholamines, ADH, RAAS\n"
     "• Tachycardia, ↑ SVR, renal fluid conservation\n"
     "• Blood shunted from skin/gut → heart and brain\n"
     "• No overt organ dysfunction; lactate mildly ↑\n"
     "• Skin: cool and pale (warm/flushed in early sepsis)"],
    ["Stage 2\nDECOMPENSATED\n(Progressive)", colors.HexColor("#BF360C"), LIGHT_RED,
     "Compensatory mechanisms overwhelmed\n"
     "• Anaerobic glycolysis → lactic acidosis → pH ↓\n"
     "• Arterioles dilate → blood pools in microcirculation\n"
     "• DIC may develop from endothelial injury\n"
     "• Vital organs (kidney, heart, bowel) begin to fail"],
    ["Stage 3\nIRREVERSIBLE", colors.HexColor("#4A148C"), LIGHT_PURPLE,
     "Lysosomal enzyme leakage amplifies cell destruction\n"
     "• ↑ Nitric oxide → worsening myocardial contractility\n"
     "• Ischemic gut → bacterial translocation → bacteremia\n"
     "• Multisystem organ failure (MSOF)\n"
     "• Death even if hemodynamics are corrected"],
]

stage_cells = []
for label, col, light, details in stage_data:
    label_t = Table([[Paragraph(label.replace("\n","<br/>"), mks("SL", fontSize=8.5, fontName="Helvetica-Bold", textColor=WHITE, alignment=TA_CENTER))]],
                    colWidths=[1.4*inch])
    label_t.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),col),("TOPPADDING",(0,0),(-1,-1),6),("BOTTOMPADDING",(0,0),(-1,-1),6)]))
    detail_t = Table([[Paragraph(details.replace("\n","<br/>"), mks("SD", fontSize=8, leading=12))]],
                     colWidths=[doc.width/3 - 1.5*inch])
    detail_t.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),light),("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),("LEFTPADDING",(0,0),(-1,-1),6)]))
    cell = Table([[label_t],[detail_t]], colWidths=[doc.width/3])
    cell.setStyle(TableStyle([("TOPPADDING",(0,0),(-1,-1),0),("BOTTOMPADDING",(0,0),(-1,-1),0),("LEFTPADDING",(0,0),(-1,-1),0),("RIGHTPADDING",(0,0),(-1,-1),0)]))
    stage_cells.append(cell)

stage_row = Table([stage_cells], colWidths=[doc.width/3]*3)
stage_row.setStyle(TableStyle([("TOPPADDING",(0,0),(-1,-1),0),("BOTTOMPADDING",(0,0),(-1,-1),0),("LEFTPADDING",(0,0),(-1,-1),2),("RIGHTPADDING",(0,0),(-1,-1),2)]))
story.append(stage_row)
story.append(Spacer(1,8))

# ══════════════════════════════════════════════════════════════════════════════
# 5. DIAGNOSIS & LAB MARKERS
# ══════════════════════════════════════════════════════════════════════════════
story.append(sec_bar("5.  DIAGNOSIS  —  CLINICAL CRITERIA & LAB MARKERS", colors.HexColor("#37474F")))
story.append(Spacer(1,5))

diag_left = [
    [Paragraph("<b>Empirical Criteria for Shock (any majority):</b>", body_bold)],
    [Paragraph("• Ill appearance / altered mental status", bullet_style)],
    [Paragraph("• HR > 100 bpm", bullet_style)],
    [Paragraph("• RR > 20 /min  or  PaCO₂ < 32 mmHg", bullet_style)],
    [Paragraph("• Base deficit < −4 mEq/L  or  Lactate > 4 mmol/L", bullet_style)],
    [Paragraph("• Urine output < 0.5 mL/kg/h", bullet_style)],
    [Paragraph("• SBP < 90 mmHg or MAP < 65 mmHg sustained > 30 min", bullet_style)],
    [Paragraph("<i>Note: Shock can occur with NORMAL BP (especially early / distributive)</i>", note_s)],
]
diag_right = [
    [Paragraph("<b>Key Lab Markers:</b>", body_bold)],
    [Paragraph("• <b>Lactate > 4 mmol/L</b>  →  tissue hypoperfusion; predicts organ failure", bullet_style)],
    [Paragraph("• <b>Base deficit < −4 mEq/L</b>  →  equivalent to lactate elevation", bullet_style)],
    [Paragraph("• <b>Rising lactate + worsening base deficit</b>  →  refractory shock", bullet_style)],
    [Paragraph("• <b>Creatinine / BUN ↑</b>  →  acute kidney injury", bullet_style)],
    [Paragraph("• <b>Troponin ↑</b>  →  myocardial injury (cardiogenic or demand ischemia)", bullet_style)],
    [Paragraph("• <b>Procalcitonin, CRP ↑</b>  →  sepsis markers", bullet_style)],
    [Paragraph("• <b>Coags (PT/INR/fibrinogen/D-dimer)</b>  →  DIC screen", bullet_style)],
]

left_t = Table(diag_left, colWidths=[(doc.width/2)-4])
left_t.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),LIGHT_BLUE),("BOX",(0,0),(-1,-1),0.5,BLUE),("TOPPADDING",(0,0),(-1,-1),3),("BOTTOMPADDING",(0,0),(-1,-1),3),("LEFTPADDING",(0,0),(-1,-1),6)]))
right_t = Table(diag_right, colWidths=[(doc.width/2)-4])
right_t.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),LIGHT_TEAL),("BOX",(0,0),(-1,-1),0.5,TEAL),("TOPPADDING",(0,0),(-1,-1),3),("BOTTOMPADDING",(0,0),(-1,-1),3),("LEFTPADDING",(0,0),(-1,-1),6)]))

diag_row = Table([[left_t, right_t]], colWidths=[doc.width/2, doc.width/2])
diag_row.setStyle(TableStyle([("LEFTPADDING",(0,0),(-1,-1),0),("RIGHTPADDING",(0,0),(-1,-1),0),("TOPPADDING",(0,0),(-1,-1),0),("BOTTOMPADDING",(0,0),(-1,-1),0),("COLPADDING",(0,0),(-1,-1),4)]))
story.append(diag_row)
story.append(Spacer(1,8))

# ══════════════════════════════════════════════════════════════════════════════
# 6. SEPTIC SHOCK — PATHOGENESIS
# ══════════════════════════════════════════════════════════════════════════════
story.append(sec_bar("6.  SEPTIC SHOCK — PATHOGENESIS (HIGH DETAIL)", RED))
story.append(Spacer(1,5))

sepsis_steps = [
    ("Microbial Trigger", "Endotoxin (LPS), exotoxins, fungal antigens activate TLRs on macrophages/dendritic cells via PAMPs & DAMPs"),
    ("NF-κB Activation", "TLR signaling → NF-κB nuclear translocation → transcription of TNF, IL-1, IL-6, IL-12, IL-18, IFN-γ, HMGB1"),
    ("Complement Activation", "Microbial components directly activate complement → C3a/C5a (anaphylatoxins) → further inflammation, vasodilation"),
    ("Endothelial Injury", "Cytokines ↑ adhesion molecules; coagulation activated via factor XII → widespread microvascular thrombosis, DIC"),
    ("Vasodilation / ↓ SVR", "NO (nitric oxide) massively ↑ → profound vasodilation → distributive shock; relative hypovolemia"),
    ("Counter-regulation", "Counter-regulatory immunosuppression: lymphocyte apoptosis, Th1→Th2 shift, IL-10 ↑ → oscillation between hyperinflammation and immunosuppression"),
    ("Organ Failure", "ARDS (lung), AKI, hepatic dysfunction, DIC, encephalopathy — SOFA score used to quantify organ failure"),
]

sep_rows = [[Paragraph(f"<b>{a}</b>", mks("SA", fontSize=8, fontName="Helvetica-Bold", textColor=DARK_GRAY)),
             Paragraph(b, mks("SB", fontSize=8, leading=12))] for a, b in sepsis_steps]
sep_t = Table(sep_rows, colWidths=[1.6*inch, doc.width-1.6*inch])
sep_t.setStyle(TableStyle([
    ("GRID",          (0,0),(-1,-1), 0.4, BORDER),
    ("BACKGROUND",    (0,0),(0,-1), colors.HexColor("#FFCDD2")),
    ("BACKGROUND",    (1,0),(1,-1), LIGHT_RED),
    ("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(sep_t)
story.append(Spacer(1, 4))

# Sepsis definitions box
sep_def = Table([[Paragraph(
    "<b>Definitions (Sepsis-3):</b>  "
    "<b>Sepsis</b> = life-threatening organ dysfunction (SOFA score ↑≥2) from dysregulated host response to infection.  "
    "<b>Septic Shock</b> = Sepsis + vasopressor requirement to maintain MAP ≥65 + lactate >2 mmol/L despite adequate fluids.  "
    "Mortality ~40%.",
    mks("SepDef", fontSize=8.5, leading=12))
]], colWidths=[doc.width])
sep_def.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),colors.HexColor("#FFEBEE")),("BOX",(0,0),(-1,-1),1,RED),("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),("LEFTPADDING",(0,0),(-1,-1),8)]))
story.append(sep_def)
story.append(Spacer(1,8))

# ══════════════════════════════════════════════════════════════════════════════
# 7. VASOPRESSOR / VASOACTIVE DRUG TABLE
# ══════════════════════════════════════════════════════════════════════════════
story.append(sec_bar("7.  VASOACTIVE DRUGS IN SHOCK", ORANGE))
story.append(Spacer(1,5))

vaso_hdrs = ["Drug", "Dose", "Receptors", "Main Effect", "Use in Shock"]
vaso_rows = [
    ["Norepinephrine\n(1st line — septic)", "3–30 µg/min", "α1 > β1", "↑SVR + modest ↑CO", "Septic, distributive;\npreferred over dopamine"],
    ["Epinephrine", "5–20 µg/min", "α + β1 + β2", "↑CO + ↑SVR\n(also bronchodilation)", "Anaphylaxis (IM first!\nthen IV infusion); refractory septic"],
    ["Vasopressin", "0.01–0.04 U/min", "V1 receptors", "↑SVR; no ↑HR;\nno ↑pulm. vasc. resistance", "Adjunct to NE in septic;\nuseful with pulm. HTN or RV failure"],
    ["Dobutamine", "2–15 µg/kg/min", "β1 > β2", "↑CO (inotrope);\n↓SVR slightly", "Cardiogenic shock;\nlow CO states"],
    ["Dopamine\n(not preferred)", "varies", "DA > β > α\n(dose-dependent)", "Low: renal vasodilation\nHigh: ↑SVR", "No longer recommended;\n↑arrhythmias vs NE"],
    ["Phenylephrine", "2–300 µg/min", "Pure α1", "↑SVR; reflex ↓HR", "Neurogenic shock;\ncontraindicated if low CO"],
]

vaso_cols = [1.5*inch, 1.05*inch, 1.1*inch, 1.6*inch, 2.15*inch]
v_hdr_row = [Paragraph(h, tbl_hdr) for h in vaso_hdrs]
v_all = [v_hdr_row]
for i, r in enumerate(vaso_rows):
    bg = colors.HexColor("#FFF8E1") if i % 2 == 0 else WHITE
    v_all.append([Paragraph(c.replace("\n","<br/>"), tbl_cell_l if j==0 else tbl_cell) for j,c in enumerate(r)])

v_table = Table(v_all, colWidths=vaso_cols)
v_ts = TableStyle([
    ("GRID",          (0,0),(-1,-1), 0.4, BORDER),
    ("BACKGROUND",    (0,0),(-1,0), ORANGE),
    ("TOPPADDING",    (0,0),(-1,-1), 4),
    ("BOTTOMPADDING", (0,0),(-1,-1), 4),
    ("LEFTPADDING",   (0,0),(-1,-1), 4),
    ("RIGHTPADDING",  (0,0),(-1,-1), 4),
    ("VALIGN",        (0,0),(-1,-1), "TOP"),
])
for i in range(len(vaso_rows)):
    bg = colors.HexColor("#FFF8E1") if i % 2 == 0 else WHITE
    v_ts.add("BACKGROUND", (0,i+1),(-1,i+1), bg)
v_table.setStyle(v_ts)
story.append(v_table)
story.append(Spacer(1,8))

# ══════════════════════════════════════════════════════════════════════════════
# 8. ORGAN PATHOLOGY IN SHOCK
# ══════════════════════════════════════════════════════════════════════════════
story.append(sec_bar("8.  ORGAN PATHOLOGY IN SHOCK", colors.HexColor("#37474F")))
story.append(Spacer(1,5))

organs = [
    ("Kidney",    "Acute Tubular Necrosis (ATN)",         "Most common cause of AKI; ischemic injury to proximal tubule and loop of Henle; granular 'muddy brown' casts on UA"),
    ("Lung",      "ARDS / 'Shock Lung'",                  "Diffuse alveolar damage; especially in septic and traumatic shock; protein-rich edema, hyaline membranes"),
    ("Heart",     "Subendocardial infarction",             "Ischemia of inner 1/3 of myocardium; diffuse non-territorial; ST depression on ECG; supply-demand mismatch"),
    ("Brain",     "Ischemic encephalopathy",               "Watershed zone infarcts; altered mental status; neurons and cardiomyocytes cannot regenerate"),
    ("GI Tract",  "Hemorrhagic enteropathy / Ischemic bowel", "Mucosal ulceration; bacterial translocation into bloodstream → superimposed bacteremia"),
    ("Adrenals",  "Cortical lipid depletion",              "Reflects maximal steroid synthesis; in overwhelming sepsis → Waterhouse-Friderichsen syndrome (adrenal hemorrhage)"),
    ("Liver",     "Centrilobular necrosis / 'Shock liver'","Zone 3 (centrilobular) most susceptible; ↑ transaminases; may resolve with resuscitation"),
]

org_hdr = [Paragraph(h, tbl_hdr) for h in ["Organ", "Lesion", "Notes"]]
org_rows = [org_hdr]
for i, (org, les, notes) in enumerate(organs):
    bg = colors.HexColor("#ECEFF1") if i % 2 == 0 else WHITE
    org_rows.append([
        Paragraph(f"<b>{org}</b>", tbl_label),
        Paragraph(les, tbl_cell_l),
        Paragraph(notes, mks("ON", fontSize=7.8, leading=11)),
    ])
org_t = Table(org_rows, colWidths=[1.0*inch, 1.8*inch, 4.6*inch])
org_ts = TableStyle([
    ("GRID",          (0,0),(-1,-1), 0.4, BORDER),
    ("BACKGROUND",    (0,0),(-1,0), colors.HexColor("#37474F")),
    ("TOPPADDING",    (0,0),(-1,-1), 4),
    ("BOTTOMPADDING", (0,0),(-1,-1), 4),
    ("LEFTPADDING",   (0,0),(-1,-1), 4),
    ("VALIGN",        (0,0),(-1,-1), "TOP"),
])
for i in range(len(organs)):
    bg = colors.HexColor("#ECEFF1") if i % 2 == 0 else WHITE
    org_ts.add("BACKGROUND", (0,i+1),(-1,i+1), bg)
org_t.setStyle(org_ts)
story.append(org_t)
story.append(Spacer(1,8))

# ══════════════════════════════════════════════════════════════════════════════
# 9. USMLE HIGH-YIELD PEARLS
# ══════════════════════════════════════════════════════════════════════════════
story.append(sec_bar("9.  USMLE HIGH-YIELD PEARLS  ⭐", GOLD))
story.append(Spacer(1,5))

pearls = [
    "Only type of shock with HIGH PCWP + LOW CO + HIGH SVR = CARDIOGENIC",
    "Only type of shock with LOW SVR + HIGH CO (early) = DISTRIBUTIVE (septic)",
    "Hypovolemic + Cardiogenic both show: ↓CO, ↑SVR, ↓CVP/PCWP (except cardiogenic has ↑PCWP)",
    "Beck's Triad (tamponade) = Hypotension + JVD + Muffled heart sounds → pericardiocentesis",
    "Tension PTX = Absent breath sounds + tracheal deviation away + JVD → NEEDLE decompression 2nd ICS MCL",
    "1st-line vasopressor for septic shock = NOREPINEPHRINE (not dopamine — ↑ arrhythmias with dopamine)",
    "1st-line treatment for anaphylactic shock = IM EPINEPHRINE (thigh) — do NOT give antihistamines first",
    "Lactate > 4 mmol/L OR base deficit < -4 mEq/L = presumptive shock regardless of BP",
    "Neurogenic shock = hypotension + BRADYCARDIA (not tachycardia) — from loss of sympathetic tone",
    "Cardiogenic shock post-MI defined as: SBP <90 + CI <2.2 L/min/m² + PCWP >18 mmHg",
    "Urine output < 0.5 mL/kg/h = severe renal hypoperfusion marker in shock",
    "SOFA score used to define/track organ dysfunction in sepsis; ↑≥2 from baseline = sepsis",
]

pearl_rows = []
for i, p in enumerate(pearls):
    bg = LIGHT_GOLD if i % 2 == 0 else WHITE
    pearl_rows.append([
        Paragraph(f"★", mks("Star", fontSize=9, fontName="Helvetica-Bold", textColor=GOLD, alignment=TA_CENTER)),
        Paragraph(p, mks("Pearl", fontSize=8.5, leading=12))
    ])

pearl_t = Table(pearl_rows, colWidths=[0.25*inch, doc.width-0.25*inch])
p_ts = TableStyle([
    ("GRID",          (0,0),(-1,-1), 0.3, BORDER),
    ("TOPPADDING",    (0,0),(-1,-1), 4),
    ("BOTTOMPADDING", (0,0),(-1,-1), 4),
    ("LEFTPADDING",   (0,0),(-1,-1), 5),
    ("VALIGN",        (0,0),(-1,-1), "MIDDLE"),
])
for i in range(len(pearls)):
    bg = LIGHT_GOLD if i % 2 == 0 else WHITE
    p_ts.add("BACKGROUND", (0,i),(-1,i), bg)
pearl_t.setStyle(p_ts)
story.append(pearl_t)
story.append(Spacer(1,8))

# ══════════════════════════════════════════════════════════════════════════════
# FOOTER
# ══════════════════════════════════════════════════════════════════════════════
story.append(HRFlowable(width="100%", thickness=0.5, color=BORDER))
story.append(Spacer(1,3))
story.append(Paragraph(
    "Sources: Robbins, Cotran & Kumar — Pathologic Basis of Disease (10e) | Harrison's Principles of Internal Medicine (22e) | "
    "Rosen's Emergency Medicine | Goldman-Cecil Medicine | Sabiston Textbook of Surgery | Schwartz's Principles of Surgery  "
    "| For educational use only — verify with current clinical guidelines",
    footer_s
))

doc.build(story)
print(f"PDF created: {OUTPUT}")
Running Command

cd /home/daytona/workspace/cpr-guide && python generate_shock_notes.py 2>&1

Your printable shock notes PDF is ready:

Shock Notes USMLE

PDF Document · PDF


Here's what's packed into the PDF (letter-size, print-ready):
9 Sections:
  1. Definition - with the DO2 = CO × CaO2 formula box
  2. Classification - all 4 types (Hypovolemic, Cardiogenic, Distributive, Obstructive) each with mechanism, causes, signs, and treatment
  3. Hemodynamic Comparison Chart ★ - the high-yield table comparing CO, SVR, CVP/PCWP, HR, BP, pulse pressure, SvO2, skin, JVD, lung sounds, urine output, lactate, and 1st-line Rx across all 4 types
  4. Three Stages of Shock - Compensated → Decompensated → Irreversible, color-coded
  5. Diagnosis - Rosen's empirical criteria + key lab markers side by side
  6. Septic Shock Pathogenesis - step-by-step from TLR activation → NF-κB → cytokine storm → endothelial injury → organ failure; Sepsis-3 definitions
  7. Vasoactive Drugs - norepinephrine, epinephrine, vasopressin, dobutamine, dopamine, phenylephrine with doses, receptors, and indication
  8. Organ Pathology - ATN, ARDS, subendocardial infarction, ischemic encephalopathy, shock liver, adrenal depletion
  9. 12 USMLE High-Yield Pearls ⭐ - the distinguishing facts that show up on exams

Im not able to download pdf

Running Command

ls -lh /home/daytona/workspace/cpr-guide/

The files exist and are valid (17KB for the shock notes, 6KB for CPR). The issue is likely on the interface side rather than the file itself. Here are a few things to try:
Option 1 - Click the link directly Try clicking this link:

Shock Notes USMLE

PDF Document · PDF

Option 2 - Try the CPR guide too

CPR Quick Reference

PDF Document · PDF

Option 3 - If links still don't work, I can:
  • Convert the content to an HTML page you can open in a browser and print (Ctrl+P → Save as PDF)
  • Display the full notes as formatted text right here in chat
  • Create a base64-encoded version you can decode locally
Which would you prefer? The HTML/print approach usually works as a reliable fallback on any device.

Create HTML version of shock notes I can print

Writing File

~/cpr-guide/shock_notes.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shock Notes — USMLE / Medical Student</title>
<style>
  /* ── Reset & Base ── */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 13px;
    color: #212121;
    background: #f0f2f5;
    padding: 20px;
  }

  /* ── Print styles ── */
  @media print {
    body { background: white; padding: 0; font-size: 11px; }
    .page { box-shadow: none; margin: 0; padding: 12mm; max-width: 100%; }
    .no-print { display: none; }
    section { page-break-inside: avoid; }
    h2.sec-bar { page-break-after: avoid; }
    @page { margin: 10mm; size: A4; }
  }

  /* ── Page wrapper ── */
  .page {
    max-width: 1000px;
    margin: 0 auto 30px;
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    border-radius: 6px;
    overflow: hidden;
    padding-bottom: 16px;
  }

  /* ── Print button ── */
  .print-btn {
    display: block;
    width: 200px;
    margin: 0 auto 18px;
    padding: 12px 0;
    background: #1565C0;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    letter-spacing: 0.5px;
  }
  .print-btn:hover { background: #0D47A1; }

  /* ── Header banner ── */
  .header {
    background: linear-gradient(135deg, #0D2137 0%, #1565C0 100%);
    color: white;
    padding: 18px 24px 14px;
  }
  .header h1 { font-size: 28px; letter-spacing: 2px; margin-bottom: 4px; }
  .header p  { font-size: 11px; opacity: 0.85; letter-spacing: 0.5px; }

  /* ── Section bars ── */
  h2.sec-bar {
    color: white;
    padding: 6px 14px;
    font-size: 12px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin: 14px 12px 8px;
    border-radius: 4px;
  }
  .bar-blue   { background: #1565C0; }
  .bar-red    { background: #C62828; }
  .bar-teal   { background: #00695C; }
  .bar-orange { background: #E65100; }
  .bar-gray   { background: #37474F; }
  .bar-gold   { background: #F9A825; color: #212121 !important; }

  /* ── Content padding ── */
  .inner { padding: 0 12px; }

  /* ── Definition box ── */
  .def-box {
    background: #E3F2FD;
    border-left: 4px solid #1565C0;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 10px;
    line-height: 1.6;
  }
  .formula-row {
    display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
  }
  .formula-pill {
    background: #0D2137;
    color: white;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: bold;
  }
  .formula-val {
    background: #BBDEFB;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
  }

  /* ── Classification cards ── */
  .cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }
  .card { border-radius: 5px; overflow: hidden; }
  .card-header {
    color: white;
    font-weight: bold;
    font-size: 12px;
    padding: 5px 10px;
    letter-spacing: 1px;
  }
  .card-body { padding: 8px 10px; font-size: 12px; line-height: 1.6; }
  .card-body b { color: #333; }
  .card-row { margin-bottom: 3px; }
  .label { font-weight: bold; min-width: 80px; display: inline-block; }

  .hypo  .card-header { background: #1565C0; }
  .hypo  .card-body   { background: #E3F2FD; }
  .cardio .card-header { background: #C62828; }
  .cardio .card-body   { background: #FFEBEE; }
  .distrib .card-header { background: #00695C; }
  .distrib .card-body   { background: #E0F2F1; }
  .obstruct .card-header { background: #6A1B9A; }
  .obstruct .card-body   { background: #F3E5F5; }

  /* ── Tables ── */
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 10px;
  }
  th {
    color: white;
    padding: 6px 8px;
    text-align: center;
    font-size: 11px;
    letter-spacing: 0.3px;
  }
  td {
    padding: 5px 8px;
    border: 1px solid #CFD8DC;
    vertical-align: top;
    line-height: 1.5;
    text-align: center;
  }
  td.left { text-align: left; }
  tr:nth-child(even) td { background: #EEF2FF; }
  tr:nth-child(odd)  td { background: #ffffff; }

  /* Hemodynamic table header colours */
  .hd-table th:nth-child(1) { background: #0D2137; }
  .hd-table th:nth-child(2) { background: #1565C0; }
  .hd-table th:nth-child(3) { background: #C62828; }
  .hd-table th:nth-child(4) { background: #00695C; }
  .hd-table th:nth-child(5) { background: #6A1B9A; }
  .hd-table td:first-child  { background: #ECEFF1 !important; font-weight: bold; text-align: left; }

  /* ── Stages ── */
  .stages-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }
  .stage { border-radius: 5px; overflow: hidden; }
  .stage-header {
    color: white;
    font-weight: bold;
    font-size: 11px;
    padding: 7px 10px;
    text-align: center;
    line-height: 1.5;
  }
  .stage-body { padding: 8px 10px; font-size: 11.5px; line-height: 1.6; }
  .stage-body li { margin-bottom: 2px; margin-left: 14px; }
  .s1 .stage-header { background: #1565C0; }
  .s1 .stage-body   { background: #E3F2FD; }
  .s2 .stage-header { background: #BF360C; }
  .s2 .stage-body   { background: #FBE9E7; }
  .s3 .stage-header { background: #4A148C; }
  .s3 .stage-body   { background: #F3E5F5; }

  /* ── Diagnosis 2-col ── */
  .diag-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
  }
  .diag-box {
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.7;
  }
  .diag-box.blue  { background: #E3F2FD; border: 1px solid #1565C0; }
  .diag-box.teal  { background: #E0F2F1; border: 1px solid #00695C; }
  .diag-box li { margin-left: 16px; margin-bottom: 2px; }
  .diag-box .note { font-style: italic; color: #616161; font-size: 11px; margin-top: 6px; }

  /* ── Sepsis pathogenesis table ── */
  .sep-table td:first-child { background: #FFCDD2 !important; font-weight: bold; text-align: left; width: 140px; }
  .sep-table td:last-child  { background: #FFEBEE !important; text-align: left; }
  .sep-table tr:nth-child(even) td { background: #FFCDD2 !important; }
  .sep-table tr:nth-child(even) td:last-child { background: #FFEBEE !important; }
  .sep-def {
    background: #FFEBEE;
    border: 1.5px solid #C62828;
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 10px;
  }

  /* Vaso table */
  .vaso-table th { background: #E65100; }
  .vaso-table td:first-child { font-weight: bold; text-align: left; background: #FFF8E1 !important; }
  .vaso-table tr:nth-child(even) td { background: #FFF8E1; }
  .vaso-table tr:nth-child(odd)  td { background: #ffffff; }

  /* Organ table */
  .organ-table th { background: #37474F; }
  .organ-table td:first-child { font-weight: bold; text-align: left; background: #ECEFF1 !important; }

  /* ── Pearls ── */
  .pearl-list { list-style: none; margin-bottom: 12px; }
  .pearl-list li {
    padding: 6px 10px 6px 32px;
    position: relative;
    font-size: 12.5px;
    line-height: 1.6;
    border-bottom: 1px solid #ECEFF1;
  }
  .pearl-list li:nth-child(odd)  { background: #FFFDE7; }
  .pearl-list li:nth-child(even) { background: #ffffff; }
  .pearl-list li::before {
    content: "★";
    position: absolute;
    left: 8px;
    color: #F9A825;
    font-size: 14px;
    top: 5px;
  }

  /* ── Footer ── */
  .footer {
    border-top: 1px solid #CFD8DC;
    padding: 8px 14px 0;
    font-size: 10px;
    color: #9E9E9E;
    text-align: center;
    margin-top: 8px;
  }

  /* Arrow helpers */
  .up   { color: #C62828; font-weight: bold; }
  .down { color: #1565C0; font-weight: bold; }
  .norm { color: #388E3C; font-weight: bold; }
</style>
</head>
<body>

<button class="print-btn no-print" onclick="window.print()">🖨 Print / Save as PDF</button>

<div class="page">

  <!-- HEADER -->
  <div class="header">
    <h1>SHOCK</h1>
    <p>Medical Student / USMLE Notes &nbsp;|&nbsp; Pathophysiology · Classification · Hemodynamics · Management</p>
  </div>

  <!-- ══ 1. DEFINITION ══ -->
  <h2 class="sec-bar bar-blue">1. Definition</h2>
  <div class="inner">
    <div class="def-box">
      <b>Shock</b> = a state of <b>acute circulatory failure</b> causing <b>tissue hypoperfusion</b> and cellular hypoxia.
      Oxygen delivery to tissues is insufficient to meet metabolic demands, resulting in anaerobic metabolism,
      lactic acidosis, and — if uncorrected — irreversible multi-organ failure and death.
      At the subcellular level, <b>mitochondria</b> are the first organelles affected (consume &gt;95% of O₂).
    </div>
    <div class="formula-row">
      <span class="formula-pill">O₂ Delivery (DO₂) = CO × CaO₂</span>
      <span class="formula-val">CO = HR × Stroke Volume</span>
      <span class="formula-val">CaO₂ = (Hb × 1.34 × SaO₂) + (0.003 × PaO₂)</span>
    </div>
  </div>

  <!-- ══ 2. CLASSIFICATION ══ -->
  <h2 class="sec-bar bar-blue">2. Classification of Shock</h2>
  <div class="inner">
    <div class="cards-grid">

      <div class="card hypo">
        <div class="card-header">HYPOVOLEMIC</div>
        <div class="card-body">
          <div class="card-row"><span class="label">Mechanism:</span> Low intravascular volume → ↓ preload → ↓ CO</div>
          <div class="card-row"><span class="label">Causes:</span> Hemorrhage, severe burns, vomiting/diarrhea, third-spacing, dehydration</div>
          <div class="card-row"><span class="label">Signs:</span> Tachycardia, ↓BP, cool/clammy skin, flat neck veins, oliguria</div>
          <div class="card-row"><span class="label">Treatment:</span> IV fluids; blood products (pRBC:FFP:plt 1:1:1) for hemorrhage; control bleeding</div>
        </div>
      </div>

      <div class="card cardio">
        <div class="card-header">CARDIOGENIC</div>
        <div class="card-body">
          <div class="card-row"><span class="label">Mechanism:</span> Pump failure → ↓ CO despite normal/high filling volume</div>
          <div class="card-row"><span class="label">Causes:</span> MI (&gt;40% LV loss), arrhythmia, myocarditis, valvular failure, cardiac tamponade</div>
          <div class="card-row"><span class="label">Signs:</span> Tachycardia, ↓BP, pulmonary edema (crackles), JVD, cool/clammy skin, S3 gallop</div>
          <div class="card-row"><span class="label">Treatment:</span> Dobutamine (inotrope) + norepinephrine; PCI for STEMI; IABP/MCS if refractory</div>
        </div>
      </div>

      <div class="card distrib">
        <div class="card-header">DISTRIBUTIVE (Septic / Anaphylactic / Neurogenic)</div>
        <div class="card-body">
          <div class="card-row"><span class="label">Mechanism:</span> Pathological vasodilation → ↓ SVR → relative hypovolemia</div>
          <div class="card-row"><span class="label">Causes:</span> Sepsis/bacteremia, anaphylaxis (IgE-mediated), spinal cord injury, adrenal crisis</div>
          <div class="card-row"><span class="label">Signs:</span> Septic: fever, warm/flushed early; Anaphylactic: urticaria, bronchospasm; Neurogenic: hypotension + bradycardia</div>
          <div class="card-row"><span class="label">Treatment:</span> Septic: NE + antibiotics + fluids; Anaphylactic: <b>IM epinephrine FIRST</b>; Neurogenic: NE or phenylephrine</div>
        </div>
      </div>

      <div class="card obstruct">
        <div class="card-header">OBSTRUCTIVE</div>
        <div class="card-body">
          <div class="card-row"><span class="label">Mechanism:</span> Mechanical block of cardiac output</div>
          <div class="card-row"><span class="label">Causes:</span> Massive PE, tension pneumothorax, cardiac tamponade, aortic dissection</div>
          <div class="card-row"><span class="label">Signs:</span> Tension PTX: absent breath sounds, tracheal deviation, JVD; Tamponade: Beck's triad; PE: pleuritic chest pain, hypoxia</div>
          <div class="card-row"><span class="label">Treatment:</span> Tension PTX: needle decompression → chest tube; Tamponade: pericardiocentesis; Massive PE: anticoag ± thrombolytics</div>
        </div>
      </div>

    </div>
  </div>

  <!-- ══ 3. HEMODYNAMIC COMPARISON CHART ══ -->
  <h2 class="sec-bar bar-orange">3. Hemodynamic Comparison Chart ★ HIGH-YIELD</h2>
  <div class="inner">
    <table class="hd-table">
      <thead>
        <tr>
          <th>Parameter</th>
          <th>Hypovolemic</th>
          <th>Cardiogenic</th>
          <th>Distributive (Septic)</th>
          <th>Obstructive (Tamponade/PE)</th>
        </tr>
      </thead>
      <tbody>
        <tr><td>CO / CI</td><td class="down">↓↓</td><td class="down">↓↓↓</td><td><span class="up">↑↑ early</span> / <span class="down">↓ late</span></td><td class="down">↓↓</td></tr>
        <tr><td>SVR</td><td class="up">↑↑</td><td class="up">↑↑</td><td class="down">↓↓</td><td class="up">↑↑</td></tr>
        <tr><td>CVP / PCWP</td><td class="down">↓↓</td><td class="up">↑↑</td><td class="down">↓ or normal</td><td><span class="up">↑ CVP</span> / <span class="up">↑ PCWP</span></td></tr>
        <tr><td>Heart Rate</td><td class="up">↑</td><td class="up">↑</td><td class="up">↑↑</td><td class="up">↑</td></tr>
        <tr><td>Blood Pressure</td><td class="down">↓</td><td class="down">↓</td><td class="down">↓</td><td class="down">↓</td></tr>
        <tr><td>Pulse Pressure</td><td>Narrow</td><td>Narrow</td><td>Wide (early)</td><td>Narrow / pulsus paradoxus</td></tr>
        <tr><td>SvO₂</td><td class="down">↓</td><td class="down">↓</td><td><span class="up">↑ early</span> / <span class="down">↓ late</span></td><td class="down">↓</td></tr>
        <tr><td>Skin</td><td>Cool / pale</td><td>Cool / clammy</td><td>Warm / flushed (early)</td><td>Cool / pale</td></tr>
        <tr><td>JVD</td><td>Absent</td><td>Present</td><td>Absent</td><td>Present</td></tr>
        <tr><td>Lung Sounds</td><td>Clear</td><td>Crackles (pulm. edema)</td><td>Clear</td><td>Clear (tamponade); Absent (PTX)</td></tr>
        <tr><td>Urine Output</td><td class="down">↓</td><td class="down">↓</td><td class="down">↓</td><td class="down">↓</td></tr>
        <tr><td>Lactate</td><td class="up">↑</td><td class="up">↑</td><td class="up">↑</td><td class="up">↑</td></tr>
        <tr>
          <td><b>1st-line Rx</b></td>
          <td>IV fluids + blood products (1:1:1)</td>
          <td>Dobutamine + NE; PCI for STEMI</td>
          <td>Norepinephrine + antibiotics + fluids</td>
          <td>Decompress / pericardiocentesis / anticoag</td>
        </tr>
      </tbody>
    </table>
    <p style="font-size:11px; color:#616161; margin-bottom:10px;">
      <b>Cardiogenic shock definition:</b> SBP &lt;90 mmHg + CI &lt;2.2 L/min/m² + PCWP &gt;18 mmHg
    </p>
  </div>

  <!-- ══ 4. THREE STAGES ══ -->
  <h2 class="sec-bar bar-gray">4. Three Stages of Shock</h2>
  <div class="inner">
    <div class="stages-grid">
      <div class="stage s1">
        <div class="stage-header">STAGE 1<br>COMPENSATED (Nonprogressive)</div>
        <div class="stage-body">
          <ul>
            <li>Baroreceptors activate → catecholamines, ADH, RAAS</li>
            <li>Tachycardia, ↑ SVR, renal fluid conservation</li>
            <li>Blood shunted: skin/gut → heart and brain</li>
            <li>No overt organ dysfunction yet</li>
            <li>Lactate mildly ↑; creatinine may rise</li>
            <li>Skin: cool/pale (warm/flushed in early sepsis)</li>
          </ul>
        </div>
      </div>
      <div class="stage s2">
        <div class="stage-header">STAGE 2<br>DECOMPENSATED (Progressive)</div>
        <div class="stage-body">
          <ul>
            <li>Compensatory mechanisms overwhelmed</li>
            <li>Anaerobic glycolysis → lactic acidosis</li>
            <li>↓ pH blunts vasomotor response → arterioles dilate</li>
            <li>Blood pools in microcirculation → worsens CO</li>
            <li>DIC develops from endothelial injury</li>
            <li>Vital organs (kidney, heart, bowel) begin to fail</li>
          </ul>
        </div>
      </div>
      <div class="stage s3">
        <div class="stage-header">STAGE 3<br>IRREVERSIBLE</div>
        <div class="stage-body">
          <ul>
            <li>Lysosomal enzyme leakage amplifies destruction</li>
            <li>↑ NO → myocardial contractility worsens further</li>
            <li>Ischemic gut → bacterial translocation → bacteremia</li>
            <li>Multisystem organ failure (MSOF)</li>
            <li>Death even if hemodynamics corrected</li>
          </ul>
        </div>
      </div>
    </div>
  </div>

  <!-- ══ 5. DIAGNOSIS ══ -->
  <h2 class="sec-bar bar-gray">5. Diagnosis — Clinical Criteria &amp; Lab Markers</h2>
  <div class="inner">
    <div class="diag-grid">
      <div class="diag-box blue">
        <b>Empirical Criteria for Shock (majority should be met):</b>
        <ul>
          <li>Ill appearance / altered mental status</li>
          <li>HR &gt; 100 bpm</li>
          <li>RR &gt; 20/min  or  PaCO₂ &lt; 32 mmHg</li>
          <li>Base deficit &lt; −4 mEq/L  or  Lactate &gt; 4 mmol/L</li>
          <li>Urine output &lt; 0.5 mL/kg/h</li>
          <li>SBP &lt; 90 mmHg or MAP &lt; 65 mmHg &gt; 30 min</li>
        </ul>
        <p class="note">⚠ Shock can occur with NORMAL BP — especially early or in distributive states</p>
      </div>
      <div class="diag-box teal">
        <b>Key Lab Markers:</b>
        <ul>
          <li><b>Lactate &gt; 4 mmol/L</b> → tissue hypoperfusion; predicts organ failure</li>
          <li><b>Base deficit &lt; −4 mEq/L</b> → equivalent to lactate elevation</li>
          <li><b>Rising lactate + worsening BD</b> → refractory shock</li>
          <li><b>Creatinine / BUN ↑</b> → acute kidney injury</li>
          <li><b>Troponin ↑</b> → myocardial injury (demand ischemia)</li>
          <li><b>Procalcitonin, CRP ↑</b> → sepsis markers</li>
          <li><b>PT/INR/fibrinogen/D-dimer</b> → DIC screen</li>
        </ul>
      </div>
    </div>
  </div>

  <!-- ══ 6. SEPTIC SHOCK PATHOGENESIS ══ -->
  <h2 class="sec-bar bar-red">6. Septic Shock — Pathogenesis (High Detail)</h2>
  <div class="inner">
    <table class="sep-table">
      <tbody>
        <tr><td>Microbial Trigger</td><td>Endotoxin (LPS), exotoxins, fungal antigens activate TLRs on macrophages/dendritic cells via PAMPs &amp; DAMPs</td></tr>
        <tr><td>NF-κB Activation</td><td>TLR signaling → NF-κB nuclear translocation → transcription of TNF, IL-1, IL-6, IL-12, IL-18, IFN-γ, HMGB1</td></tr>
        <tr><td>Complement Activation</td><td>Microbial components activate complement → C3a/C5a (anaphylatoxins) → further inflammation and vasodilation</td></tr>
        <tr><td>Endothelial Injury</td><td>Cytokines ↑ adhesion molecules; coagulation activated via factor XII → widespread microvascular thrombosis, DIC</td></tr>
        <tr><td>Vasodilation / ↓SVR</td><td>Massive ↑ nitric oxide (NO) → profound vasodilation → distributive shock; relative hypovolemia</td></tr>
        <tr><td>Counter-regulation</td><td>Lymphocyte apoptosis, Th1→Th2 shift, ↑ IL-10 → immunosuppression; oscillation between hyperinflammation and immune suppression</td></tr>
        <tr><td>Organ Failure</td><td>ARDS, AKI, hepatic dysfunction, DIC, encephalopathy — SOFA score quantifies organ failure</td></tr>
      </tbody>
    </table>
    <div class="sep-def">
      <b>Sepsis-3 Definitions:</b>
      &nbsp;<b>Sepsis</b> = life-threatening organ dysfunction (SOFA ↑≥2 from baseline) caused by dysregulated host response to infection.
      &nbsp;<b>Septic Shock</b> = Sepsis + vasopressor requirement to maintain MAP ≥65 mmHg + lactate &gt;2 mmol/L despite adequate fluids.
      &nbsp;Mortality ≈ <b>40%</b>. Most common triggers: gram-positive bacteria &gt; gram-negative bacteria &gt; fungi.
    </div>
  </div>

  <!-- ══ 7. VASOACTIVE DRUGS ══ -->
  <h2 class="sec-bar bar-orange">7. Vasoactive Drugs in Shock</h2>
  <div class="inner">
    <table class="vaso-table">
      <thead>
        <tr>
          <th style="text-align:left">Drug</th>
          <th>Dose</th>
          <th>Receptors</th>
          <th>Main Effect</th>
          <th>Use in Shock</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td><b>Norepinephrine</b><br><small>(1st line — septic)</small></td>
          <td>3–30 µg/min</td>
          <td>α1 &gt; β1</td>
          <td>↑ SVR + modest ↑ CO</td>
          <td class="left">Septic / distributive; preferred over dopamine</td>
        </tr>
        <tr>
          <td><b>Epinephrine</b></td>
          <td>5–20 µg/min (IV)<br>0.3–0.5 mg IM</td>
          <td>α + β1 + β2</td>
          <td>↑ CO + ↑ SVR; bronchodilation</td>
          <td class="left">Anaphylaxis: <b>IM FIRST</b>; refractory septic shock</td>
        </tr>
        <tr>
          <td><b>Vasopressin</b></td>
          <td>0.01–0.04 U/min</td>
          <td>V1 receptors</td>
          <td>↑ SVR; no ↑ HR; no ↑ pulm. resistance</td>
          <td class="left">Adjunct to NE in septic; useful with pulm. HTN or RV failure</td>
        </tr>
        <tr>
          <td><b>Dobutamine</b></td>
          <td>2–15 µg/kg/min</td>
          <td>β1 &gt; β2</td>
          <td>↑ CO (inotrope); ↓ SVR slightly</td>
          <td class="left">Cardiogenic shock; low CO states</td>
        </tr>
        <tr>
          <td><b>Dopamine</b><br><small>(not preferred)</small></td>
          <td>dose-dependent</td>
          <td>DA &gt; β &gt; α</td>
          <td>Variable by dose; ↑ arrhythmias</td>
          <td class="left">⚠ Not recommended — higher mortality vs NE in septic/cardiogenic</td>
        </tr>
        <tr>
          <td><b>Phenylephrine</b></td>
          <td>2–300 µg/min</td>
          <td>Pure α1</td>
          <td>↑ SVR; reflex ↓ HR</td>
          <td class="left">Neurogenic shock; avoid if low CO</td>
        </tr>
      </tbody>
    </table>
  </div>

  <!-- ══ 8. ORGAN PATHOLOGY ══ -->
  <h2 class="sec-bar bar-gray">8. Organ Pathology in Shock</h2>
  <div class="inner">
    <table class="organ-table">
      <thead>
        <tr>
          <th style="text-align:left">Organ</th>
          <th style="text-align:left">Lesion</th>
          <th style="text-align:left">Notes</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>Kidney</td>
          <td class="left">Acute Tubular Necrosis (ATN)</td>
          <td class="left">Most common cause of AKI; ischemic injury to proximal tubule; granular "muddy brown" casts on UA</td>
        </tr>
        <tr>
          <td>Lung</td>
          <td class="left">ARDS / "Shock Lung"</td>
          <td class="left">Diffuse alveolar damage; especially septic and traumatic shock; protein-rich edema, hyaline membranes</td>
        </tr>
        <tr>
          <td>Heart</td>
          <td class="left">Subendocardial infarction</td>
          <td class="left">Ischemia of inner 1/3 of myocardium; diffuse, non-territorial; ST depression; supply-demand mismatch</td>
        </tr>
        <tr>
          <td>Brain</td>
          <td class="left">Ischemic encephalopathy</td>
          <td class="left">Watershed zone infarcts; altered mental status; neurons and cardiomyocytes cannot regenerate</td>
        </tr>
        <tr>
          <td>GI Tract</td>
          <td class="left">Hemorrhagic enteropathy / Ischemic bowel</td>
          <td class="left">Mucosal ulceration; bacterial translocation into bloodstream → superimposed bacteremia worsens shock</td>
        </tr>
        <tr>
          <td>Adrenals</td>
          <td class="left">Cortical lipid depletion</td>
          <td class="left">Maximal steroid synthesis; overwhelming sepsis → Waterhouse-Friderichsen syndrome (adrenal hemorrhage)</td>
        </tr>
        <tr>
          <td>Liver</td>
          <td class="left">Centrilobular necrosis / "Shock liver"</td>
          <td class="left">Zone 3 (centrilobular) most susceptible; ↑ transaminases; may resolve if resuscitation succeeds</td>
        </tr>
      </tbody>
    </table>
  </div>

  <!-- ══ 9. USMLE PEARLS ══ -->
  <h2 class="sec-bar bar-gold">9. USMLE High-Yield Pearls ⭐</h2>
  <div class="inner">
    <ul class="pearl-list">
      <li>Only type with <b>HIGH PCWP + LOW CO + HIGH SVR</b> = <b>CARDIOGENIC</b></li>
      <li>Only type with <b>LOW SVR + HIGH CO (early)</b> = <b>DISTRIBUTIVE (septic)</b></li>
      <li>Hypovolemic vs Cardiogenic: both ↓CO, ↑SVR — difference is PCWP (↓ in hypovolemic, ↑↑ in cardiogenic)</li>
      <li><b>Beck's Triad</b> (tamponade) = Hypotension + JVD + Muffled heart sounds → <b>pericardiocentesis</b></li>
      <li><b>Tension PTX</b> = absent breath sounds + tracheal deviation away + JVD → <b>needle decompression 2nd ICS MCL</b></li>
      <li>1st-line vasopressor for septic shock = <b>NOREPINEPHRINE</b> (not dopamine — dopamine ↑ arrhythmias, ↑ mortality)</li>
      <li>1st-line for anaphylactic shock = <b>IM EPINEPHRINE (thigh)</b> — do NOT give antihistamines or steroids first</li>
      <li>Lactate &gt;4 mmol/L <b>OR</b> base deficit &lt; −4 mEq/L = presumptive shock regardless of BP</li>
      <li><b>Neurogenic shock</b> = hypotension + <b>BRADYCARDIA</b> (unlike all other shock types which cause tachycardia)</li>
      <li>Cardiogenic shock post-MI: SBP &lt;90 + CI &lt;2.2 L/min/m² + <b>PCWP &gt;18 mmHg</b></li>
      <li>Urine output &lt;0.5 mL/kg/h = severe renal hypoperfusion marker in any shock</li>
      <li><b>SOFA score ↑ ≥2</b> from baseline = sepsis; add vasopressor need + lactate &gt;2 = <b>septic shock</b></li>
    </ul>
  </div>

  <!-- FOOTER -->
  <div class="footer">
    Sources: Robbins, Cotran &amp; Kumar — Pathologic Basis of Disease (10e) | Harrison's Principles of Internal Medicine (22e) |
    Rosen's Emergency Medicine | Goldman-Cecil Medicine | Sabiston Textbook of Surgery | Schwartz's Principles of Surgery
    &nbsp;|&nbsp; For educational use only — verify with current clinical guidelines
  </div>

</div><!-- /page -->

</body>
</html>
Running Command

ls -lh /home/daytona/workspace/cpr-guide/shock_notes.html

Your HTML notes are ready:

shock notes

HTML File · HTML

How to print / save as PDF:
  1. Click the link above to open the file
  2. A "🖨 Print / Save as PDF" button appears at the top of the page
  3. Click it (or press Ctrl+P / Cmd+P)
  4. In the print dialog, choose "Save as PDF" as the destination
  5. Set paper size to A4 or Letter, margins to minimum/none
What's inside — 9 sections:
  • Definition + O₂ delivery formula
  • Classification cards (Hypovolemic, Cardiogenic, Distributive, Obstructive)
  • Hemodynamic Comparison Chart (CO, SVR, PCWP, HR, skin, JVD, SvO₂, 1st-line Rx)
  • Three Stages of Shock (color-coded)
  • Diagnosis criteria + Lab markers (2-column)
  • Septic shock pathogenesis (TLR → NF-κB → cytokines → DIC)
  • Vasoactive drugs table (doses, receptors, indications)
  • Organ pathology (ATN, ARDS, shock liver, etc.)
  • 12 USMLE high-yield pearls ⭐

No links working

No problem — I'll paste the entire HTML directly in the chat so you can copy it and save it yourself.
Instructions:
  1. Copy everything between the triple backticks below
  2. Open a plain text editor (Notepad on Windows, TextEdit on Mac)
  3. Paste and save as shock_notes.html
  4. Double-click the file to open in your browser
  5. Press Ctrl+P → Save as PDF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shock Notes — USMLE / Medical Student</title>
<style>
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: Arial, sans-serif; font-size: 13px; color: #212121; background: #f0f2f5; padding: 20px; }
  @media print {
    body { background: white; padding: 0; font-size: 11px; }
    .page { box-shadow: none; margin: 0; padding: 10mm; max-width: 100%; }
    .no-print { display: none; }
    @page { margin: 8mm; size: A4; }
  }
  .page { max-width: 1000px; margin: 0 auto 30px; background: white; box-shadow: 0 4px 20px rgba(0,0,0,0.12); border-radius: 6px; overflow: hidden; padding-bottom: 16px; }
  .print-btn { display: block; width: 220px; margin: 0 auto 18px; padding: 12px 0; background: #1565C0; color: white; border: none; border-radius: 6px; font-size: 15px; font-weight: bold; cursor: pointer; text-align: center; }
  .print-btn:hover { background: #0D47A1; }
  .header { background: linear-gradient(135deg, #0D2137 0%, #1565C0 100%); color: white; padding: 18px 24px 14px; }
  .header h1 { font-size: 28px; letter-spacing: 2px; margin-bottom: 4px; }
  .header p { font-size: 11px; opacity: 0.85; }
  h2.sec-bar { color: white; padding: 6px 14px; font-size: 12px; letter-spacing: 0.8px; text-transform: uppercase; margin: 14px 12px 8px; border-radius: 4px; }
  .bar-blue { background: #1565C0; }
  .bar-red { background: #C62828; }
  .bar-orange { background: #E65100; }
  .bar-gray { background: #37474F; }
  .bar-gold { background: #F9A825; color: #212121 !important; }
  .inner { padding: 0 12px; }
  .def-box { background: #E3F2FD; border-left: 4px solid #1565C0; border-radius: 4px; padding: 10px 14px; margin-bottom: 10px; line-height: 1.6; }
  .formula-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
  .formula-pill { background: #0D2137; color: white; border-radius: 4px; padding: 6px 12px; font-size: 12px; font-weight: bold; }
  .formula-val { background: #BBDEFB; border-radius: 4px; padding: 6px 12px; font-size: 12px; }
  .cards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
  .card { border-radius: 5px; overflow: hidden; }
  .card-header { color: white; font-weight: bold; font-size: 12px; padding: 5px 10px; letter-spacing: 1px; }
  .card-body { padding: 8px 10px; font-size: 12px; line-height: 1.6; }
  .card-row { margin-bottom: 3px; }
  .label { font-weight: bold; min-width: 80px; display: inline-block; }
  .hypo .card-header { background: #1565C0; } .hypo .card-body { background: #E3F2FD; }
  .cardio .card-header { background: #C62828; } .cardio .card-body { background: #FFEBEE; }
  .distrib .card-header { background: #00695C; } .distrib .card-body { background: #E0F2F1; }
  .obstruct .card-header { background: #6A1B9A; } .obstruct .card-body { background: #F3E5F5; }
  table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 10px; }
  th { color: white; padding: 6px 8px; text-align: center; font-size: 11px; }
  td { padding: 5px 8px; border: 1px solid #CFD8DC; vertical-align: top; line-height: 1.5; text-align: center; }
  td.left { text-align: left; }
  tr:nth-child(even) td { background: #EEF2FF; }
  tr:nth-child(odd) td { background: #ffffff; }
  .hd-table th:nth-child(1) { background: #0D2137; }
  .hd-table th:nth-child(2) { background: #1565C0; }
  .hd-table th:nth-child(3) { background: #C62828; }
  .hd-table th:nth-child(4) { background: #00695C; }
  .hd-table th:nth-child(5) { background: #6A1B9A; }
  .hd-table td:first-child { background: #ECEFF1 !important; font-weight: bold; text-align: left; }
  .stages-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 10px; }
  .stage { border-radius: 5px; overflow: hidden; }
  .stage-header { color: white; font-weight: bold; font-size: 11px; padding: 7px 10px; text-align: center; line-height: 1.5; }
  .stage-body { padding: 8px 10px; font-size: 11.5px; line-height: 1.6; }
  .stage-body li { margin-bottom: 2px; margin-left: 14px; }
  .s1 .stage-header { background: #1565C0; } .s1 .stage-body { background: #E3F2FD; }
  .s2 .stage-header { background: #BF360C; } .s2 .stage-body { background: #FBE9E7; }
  .s3 .stage-header { background: #4A148C; } .s3 .stage-body { background: #F3E5F5; }
  .diag-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
  .diag-box { border-radius: 4px; padding: 10px 12px; font-size: 12px; line-height: 1.7; }
  .diag-box.blue { background: #E3F2FD; border: 1px solid #1565C0; }
  .diag-box.teal { background: #E0F2F1; border: 1px solid #00695C; }
  .diag-box li { margin-left: 16px; margin-bottom: 2px; }
  .diag-box .note { font-style: italic; color: #616161; font-size: 11px; margin-top: 6px; }
  .sep-table td:first-child { background: #FFCDD2 !important; font-weight: bold; text-align: left; width: 140px; }
  .sep-table td:last-child { background: #FFEBEE !important; text-align: left; }
  .sep-def { background: #FFEBEE; border: 1.5px solid #C62828; border-radius: 4px; padding: 8px 14px; font-size: 12px; line-height: 1.6; margin-bottom: 10px; }
  .vaso-table th { background: #E65100; }
  .vaso-table td:first-child { font-weight: bold; text-align: left; }
  .organ-table th { background: #37474F; }
  .organ-table td:first-child { font-weight: bold; text-align: left; background: #ECEFF1 !important; }
  .pearl-list { list-style: none; margin-bottom: 12px; }
  .pearl-list li { padding: 6px 10px 6px 32px; position: relative; font-size: 12.5px; line-height: 1.6; border-bottom: 1px solid #ECEFF1; }
  .pearl-list li:nth-child(odd) { background: #FFFDE7; }
  .pearl-list li:nth-child(even) { background: #ffffff; }
  .pearl-list li::before { content: "★"; position: absolute; left: 8px; color: #F9A825; font-size: 14px; top: 5px; }
  .footer { border-top: 1px solid #CFD8DC; padding: 8px 14px 0; font-size: 10px; color: #9E9E9E; text-align: center; margin-top: 8px; }
  .up { color: #C62828; font-weight: bold; }
  .down { color: #1565C0; font-weight: bold; }
</style>
</head>
<body>

<button class="print-btn no-print" onclick="window.print()">🖨 Print / Save as PDF</button>

<div class="page">

  <div class="header">
    <h1>SHOCK</h1>
    <p>Medical Student / USMLE Notes &nbsp;|&nbsp; Pathophysiology · Classification · Hemodynamics · Management</p>
  </div>

  <h2 class="sec-bar bar-blue">1. Definition</h2>
  <div class="inner">
    <div class="def-box">
      <b>Shock</b> = a state of <b>acute circulatory failure</b> causing <b>tissue hypoperfusion</b> and cellular hypoxia.
      O₂ delivery to tissues is insufficient to meet metabolic demands → anaerobic metabolism → lactic acidosis →
      irreversible multi-organ failure and death if uncorrected.
      <b>Mitochondria</b> are the first subcellular structures affected (consume &gt;95% of body O₂).
    </div>
    <div class="formula-row">
      <span class="formula-pill">O₂ Delivery (DO₂) = CO × CaO₂</span>
      <span class="formula-val">CO = HR × Stroke Volume</span>
      <span class="formula-val">CaO₂ = (Hb × 1.34 × SaO₂) + (0.003 × PaO₂)</span>
    </div>
  </div>

  <h2 class="sec-bar bar-blue">2. Classification of Shock</h2>
  <div class="inner">
    <div class="cards-grid">
      <div class="card hypo">
        <div class="card-header">HYPOVOLEMIC</div>
        <div class="card-body">
          <div class="card-row"><span class="label">Mechanism:</span> Low intravascular volume → ↓ preload → ↓ CO</div>
          <div class="card-row"><span class="label">Causes:</span> Hemorrhage, burns, vomiting/diarrhea, third-spacing, dehydration</div>
          <div class="card-row"><span class="label">Signs:</span> Tachycardia, ↓BP, cool/clammy skin, flat neck veins, oliguria</div>
          <div class="card-row"><span class="label">Treatment:</span> IV fluids; blood products (pRBC:FFP:plt 1:1:1) for hemorrhage; stop bleeding</div>
        </div>
      </div>
      <div class="card cardio">
        <div class="card-header">CARDIOGENIC</div>
        <div class="card-body">
          <div class="card-row"><span class="label">Mechanism:</span> Pump failure → ↓ CO despite normal/high filling volume</div>
          <div class="card-row"><span class="label">Causes:</span> MI (&gt;40% LV loss), arrhythmia, myocarditis, valvular failure, tamponade</div>
          <div class="card-row"><span class="label">Signs:</span> Tachycardia, ↓BP, pulmonary edema (crackles), JVD, cool/clammy skin, S3</div>
          <div class="card-row"><span class="label">Treatment:</span> Dobutamine + norepinephrine; PCI for STEMI; IABP/MCS if refractory</div>
        </div>
      </div>
      <div class="card distrib">
        <div class="card-header">DISTRIBUTIVE (Septic / Anaphylactic / Neurogenic)</div>
        <div class="card-body">
          <div class="card-row"><span class="label">Mechanism:</span> Pathological vasodilation → ↓ SVR → relative hypovolemia</div>
          <div class="card-row"><span class="label">Causes:</span> Sepsis, anaphylaxis (IgE), spinal cord injury, adrenal crisis</div>
          <div class="card-row"><span class="label">Signs:</span> Septic: fever, warm/flushed early; Anaphylaxis: urticaria, wheeze; Neurogenic: bradycardia</div>
          <div class="card-row"><span class="label">Treatment:</span> Septic: NE + abx + fluids; Anaphylaxis: <b>IM epi FIRST</b>; Neurogenic: NE/phenylephrine</div>
        </div>
      </div>
      <div class="card obstruct">
        <div class="card-header">OBSTRUCTIVE</div>
        <div class="card-body">
          <div class="card-row"><span class="label">Mechanism:</span> Mechanical block of cardiac output</div>
          <div class="card-row"><span class="label">Causes:</span> Massive PE, tension pneumothorax, cardiac tamponade, aortic dissection</div>
          <div class="card-row"><span class="label">Signs:</span> PTX: absent breath sounds + tracheal deviation + JVD; Tamponade: Beck's triad</div>
          <div class="card-row"><span class="label">Treatment:</span> PTX: needle decompression; Tamponade: pericardiocentesis; PE: anticoag ± thrombolytics</div>
        </div>
      </div>
    </div>
  </div>

  <h2 class="sec-bar bar-orange">3. Hemodynamic Comparison Chart ★ HIGH-YIELD</h2>
  <div class="inner">
    <table class="hd-table">
      <thead>
        <tr>
          <th>Parameter</th>
          <th>Hypovolemic</th>
          <th>Cardiogenic</th>
          <th>Distributive (Septic)</th>
          <th>Obstructive (Tamponade/PE)</th>
        </tr>
      </thead>
      <tbody>
        <tr><td>CO / CI</td><td class="down">↓↓</td><td class="down">↓↓↓</td><td><span class="up">↑↑ early</span> / <span class="down">↓ late</span></td><td class="down">↓↓</td></tr>
        <tr><td>SVR</td><td class="up">↑↑</td><td class="up">↑↑</td><td class="down">↓↓</td><td class="up">↑↑</td></tr>
        <tr><td>CVP / PCWP</td><td class="down">↓↓</td><td class="up">↑↑</td><td class="down">↓ or normal</td><td class="up">↑ (both)</td></tr>
        <tr><td>Heart Rate</td><td class="up">↑</td><td class="up">↑</td><td class="up">↑↑</td><td class="up">↑</td></tr>
        <tr><td>Blood Pressure</td><td class="down">↓</td><td class="down">↓</td><td class="down">↓</td><td class="down">↓</td></tr>
        <tr><td>Pulse Pressure</td><td>Narrow</td><td>Narrow</td><td>Wide (early)</td><td>Narrow / pulsus paradoxus</td></tr>
        <tr><td>SvO₂</td><td class="down">↓</td><td class="down">↓</td><td><span class="up">↑ early</span> / <span class="down">↓ late</span></td><td class="down">↓</td></tr>
        <tr><td>Skin</td><td>Cool / pale</td><td>Cool / clammy</td><td>Warm / flushed (early)</td><td>Cool / pale</td></tr>
        <tr><td>JVD</td><td>Absent</td><td>Present</td><td>Absent</td><td>Present</td></tr>
        <tr><td>Lung Sounds</td><td>Clear</td><td>Crackles</td><td>Clear</td><td>Clear / Absent (PTX)</td></tr>
        <tr><td>Urine Output</td><td class="down">↓</td><td class="down">↓</td><td class="down">↓</td><td class="down">↓</td></tr>
        <tr><td>Lactate</td><td class="up">↑</td><td class="up">↑</td><td class="up">↑</td><td class="up">↑</td></tr>
        <tr><td><b>1st-line Rx</b></td><td>Fluids + blood (1:1:1)</td><td>Dobutamine + NE; PCI</td><td>NE + abx + fluids</td><td>Decompress / pericard. / anticoag</td></tr>
      </tbody>
    </table>
    <p style="font-size:11px;color:#616161;margin-bottom:10px;"><b>Cardiogenic shock:</b> SBP &lt;90 + CI &lt;2.2 L/min/m² + PCWP &gt;18 mmHg</p>
  </div>

  <h2 class="sec-bar bar-gray">4. Three Stages of Shock</h2>
  <div class="inner">
    <div class="stages-grid">
      <div class="stage s1">
        <div class="stage-header">STAGE 1<br>COMPENSATED (Nonprogressive)</div>
        <div class="stage-body"><ul>
          <li>Baroreceptors → catecholamines, ADH, RAAS activate</li>
          <li>Tachycardia, ↑SVR, renal fluid conservation</li>
          <li>Blood shunted: skin/gut → heart and brain</li>
          <li>No overt organ dysfunction yet</li>
          <li>Lactate mildly ↑; creatinine may begin to rise</li>
          <li>Skin: cool/pale (warm/flushed in early sepsis)</li>
        </ul></div>
      </div>
      <div class="stage s2">
        <div class="stage-header">STAGE 2<br>DECOMPENSATED (Progressive)</div>
        <div class="stage-body"><ul>
          <li>Compensatory mechanisms overwhelmed</li>
          <li>Anaerobic glycolysis → lactic acidosis → ↓pH</li>
          <li>↓pH blunts vasomotor response → arterioles dilate</li>
          <li>Blood pools in microcirculation → worsens CO (vicious cycle)</li>
          <li>DIC develops from endothelial injury</li>
          <li>Vital organs (kidney, heart, bowel) begin to fail</li>
        </ul></div>
      </div>
      <div class="stage s3">
        <div class="stage-header">STAGE 3<br>IRREVERSIBLE</div>
        <div class="stage-body"><ul>
          <li>Lysosomal enzyme leakage amplifies cell destruction</li>
          <li>↑NO → myocardial contractility worsens further</li>
          <li>Ischemic gut → bacterial translocation → bacteremia</li>
          <li>Multisystem organ failure (MSOF)</li>
          <li>Death even if hemodynamics are corrected</li>
        </ul></div>
      </div>
    </div>
  </div>

  <h2 class="sec-bar bar-gray">5. Diagnosis — Clinical Criteria &amp; Lab Markers</h2>
  <div class="inner">
    <div class="diag-grid">
      <div class="diag-box blue">
        <b>Empirical Criteria for Shock (majority should be met):</b>
        <ul>
          <li>Ill appearance / altered mental status</li>
          <li>HR &gt; 100 bpm</li>
          <li>RR &gt; 20/min or PaCO₂ &lt; 32 mmHg</li>
          <li>Base deficit &lt; −4 mEq/L or Lactate &gt; 4 mmol/L</li>
          <li>Urine output &lt; 0.5 mL/kg/h</li>
          <li>SBP &lt; 90 mmHg or MAP &lt; 65 mmHg &gt; 30 min</li>
        </ul>
        <p class="note">⚠ Shock can occur with NORMAL BP — especially early or in distributive states</p>
      </div>
      <div class="diag-box teal">
        <b>Key Lab Markers:</b>
        <ul>
          <li><b>Lactate &gt; 4 mmol/L</b> → tissue hypoperfusion; predicts organ failure</li>
          <li><b>Base deficit &lt; −4 mEq/L</b> → equivalent indicator to lactate</li>
          <li><b>Rising lactate + worsening BD</b> → refractory shock</li>
          <li><b>Creatinine/BUN ↑</b> → acute kidney injury</li>
          <li><b>Troponin ↑</b> → myocardial injury / demand ischemia</li>
          <li><b>Procalcitonin, CRP ↑</b> → sepsis markers</li>
          <li><b>PT/INR/fibrinogen/D-dimer</b> → DIC screen</li>
        </ul>
      </div>
    </div>
  </div>

  <h2 class="sec-bar bar-red">6. Septic Shock — Pathogenesis</h2>
  <div class="inner">
    <table class="sep-table">
      <tbody>
        <tr><td>Microbial Trigger</td><td>Endotoxin (LPS), exotoxins, fungal antigens activate TLRs on macrophages/dendritic cells via PAMPs &amp; DAMPs</td></tr>
        <tr><td>NF-κB Activation</td><td>TLR signaling → NF-κB nuclear translocation → transcription of TNF, IL-1, IL-6, IL-12, IL-18, IFN-γ, HMGB1</td></tr>
        <tr><td>Complement</td><td>Microbial components activate complement → C3a/C5a (anaphylatoxins) → further inflammation and vasodilation</td></tr>
        <tr><td>Endothelial Injury</td><td>Cytokines ↑ adhesion molecules; coagulation activated via factor XII → microvascular thrombosis, DIC</td></tr>
        <tr><td>Vasodilation / ↓SVR</td><td>Massive ↑ nitric oxide (NO) → profound vasodilation → distributive shock; relative hypovolemia</td></tr>
        <tr><td>Counter-regulation</td><td>Lymphocyte apoptosis, Th1→Th2 shift, ↑IL-10 → immunosuppression; oscillation between hyperinflammation and immune suppression</td></tr>
        <tr><td>Organ Failure</td><td>ARDS, AKI, hepatic dysfunction, DIC, encephalopathy — SOFA score quantifies organ failure</td></tr>
      </tbody>
    </table>
    <div class="sep-def">
      <b>Sepsis-3:</b> &nbsp;<b>Sepsis</b> = life-threatening organ dysfunction (SOFA ↑≥2) from dysregulated host response to infection.
      &nbsp;<b>Septic Shock</b> = Sepsis + vasopressor needed to maintain MAP ≥65 + lactate &gt;2 mmol/L despite fluids.
      &nbsp;Mortality ≈ <b>40%</b>. Triggers: gram-positive &gt; gram-negative bacteria &gt; fungi.
    </div>
  </div>

  <h2 class="sec-bar bar-orange">7. Vasoactive Drugs in Shock</h2>
  <div class="inner">
    <table class="vaso-table">
      <thead>
        <tr><th style="text-align:left">Drug</th><th>Dose</th><th>Receptors</th><th>Main Effect</th><th>Use in Shock</th></tr>
      </thead>
      <tbody>
        <tr><td><b>Norepinephrine</b> (1st line — septic)</td><td>3–30 µg/min</td><td>α1 &gt; β1</td><td>↑SVR + modest ↑CO</td><td class="left">Septic/distributive; preferred over dopamine</td></tr>
        <tr><td><b>Epinephrine</b></td><td>5–20 µg/min IV; 0.3 mg IM</td><td>α + β1 + β2</td><td>↑CO + ↑SVR; bronchodilation</td><td class="left">Anaphylaxis: <b>IM FIRST</b>; refractory septic shock</td></tr>
        <tr><td><b>Vasopressin</b></td><td>0.01–0.04 U/min</td><td>V1</td><td>↑SVR; no ↑HR; no ↑pulm. resistance</td><td class="left">Adjunct to NE; useful with pulm. HTN or RV failure</td></tr>
        <tr><td><b>Dobutamine</b></td><td>2–15 µg/kg/min</td><td>β1 &gt; β2</td><td>↑CO (inotrope); ↓SVR slightly</td><td class="left">Cardiogenic shock; low CO states</td></tr>
        <tr><td><b>Dopamine</b> (not preferred)</td><td>dose-dependent</td><td>DA &gt; β &gt; α</td><td>Variable; ↑arrhythmias</td><td class="left">⚠ Not recommended — higher mortality vs NE</td></tr>
        <tr><td><b>Phenylephrine</b></td><td>2–300 µg/min</td><td>Pure α1</td><td>↑SVR; reflex ↓HR</td><td class="left">Neurogenic shock; avoid if low CO</td></tr>
      </tbody>
    </table>
  </div>

  <h2 class="sec-bar bar-gray">8. Organ Pathology in Shock</h2>
  <div class="inner">
    <table class="organ-table">
      <thead>
        <tr><th style="text-align:left">Organ</th><th style="text-align:left">Lesion</th><th style="text-align:left">Notes</th></tr>
      </thead>
      <tbody>
        <tr><td>Kidney</td><td class="left">Acute Tubular Necrosis (ATN)</td><td class="left">Most common AKI cause; proximal tubule injury; granular "muddy brown" casts on UA</td></tr>
        <tr><td>Lung</td><td class="left">ARDS / "Shock Lung"</td><td class="left">Diffuse alveolar damage; protein-rich edema, hyaline membranes; especially septic/traumatic</td></tr>
        <tr><td>Heart</td><td class="left">Subendocardial infarction</td><td class="left">Inner 1/3 myocardium ischemia; diffuse non-territorial; ST depression; supply-demand mismatch</td></tr>
        <tr><td>Brain</td><td class="left">Ischemic encephalopathy</td><td class="left">Watershed zone infarcts; AMS; neurons and cardiomyocytes cannot regenerate</td></tr>
        <tr><td>GI Tract</td><td class="left">Hemorrhagic enteropathy / Ischemic bowel</td><td class="left">Mucosal ulceration; bacterial translocation → superimposed bacteremia</td></tr>
        <tr><td>Adrenals</td><td class="left">Cortical lipid depletion</td><td class="left">Maximal steroid synthesis; overwhelming sepsis → Waterhouse-Friderichsen syndrome</td></tr>
        <tr><td>Liver</td><td class="left">Centrilobular necrosis / "Shock liver"</td><td class="left">Zone 3 most susceptible; ↑transaminases; may resolve with resuscitation</td></tr>
      </tbody>
    </table>
  </div>

  <h2 class="sec-bar bar-gold">9. USMLE High-Yield Pearls ⭐</h2>
  <div class="inner">
    <ul class="pearl-list">
      <li>Only type with <b>HIGH PCWP + LOW CO + HIGH SVR</b> = <b>CARDIOGENIC</b></li>
      <li>Only type with <b>LOW SVR + HIGH CO (early)</b> = <b>DISTRIBUTIVE (septic)</b></li>
      <li>Hypovolemic vs Cardiogenic: both ↓CO, ↑SVR — key difference is PCWP (↓ in hypovolemic, ↑↑ in cardiogenic)</li>
      <li><b>Beck's Triad</b> (tamponade) = Hypotension + JVD + Muffled heart sounds → <b>pericardiocentesis</b></li>
      <li><b>Tension PTX</b> = absent breath sounds + tracheal deviation AWAY + JVD → <b>needle decompression 2nd ICS MCL</b></li>
      <li>1st-line vasopressor for septic shock = <b>NOREPINEPHRINE</b> (dopamine → ↑arrhythmias, ↑mortality)</li>
      <li>1st-line for anaphylaxis = <b>IM EPINEPHRINE (thigh)</b> — NOT antihistamines or steroids first</li>
      <li>Lactate &gt;4 mmol/L <b>OR</b> base deficit &lt; −4 mEq/L = presumptive shock regardless of BP</li>
      <li><b>Neurogenic shock</b> = hypotension + <b>BRADYCARDIA</b> (all other types → tachycardia)</li>
      <li>Cardiogenic shock post-MI: SBP &lt;90 + CI &lt;2.2 L/min/m² + <b>PCWP &gt;18 mmHg</b></li>
      <li>Urine output &lt;0.5 mL/kg/h = severe renal hypoperfusion in any shock state</li>
      <li><b>SOFA ↑ ≥2</b> from baseline = sepsis; add vasopressor need + lactate &gt;2 mmol/L = <b>septic shock</b></li>
    </ul>
  </div>

  <div class="footer">
    Sources: Robbins, Cotran &amp; Kumar (10e) | Harrison's Principles of Internal Medicine (22e) | Rosen's Emergency Medicine |
    Goldman-Cecil Medicine | Sabiston &amp; Schwartz Surgery | For educational use only
  </div>

</div>
</body>
</html>
Save as: shock_notes.html → open in any browser → Ctrl+PSave as PDF

Link to pdf

Running Command

which wkhtmltopdf; which chromium; which chromium-browser; which google-chrome; which weasyprint; python3 -c "import weasyprint; print('weasyprint ok')" 2>&1

Running Command

chromium --headless --no-sandbox --disable-gpu --print-to-pdf=/home/daytona/workspace/cpr-guide/Shock_Notes_USMLE.pdf --print-to-pdf-no-header "file:///home/daytona/workspace/cpr-guide/shock_notes.html" 2>&1

PDF generated successfully (513 KB, full fidelity from the HTML). Here it is:

Shock Notes USMLE

PDF Document · PDF

This was rendered by Chromium directly from the styled HTML, so it looks exactly like the web version — color-coded sections, comparison chart, pearls table, and all. Let me know if you need any changes!

Not able to download pdf

It seems file downloads aren't working in your current environment. The most reliable workaround is to use the HTML I already gave you. Here's exactly what to do:

3 steps — works on any device:
Step 1 — Copy the HTML code I pasted earlier in this chat (the big block starting with <!DOCTYPE html>)
Step 2 — Paste it into any free online tool:
  • Go to htmledit.squarefree.com or
  • Go to codepen.io/pen (paste into the HTML box) or
  • Simply open Notepad (Windows) / TextEdit (Mac), paste, and save as shock_notes.html, then double-click to open in your browser
Step 3 — Press Ctrl+P (Windows) or Cmd+P (Mac) → change destination to "Save as PDF" → Save

Alternatively, if you're on a phone or tablet:

Would you like me to try a different approach entirely — such as generating a Google Docs link or breaking the notes into plain formatted text you can paste directly into Word or Google Docs?

Portal htn and symptoms explained with diagram

Reading File
Finding Sources
Generating Image

Medical diagram of portal hypertension showing the portal venous system anatomy. Include: liver with cirrhosis/fibrosis, portal vein, superior mesenteric vein, splenic vein, inferior mesenteric vein. Show portosystemic collateral vessels with arrows indicating blood flow direction: esophageal varices at gastroesophageal junction, caput medusae at umbilicus, hemorrhoids at rectum, and splenorenal shunt. Label normal portal pressure (5-10 mmHg) and hypertensive pressure (>12 mmHg). Show splenomegaly. Use color-coded arrows: red for high pressure portal blood, blue for collateral bypass routes. Clean anatomical illustration style with clear labels.

Reading File
Reading File
Finding Sources
Reading File
Reading File
Loading Image
Reading File
Finding Sources
Excellent content from multiple authoritative textbooks. Now I have everything needed for a comprehensive answer.
Here is the generated anatomical diagram, followed by full notes:
Portal Hypertension - Portosystemic Collaterals Diagram
And here is the pathophysiology flowchart from Sleisenger & Fordtran's Gastrointestinal and Liver Disease:
Pathophysiology of ascites and renal dysfunction in advanced cirrhosis - showing how portal hypertension → splanchnic vasodilation → reduced effective arterial blood volume → RAAS/SNS activation → ascites, dilutional hyponatremia, and hepatorenal syndrome

Portal Hypertension

Definition

Portal hypertension is defined as a hepatic venous pressure gradient (HVPG) above 10-12 mmHg (normal: up to 5 mmHg). Clinically significant portal hypertension - the threshold at which complications like ascites develop - is an HVPG >10-12 mmHg. HVPG >20 mmHg is associated with treatment failure and death in acute variceal bleeding. - Sleisenger & Fordtran's, p. 1797

Classification by Anatomical Site

CategorySite of ObstructionExamples
PrehepaticPortal vein before liverPortal vein thrombosis (PVT), splenic vein thrombosis, AV fistula
IntrahepaticWithin liver (most common)Cirrhosis (sinusoidal), schistosomiasis (presinusoidal), veno-occlusive disease (postsinusoidal)
PosthepaticHepatic veins or beyondBudd-Chiari syndrome, right heart failure, constrictive pericarditis
Intrahepatic portal hypertension can be further subdivided as presinusoidal, sinusoidal, or postsinusoidal. Cirrhosis = sinusoidal type (most common overall). - Yamada's Textbook of Gastroenterology; Frameworks for Internal Medicine

Pathophysiology

Step 1 - Increased Intrahepatic Resistance

Cirrhosis causes:
  • Progressive collagen deposition and nodule formation → architectural distortion of sinusoidal blood flow
  • Passive (structural) resistance: fibrotic tissue physically obstructs portal flow
  • Dynamic (functional) resistance: activated hepatic stellate cells contract; imbalance between intrahepatic vasodilators (nitric oxide - NO) and vasoconstrictors; despite overproduction of NO in the splanchnic bed, intrahepatic NO is paradoxically reduced

Step 2 - Splanchnic Arterial Vasodilation

Portal hypertension triggers release of vasodilating mediators (NO, carbon monoxide, endocannabinoids) into the splanchnic circulation:
  • Splanchnic arteries dilate → ↓ systemic vascular resistance
  • Blood pools in the splanchnic bed → reduced effective arterial blood volume (EABV)

Step 3 - Compensatory Neurohormonal Activation

The fall in EABV activates:
  • RAAS (renin-angiotensin-aldosterone system) → sodium and water retention
  • SNS (sympathetic nervous system) → renal vasoconstriction
  • ADH/vasopressin (at later stages) → free water retention

Step 4 - Complications

As shown in the flowchart above, these activated systems cause:
  • Sodium retention → Ascites
  • Free water retention → Dilutional hyponatremia
  • Renal vasoconstriction → Hepatorenal syndrome (HRS)
  • Bacterial translocation (PAMPs from gut) → systemic inflammation → worsens circulatory dysfunction

Portosystemic Collaterals — Where Blood Bypasses the Liver

When portal pressure rises, blood is forced through pre-existing anastomoses between the portal and systemic venous systems. These dilate and become clinically visible:
SiteCollateral VesselClinical Consequence
Lower esophagus / gastric cardiaLeft gastric (coronary) vein ↔ azygos veinEsophageal & gastric varices → life-threatening hemorrhage
UmbilicusParaumbilical veins ↔ epigastric veinsCaput medusae (dilated veins radiating from umbilicus)
RectumSuperior rectal vein ↔ middle/inferior rectal veinsHemorrhoids (anorectal varices)
RetroperitoneumMesenteric veins ↔ retroperitoneal veinsRetroperitoneal varices (Retzius veins)
Spleen → left renal veinSplenic vein ↔ left renal veinSplenorenal shunt

Clinical Features and Symptoms

1. Esophageal / Gastric Varices

  • Dilated submucosal veins at the gastroesophageal junction
  • Rupture → massive hematemesis - most dangerous complication; mortality 20-30% per episode
  • Signs: hematemesis, melena, hemodynamic instability

2. Ascites

  • Mechanism: portal hypertension → splanchnic vasodilation → reduced EABV → RAAS activation → sodium retention → fluid transudation into peritoneum
  • Starling forces promote filtration when capillary hydrostatic pressure rises
  • Serum-ascites albumin gradient (SAAG) ≥1.1 g/dL confirms portal hypertension as the cause
  • Fluid is a transudate: protein <3 g/dL
  • Complication: Spontaneous bacterial peritonitis (SBP)

3. Splenomegaly + Hypersplenism

  • Congestion of splenic sinusoids from back-pressure
  • Results in pancytopenia: anemia, thrombocytopenia, leukopenia (sequestration)
  • Thrombocytopenia is often the first lab clue to portal hypertension

4. Hepatic Encephalopathy

  • Portal blood bypasses the liver through collaterals → toxins (especially ammonia, NH₃) that are normally cleared by the liver enter systemic circulation
  • NH₃ crosses blood-brain barrier → astrocyte swelling, neurotransmitter disruption → altered consciousness
  • Spectrum: subtle personality changes → asterixis → stupor → coma

5. Caput Medusae

  • Dilated periumbilical veins visible on the abdominal wall, radiating outward like "Medusa's head"
  • Blood flows away from umbilicus (differentiates from IVC obstruction where flow is upward)

6. Hepatorenal Syndrome (HRS)

  • Extreme renal vasoconstriction from maximal activation of RAAS, SNS, and vasopressin
  • Functional renal failure in the absence of intrinsic kidney disease
  • Urine sodium very low (<10 mEq/L); kidney histology is normal

7. Hepatopulmonary Syndrome / Portopulmonary Hypertension

  • Pulmonary vascular dilation (hepatopulmonary) or pulmonary arterial hypertension (portopulmonary)
  • Presents with dyspnea, platypnea (breathlessness when upright, improved when lying flat), hypoxia

8. Other Signs of Chronic Liver Disease (Seen Together)

  • Spider naevi, palmar erythema, gynecomastia (↑ estrogen from ↓ liver clearance)
  • Jaundice, coagulopathy (↓ clotting factor synthesis), hypoalbuminemia (↓ protein synthesis)
  • Leukonychia (white nails), clubbing, Dupuytren's contracture

Key Numbers (USMLE/Exam)

ParameterValue
Normal portal pressure (HVPG)<5 mmHg
Portal hypertension definedHVPG >5 mmHg
Clinically significant (complications develop)HVPG >10-12 mmHg
High mortality riskHVPG >16 mmHg
Variceal bleeding treatment failure riskHVPG >20 mmHg
SAAG confirming portal hypertension≥1.1 g/dL
Ascites protein (transudate)<3 g/dL

Management Overview

ComplicationTreatment
Variceal bleeding (acute)Octreotide (↓ splanchnic blood flow) + endoscopic band ligation + prophylactic antibiotics
Variceal bleeding (prevention)Non-selective beta-blockers (propranolol/nadolol/carvedilol); band ligation
Refractory / recurrent varicesTIPS (transjugular intrahepatic portosystemic shunt) or surgical distal splenorenal shunt
AscitesSodium restriction + spironolactone ± furosemide; large-volume paracentesis + albumin for refractory
SBPCefotaxime; prophylaxis with norfloxacin/ciprofloxacin
Hepatic encephalopathyLactulose (reduces ammonia); rifaximin (reduces gut bacteria)
HRSTerlipressin + albumin; TIPS; liver transplant (definitive)
Definitive cureLiver transplantation
Sources: Sleisenger & Fordtran's Gastrointestinal and Liver Disease | Medical Physiology (Boron & Boulpaep) | Frameworks for Internal Medicine | Yamada's Textbook of Gastroenterology | Washington Manual of Medical Therapeutics
This is a shared conversation. Sign in to Orris to start your own chat.