Clotting factor and there main causes

Reading File
Finding Sources
Searching Images

coagulation cascade clotting factors diagram

Summary : This diagram illustrates the traditional coagulation cascade, detailing the sequence of events and factors involved in blood clotting via the intrinsic, extrinsic, and common pathways.

flowchart:
# Pathways :
  • Intrinsic pathway (green box): Initiated by factor XII, proceeds through XI, IX, and VIII, with activation steps indicated by "a" (e.g., XIIa, XIa, IXa).
  • Extrinsic pathway (red box): Initiated by tissue damage, which activates tissue factor (TF) and factor VIIa.
  • Common pathway (blue box): Both intrinsic and extrinsic pathways converge at factor X, leading to the activation of prothrombin to thrombin, which then converts fibrinogen to fibrin, forming a fibrin clot.

# Nodes :
  • XII → XIIa (Intrinsic)
  • XI → XIa (Intrinsic)
  • IX → IXa (Intrinsic)
  • Ca²⁺, PT, V (Intrinsic, Common)
  • TF/VIIa (Extrinsic)
  • Tissue damage (Extrinsic)
  • X → Xa (Common)
  • Prothrombin → Thrombin (Common)
  • Fibrinogen → Fibrin (Common)
  • XIII (Common)
  • Fibrin clot (Common)

# Connectors :
  • Arrows indicate the direction of activation or conversion between factors.
  • Intrinsic and extrinsic pathways both feed into the activation of factor X in the common pathway.
  • Ca²⁺ and PT, V are required cofactors at specific steps.

# Layout :
  • Three main colored sections: green (intrinsic, top left), red (extrinsic, top right), blue (common, bottom).
  • Flow proceeds from top (initiation) to bottom (clot formation).
  • Arrows show sequential activation and convergence of pathways.

# Analysis :
  • The diagram clearly separates the intrinsic and extrinsic initiation mechanisms, both converging on the common pathway at factor X.
  • The cascade is highly sequential, with each activated factor catalyzing the next step.
  • Calcium ions (Ca²⁺) and phospholipids (PT) are essential cofactors at multiple steps.
  • The final outcome is the formation of a stable fibrin clot, highlighting the coordinated nature of the coagulation process.

Summary : This diagram illustrates the traditional coagulation cascade, detailing the sequence of events and factors involved in blood clotting via the intrinsic, extrinsic, and common pathways. flowchart: # Pathways : • Intrinsic pathway (green box): Initiated by factor XII, proceeds through XI, IX, and VIII, with activation steps indicated by "a" (e.g., XIIa, XIa, IXa). • Extrinsic pathway (red box): Initiated by tissue damage, which activates tissue factor (TF) and factor VIIa. • Common pathway (blue box): Both intrinsic and extrinsic pathways converge at factor X, leading to the activation of prothrombin to thrombin, which then converts fibrinogen to fibrin, forming a fibrin clot. # Nodes : • XII → XIIa (Intrinsic) • XI → XIa (Intrinsic) • IX → IXa (Intrinsic) • Ca²⁺, PT, V (Intrinsic, Common) • TF/VIIa (Extrinsic) • Tissue damage (Extrinsic) • X → Xa (Common) • Prothrombin → Thrombin (Common) • Fibrinogen → Fibrin (Common) • XIII (Common) • Fibrin clot (Common) # Connectors : • Arrows indicate the direction of activation or conversion between factors. • Intrinsic and extrinsic pathways both feed into the activation of factor X in the common pathway. • Ca²⁺ and PT, V are required cofactors at specific steps. # Layout : • Three main colored sections: green (intrinsic, top left), red (extrinsic, top right), blue (common, bottom). • Flow proceeds from top (initiation) to bottom (clot formation). • Arrows show sequential activation and convergence of pathways. # Analysis : • The diagram clearly separates the intrinsic and extrinsic initiation mechanisms, both converging on the common pathway at factor X. • The cascade is highly sequential, with each activated factor catalyzing the next step. • Calcium ions (Ca²⁺) and phospholipids (PT) are essential cofactors at multiple steps. • The final outcome is the formation of a stable fibrin clot, highlighting the coordinated nature of the coagulation process.

This pathophysiology diagram illustrates the coagulation cascade focusing on the central role of Factor XI (FXI) in venous thromboembolism. The visual depicts an inflamed/injured endothelial layer at the base, leading to the activation of the contact pathway (via FXII and NETs) and the extrinsic pathway (via Tissue Factor and FVII). Key clotting factors, including FXII, FXI, FIX, FX, and Thrombin, are shown as oval nodes interconnected by arrows representing biochemical activation. A highlighted pink box focuses on the conversion of FXI to FXIa, noting pharmacologic inhibitors like Abelacimab, FXI-ASO, and Milvexian. The diagram differentiates between resting and activated platelets and includes an icon for venous thromboembolism featuring pulmonary embolism and deep vein thrombosis. Dark brown arrows indicate pathways unaffected by FXI inhibition, while lighter grey arrows signify the attenuated thrombin formation pathway. This educational material is designed for medical students and clinicians studying hematology, pharmacology, and cardiovascular medicine.

This pathophysiology diagram illustrates the coagulation cascade focusing on the central role of Factor XI (FXI) in venous thromboembolism. The visual depicts an inflamed/injured endothelial layer at the base, leading to the activation of the contact pathway (via FXII and NETs) and the extrinsic pathway (via Tissue Factor and FVII). Key clotting factors, including FXII, FXI, FIX, FX, and Thrombin, are shown as oval nodes interconnected by arrows representing biochemical activation. A highlighted pink box focuses on the conversion of FXI to FXIa, noting pharmacologic inhibitors like Abelacimab, FXI-ASO, and Milvexian. The diagram differentiates between resting and activated platelets and includes an icon for venous thromboembolism featuring pulmonary embolism and deep vein thrombosis. Dark brown arrows indicate pathways unaffected by FXI inhibition, while lighter grey arrows signify the attenuated thrombin formation pathway. This educational material is designed for medical students and clinicians studying hematology, pharmacology, and cardiovascular medicine.

A multi-panel pathophysiology diagram illustrating the mechanism of action of oral anticoagulants on the coagulation cascade. The top panel shows a linear pathway: the liver produces functional clotting factors, which undergo coagulation to become activated clotting factors (Xa and IIa/thrombin), ultimately leading to fibrin formation. Vitamin K antagonists (VKA) are shown inhibiting the liver's production of functional factors, while non-vitamin K antagonist oral anticoagulants (NOACs) inhibit the activated factors. The bottom-left panel details the biochemical mechanism of VKAs, showing they inhibit the glutamyl carboxylase and vitamin K-dependent conversion of glutamyl residues on protein precursors into carboxy-glutamyl residues on completed clotting proteins. The bottom-right panel provides a molecular-level view of NOAC action, depicting thrombin (orange sphere) and factor Xa (yellow head with blue tail) being inhibited at their respective active sites (indicated by grey coloring). This educational graphic highlights the distinction between indirect synthesis inhibition by VKAs and direct enzymatic inhibition by NOACs/DOACs.

A multi-panel pathophysiology diagram illustrating the mechanism of action of oral anticoagulants on the coagulation cascade. The top panel shows a linear pathway: the liver produces functional clotting factors, which undergo coagulation to become activated clotting factors (Xa and IIa/thrombin), ultimately leading to fibrin formation. Vitamin K antagonists (VKA) are shown inhibiting the liver's production of functional factors, while non-vitamin K antagonist oral anticoagulants (NOACs) inhibit the activated factors. The bottom-left panel details the biochemical mechanism of VKAs, showing they inhibit the glutamyl carboxylase and vitamin K-dependent conversion of glutamyl residues on protein precursors into carboxy-glutamyl residues on completed clotting proteins. The bottom-right panel provides a molecular-level view of NOAC action, depicting thrombin (orange sphere) and factor Xa (yellow head with blue tail) being inhibited at their respective active sites (indicated by grey coloring). This educational graphic highlights the distinction between indirect synthesis inhibition by VKAs and direct enzymatic inhibition by NOACs/DOACs.

Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Here is a thorough, textbook-sourced breakdown of all clotting factors and the main causes of their deficiency:

Clotting Factors and Their Main Causes of Deficiency

Coagulation Cascade Diagram

Overview of the Coagulation System

The coagulation cascade has three pathways:
  • Intrinsic pathway: Factors XII → XI → IX → VIII
  • Extrinsic pathway: Tissue damage → Tissue Factor + Factor VII
  • Common pathway: Factor X → V → II (Prothrombin → Thrombin) → I (Fibrinogen → Fibrin) → XIII (cross-links fibrin)

All 13 Clotting Factors and Their Main Causes of Deficiency

FactorNameMain Causes of Deficiency
IFibrinogenLiver disease (decreased synthesis), DIC (consumption), hereditary afibrinogenemia/hypofibrinogenemia, massive transfusion
IIProthrombinVitamin K deficiency, liver disease, warfarin therapy, hereditary (very rare)
IIITissue Factor (Thromboplastin)Not a plasma factor - expressed on cell surfaces; not classically "deficient"
IVCalcium (Ca²⁺)Not a protein factor; severe hypocalcemia (rare in clinical bleeding context)
VLabile Factor / ProaccelerinLiver disease, DIC (consumption), rare hereditary deficiency (parahemophilia); not vitamin K-dependent
VI(Obsolete - same as activated Factor V)-
VIIProconvertinVitamin K deficiency, warfarin therapy (shortest half-life ~6 hrs - first to fall), liver disease, rare hereditary deficiency
VIIIAntihemophilic FactorHemophilia A (X-linked recessive, most common hereditary coagulation defect); DIC; acquired via autoantibody (acquired hemophilia)
IXChristmas FactorHemophilia B (X-linked recessive, "Christmas disease"); vitamin K deficiency; liver disease; DIC
XStuart-Prower FactorVitamin K deficiency, liver disease, DIC, AL amyloidosis (rare specific association), hereditary deficiency
XIPlasma Thromboplastin Antecedent (PTA)Hemophilia C (autosomal recessive, more common in Ashkenazi Jews); acquired autoantibody
XIIHageman FactorHereditary deficiency (usually asymptomatic - paradoxically associated with thrombosis); severe deficiency is very rare
XIIIFibrin-Stabilizing FactorHereditary (autosomal recessive), liver disease, DIC, inhibitory autoantibodies, isoniazid use

Major Causes Grouped by Mechanism

1. Vitamin K Deficiency

Vitamin K is required for gamma-carboxylation of factors II, VII, IX, X, as well as protein C and protein S (anticoagulants).
Causes of vitamin K deficiency:
  • Poor dietary intake (especially in newborns - "hemorrhagic disease of the newborn")
  • Malabsorption syndromes (cholestasis, Crohn's disease, celiac disease) - vitamin K is fat-soluble
  • Broad-spectrum antibiotic use (destroys gut flora that synthesize vitamin K2)
  • Warfarin therapy (blocks vitamin K recycling)
"Vitamin K is required for the synthesis of prothrombin and clotting factors VII, IX, and X, and its deficiency causes a severe coagulation defect." - Robbins & Kumar Basic Pathology

2. Liver Disease

The liver synthesizes all coagulation factors except Factor VIII (which is made by endothelial cells). Liver failure causes:
  • Decreased synthesis of factors I, II, V, VII, IX, X, XI
  • Secondary vitamin K deficiency (due to cholestasis or poor absorption)
  • Thrombocytopenia (splenic sequestration from portal hypertension)
  • DIC (impaired clearance of activated factors)
"Many coagulation factors are made in the liver, and inadequate synthesis is often observed in severe parenchymal liver disease." - Robbins, Cotran & Kumar Pathologic Basis of Disease

3. Hereditary (Congenital) Deficiencies

These typically affect a single factor:
DisorderFactorInheritanceKey Features
Hemophilia AVIIIX-linked recessiveMost common hereditary coagulopathy; hemarthrosis, deep muscle hematomas
Hemophilia BIXX-linked recessiveClinically identical to Hemophilia A; "royal family disease"
Hemophilia CXIAutosomal recessiveMilder bleeding; common in Ashkenazi Jews
von Willebrand DiseasevWF (stabilizes Factor VIII)Usually autosomal dominantMost common hereditary bleeding disorder (up to 1% prevalence)
AfibrinogenemiaIAutosomal recessiveSevere bleeding from birth
Factor XIII deficiencyXIIIAutosomal recessiveNormal PT/PTT but poor clot stability; umbilical stump bleeding in neonates
"The most common and important inherited deficiencies of coagulation factors affect factor VIII (hemophilia A) and factor IX (hemophilia B)." - Robbins, Cotran & Kumar Pathologic Basis of Disease
"The most common hereditary bleeding disorder is von Willebrand disease, with a prevalence of up to 1% of the population." - Harper's Illustrated Biochemistry, 32nd Ed

4. Disseminated Intravascular Coagulation (DIC)

DIC causes consumption of multiple factors simultaneously (especially I, II, V, VIII, XIII) due to widespread pathological clotting. Common triggers:
  • Sepsis (most common)
  • Obstetric emergencies (abruptio placentae, amniotic fluid embolism)
  • Malignancy
  • Massive trauma
  • Transfusion reactions

5. Acquired Inhibitors (Autoantibodies)

Rare but important - inhibitory IgG antibodies against specific factors:
  • Acquired Hemophilia A: Anti-Factor VIII antibodies; occurs in elderly, postpartum, or with malignancy/autoimmune disease
  • Can occur against Factor V, IX, X, XIII
  • Associated with AL amyloidosis: specific Factor X deficiency due to adsorption onto amyloid fibrils

Quick Diagnostic Test Reference

TestWhat It MeasuresProlonged In
PT (Prothrombin Time)Extrinsic + Common pathway (Factors VII, X, V, II, I)Liver disease, vitamin K deficiency, warfarin, DIC
aPTTIntrinsic + Common pathway (Factors XII, XI, IX, VIII, X, V, II, I)Hemophilia A/B, heparin, DIC, lupus anticoagulant
Thrombin TimeFibrinogen → Fibrin conversionAfibrinogenemia, heparin, direct thrombin inhibitors
PT + aPTT both prolongedCommon pathway / multiple factorsDIC, severe liver disease, vitamin K deficiency

Key clinical memory aids:
  • "1972" rule for vitamin K-dependent factors: II, VII, IX, X (with Protein C and S)
  • Factor VII has the shortest half-life (~6 hrs) - PT prolongs first in warfarin or liver disease
  • Factor VIII is NOT vitamin K-dependent and NOT made by the liver (so it may be normal or even elevated in liver disease)
  • Hemophilia A and B are clinically identical but distinguished by specific factor assays

Generate a clinical decision flowchart for bleeding disorders

Generating Image

Clinical decision flowchart for bleeding disorders diagnosis. Professional medical flowchart with the following structure: START: "Patient presents with BLEEDING" (red box at top) Step 1: "History & Physical Exam" - assess: onset (congenital vs acquired), location (mucocutaneous vs deep), family history, medications Branch A: "Mucocutaneous bleeding" (petechiae, purpura, epistaxis, gum bleeding, menorrhagia) → suggests platelet or vascular disorder Branch B: "Deep bleeding" (hemarthrosis, muscle hematomas, post-surgical ooze) → suggests coagulation factor deficiency LABS BOX: "Initial Lab Workup: CBC + Platelet count, PT, aPTT, Thrombin Time, Peripheral smear" From Labs, 4 pathways: 1. Low platelets → "Thrombocytopenia workup" → subdivide: Immune (ITP), Drug-induced, DIC, TTP/HUS, Bone marrow failure 2. Prolonged PT only → "Factor VII deficiency / Early Vitamin K deficiency / Warfarin" 3. Prolonged aPTT only → "Factors VIII, IX, XI deficiency" → "Hemophilia A (VIII), Hemophilia B (IX), Hemophilia C (XI), vWD" 4. Both PT + aPTT prolonged → "DIC / Severe Liver Disease / Vitamin K Deficiency / Massive transfusion" If normal PT, aPTT, platelets → "Consider: vWD (check vWF antigen & activity), Platelet function defect (PFA-100), Factor XIII deficiency" Bottom boxes for each diagnosis showing key treatment: - Hemophilia A → Factor VIII concentrate - Hemophilia B → Factor IX concentrate - Vitamin K deficiency → Vitamin K supplementation - DIC → Treat underlying cause + FFP + Cryoprecipitate - vWD → DDAVP or vWF concentrate - ITP → Steroids / IVIG / Anti-D Color coding: Red for start/emergency, Blue for lab results, Green for diagnoses, Orange for treatment. Clean white background, professional medical style with clear arrows and boxes.

Clinical Decision Flowchart for Bleeding Disorders
Here is a summary of how to navigate this flowchart:

How to Use This Flowchart

Step 1 - History & Physical

The first branch is clinical: where is the bleeding?
  • Mucocutaneous (petechiae, purpura, gum bleeding, epistaxis, menorrhagia) → think platelet or vascular problem
  • Deep tissue (hemarthrosis, muscle hematomas, post-op ooze) → think coagulation factor deficiency

Step 2 - Initial Labs (always order together)

  • CBC + platelet count
  • PT (Prothrombin Time)
  • aPTT (Activated Partial Thromboplastin Time)
  • Thrombin Time
  • Peripheral blood smear

Step 3 - Interpret the Pattern

Lab PatternThink
Low platelets onlyITP, drug-induced, DIC, TTP/HUS, bone marrow failure
PT prolonged, aPTT normalFactor VII deficiency, early warfarin, early vitamin K deficiency, liver disease
aPTT prolonged, PT normalHemophilia A (VIII), Hemophilia B (IX), Hemophilia C (XI), vWD, heparin
Both PT + aPTT prolongedDIC, severe liver disease, vitamin K deficiency, massive transfusion
All normalvon Willebrand disease (type 1), platelet function defect, Factor XIII deficiency

Step 4 - Treatment by Diagnosis

  • Hemophilia A → Factor VIII concentrate / emicizumab
  • Hemophilia B → Factor IX concentrate
  • vWD → DDAVP (type 1) or vWF concentrate
  • Vitamin K deficiency → IV/oral vitamin K
  • DIC → Treat underlying cause + FFP + cryoprecipitate
  • ITP → Steroids, IVIG, anti-D, TPO agonists

I need you to make it simple pathway for all clotting factor and machanism and action and sight and disorders in one chart

Generating Image

A comprehensive, clean, color-coded medical reference chart titled "CLOTTING FACTORS: Complete Reference Chart" on white background. Professional textbook style. Organized in three horizontal sections: TOP SECTION - "THE COAGULATION CASCADE" pathway diagram: Left column labeled INTRINSIC PATHWAY (Contact Activation) in dark blue box: XII (Hageman) → XIIa → XI (PTA) → XIa → IX (Christmas) → IXa → [with VIII (AHF) as cofactor + Ca2+ + Phospholipid] → activates X Right column labeled EXTRINSIC PATHWAY (Tissue Factor) in dark red box: Tissue Damage → III (Tissue Factor) → [with VII (Proconvertin) + Ca2+] → VIIa → activates X Center bottom labeled COMMON PATHWAY in purple box: X (Stuart-Prower) → Xa → [with V (Labile Factor) + Ca2+ + Phospholipid] → II (Prothrombin) → Thrombin (IIa) → I (Fibrinogen) → Fibrin → [XIII (Fibrin Stabilizing)] → Stable Fibrin Clot MIDDLE SECTION - Factor table with 5 columns: Factor | Name | Site of Action | Mechanism | Associated Disorder Row 1: I | Fibrinogen | Common | Converted to fibrin by thrombin | Afibrinogenemia, DIC Row 2: II | Prothrombin | Common | Converted to thrombin by Xa+Va | Vitamin K deficiency, liver disease Row 3: III | Tissue Factor | Extrinsic | Cofactor for VII activation | - Row 4: IV | Calcium Ca2+ | All pathways | Bridges factors to phospholipids | Hypocalcemia (rare) Row 5: V | Labile Factor | Common | Cofactor: accelerates Xa | Parahemophilia, liver disease, DIC Row 6: VII | Proconvertin | Extrinsic | Activates X via TF complex | Vitamin K deficiency (first to drop), warfarin Row 7: VIII | Antihemophilic | Intrinsic | Cofactor: amplifies IXa activity | HEMOPHILIA A (X-linked) Row 8: IX | Christmas Factor | Intrinsic | Serine protease activates X | HEMOPHILIA B (X-linked) Row 9: X | Stuart-Prower | Common | Activates prothrombin | Vitamin K deficiency, amyloidosis Row 10: XI | PTA | Intrinsic | Activates IX | HEMOPHILIA C (autosomal) Row 11: XII | Hageman | Intrinsic | Contact activation, activates XI | Deficiency → thrombosis risk Row 12: XIII | Fibrin Stabilizing | Common | Cross-links fibrin strands | Factor XIII deficiency (umbilical bleeding) BOTTOM SECTION - Three color boxes side by side: Box 1 (yellow) "VITAMIN K DEPENDENT FACTORS": II, VII, IX, X, Protein C, Protein S — Affected by: Warfarin, liver disease, malabsorption, newborns (HDN) Box 2 (orange) "LIVER SYNTHESIZED FACTORS": I, II, V, VII, IX, X, XI, XII, XIII — NOT Factor VIII (endothelial cells) Box 3 (red) "DIC - ALL CONSUMED": I, II, V, VIII, XIII — Triggers: Sepsis, obstetric emergency, malignancy, trauma Small legend at bottom: Blue = Intrinsic, Red = Extrinsic, Purple = Common, Green = Cofactors Very clean, professional, easy to read, medical school reference chart style, all text clearly readable, organized layout with clear borders and arrows

Clotting Factors Complete Reference Chart
Here is a quick-reference summary of everything in this chart:

Chart Breakdown

Coagulation Cascade (Top)

  • Intrinsic pathway (blue): XII → XI → IX → VIII → activates X
  • Extrinsic pathway (red): Tissue damage → III + VII → activates X
  • Common pathway (purple): X + V → II (Thrombin) → I (Fibrin) → XIII (stable clot)

Factor-by-Factor Summary

FactorNameKey RoleMain Disorder
IFibrinogenClot scaffoldDIC, afibrinogenemia
IIProthrombinBecomes thrombinVitamin K deficiency, liver disease
IIITissue FactorTriggers extrinsic-
IVCalciumBridges factorsHypocalcemia (rare)
VLabile FactorCofactor for XaParahemophilia, DIC
VIIProconvertinExtrinsic activationFirst to fall in warfarin/liver disease
VIIIAntihemophilicAmplifies IXaHemophilia A (X-linked)
IXChristmasActivates XHemophilia B (X-linked)
XStuart-ProwerActivates prothrombinVitamin K deficiency, amyloidosis
XIPTAActivates IXHemophilia C (autosomal)
XIIHagemanContact activationDeficiency → thrombosis risk
XIIIFibrin-stabilizingCross-links fibrinUmbilical stump bleeding in neonates

Three Critical Groups (Bottom)

  • Vitamin K-dependent: II, VII, IX, X (+ Protein C & S) - affected by warfarin, liver disease, HDN
  • Liver-synthesized: All except Factor VIII (made by endothelial cells)
  • Consumed in DIC: I, II, V, VIII, XIII - triggered by sepsis, obstetric emergencies, malignancy

Generate a clinical scenarios document (warfarin overdose, DIC, hemophilia management)

Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Reading File
Running Command

mkdir -p /tmp/workspace/bleeding-disorders && ls /tmp/workspace/bleeding-disorders/

Writing File

~/bleeding-disorders/build_doc.py

from docx import Document
from docx.shared import Pt, Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
import copy

doc = Document()

# ── Page margins ──────────────────────────────────────────────────
for section in doc.sections:
    section.top_margin    = Inches(1.0)
    section.bottom_margin = Inches(1.0)
    section.left_margin   = Inches(1.2)
    section.right_margin  = Inches(1.2)

# ── Default style ─────────────────────────────────────────────────
normal = doc.styles["Normal"]
normal.font.name = "Calibri"
normal.font.size = Pt(11)

# ── Helper: coloured heading ──────────────────────────────────────
def add_colored_heading(doc, text, level, r, g, b):
    p = doc.add_heading(text, level=level)
    p.alignment = WD_ALIGN_PARAGRAPH.LEFT
    for run in p.runs:
        run.font.color.rgb = RGBColor(r, g, b)
    return p

# ── Helper: add table with header row ─────────────────────────────
def add_table(doc, headers, rows, col_widths=None):
    table = doc.add_table(rows=1 + len(rows), cols=len(headers))
    table.style = "Table Grid"
    # Header row
    hdr = table.rows[0]
    for i, h in enumerate(headers):
        cell = hdr.cells[i]
        cell.text = h
        for run in cell.paragraphs[0].runs:
            run.bold = True
            run.font.color.rgb = RGBColor(255, 255, 255)
        shading = OxmlElement("w:shd")
        shading.set(qn("w:val"), "clear")
        shading.set(qn("w:color"), "auto")
        shading.set(qn("w:fill"), "2E4057")
        cell._tc.get_or_add_tcPr().append(shading)
        cell.paragraphs[0].alignment = WD_ALIGN_PARAGRAPH.CENTER
    # Data rows
    for ri, row_data in enumerate(rows):
        row = table.rows[ri + 1]
        fill = "F0F4F8" if ri % 2 == 0 else "FFFFFF"
        for ci, val in enumerate(row_data):
            cell = row.cells[ci]
            cell.text = str(val)
            shading = OxmlElement("w:shd")
            shading.set(qn("w:val"), "clear")
            shading.set(qn("w:color"), "auto")
            shading.set(qn("w:fill"), fill)
            cell._tc.get_or_add_tcPr().append(shading)
    if col_widths:
        for i, w in enumerate(col_widths):
            for row in table.rows:
                row.cells[i].width = Inches(w)
    doc.add_paragraph()
    return table

# ── Helper: coloured alert box ────────────────────────────────────
def add_alert(doc, label, text, fill_hex, text_color=(0,0,0)):
    table = doc.add_table(rows=1, cols=1)
    table.style = "Table Grid"
    cell = table.rows[0].cells[0]
    p = cell.paragraphs[0]
    run_label = p.add_run(label + "  ")
    run_label.bold = True
    run_label.font.color.rgb = RGBColor(*text_color)
    run_text = p.add_run(text)
    run_text.font.color.rgb = RGBColor(*text_color)
    shading = OxmlElement("w:shd")
    shading.set(qn("w:val"), "clear")
    shading.set(qn("w:color"), "auto")
    shading.set(qn("w:fill"), fill_hex)
    cell._tc.get_or_add_tcPr().append(shading)
    doc.add_paragraph()

# ── Helper: bullet ────────────────────────────────────────────────
def add_bullet(doc, text, bold_part=""):
    p = doc.add_paragraph(style="List Bullet")
    if bold_part and text.startswith(bold_part):
        run1 = p.add_run(bold_part)
        run1.bold = True
        p.add_run(text[len(bold_part):])
    else:
        p.add_run(text)

# ══════════════════════════════════════════════════════════════════
#  COVER / TITLE
# ══════════════════════════════════════════════════════════════════
title_p = doc.add_paragraph()
title_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
title_run = title_p.add_run("CLINICAL SCENARIOS IN BLEEDING DISORDERS")
title_run.bold = True
title_run.font.size = Pt(22)
title_run.font.color.rgb = RGBColor(46, 64, 87)

sub_p = doc.add_paragraph()
sub_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
sub_run = sub_p.add_run("Warfarin Overdose  ·  Disseminated Intravascular Coagulation  ·  Hemophilia Management")
sub_run.font.size = Pt(13)
sub_run.font.color.rgb = RGBColor(100, 100, 100)
sub_run.italic = True

doc.add_paragraph()

ref_p = doc.add_paragraph()
ref_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
ref_run = ref_p.add_run(
    "Sources: Barash Clinical Anesthesia 9e · Quick Compendium Clinical Pathology 5e · "
    "Harrison's Principles 22e · Tintinalli's Emergency Medicine · Sabiston Textbook of Surgery · "
    "Robbins & Kumar Basic Pathology"
)
ref_run.font.size = Pt(9)
ref_run.font.color.rgb = RGBColor(130, 130, 130)
ref_run.italic = True

doc.add_paragraph()

# Divider line
doc.add_paragraph("─" * 80)
doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════
#  SCENARIO 1 – WARFARIN OVERDOSE
# ══════════════════════════════════════════════════════════════════
add_colored_heading(doc, "SCENARIO 1: Warfarin Overdose", 1, 180, 30, 30)

add_alert(doc,
    "CASE:",
    "A 68-year-old male on warfarin for atrial fibrillation presents to the ED with "
    "haematuria and extensive bruising. INR = 9.2. He is on amoxicillin for a recent "
    "chest infection. BP 110/70, HR 92. No active intracranial or GI bleeding.",
    "FFF3CD")

add_colored_heading(doc, "Background & Mechanism", 2, 46, 64, 87)
doc.add_paragraph(
    "Warfarin is a vitamin K antagonist (VKA). It competes with vitamin K for "
    "carboxylation-binding sites and inhibits hepatic synthesis of vitamin K-dependent "
    "clotting factors II, VII, IX, and X, as well as anticoagulant proteins C and S. "
    "Because proteins C and S have shorter half-lives than most clotting factors, patients "
    "may paradoxically be hypercoagulable during the first 24–48 hours of warfarin initiation. "
    "Therapeutic INR target is usually 2.0–3.0 (higher, 2.5–3.5, for mechanical heart valves)."
)
doc.add_paragraph(
    "In this case, co-prescription of amoxicillin has disrupted gut flora, reducing vitamin K2 "
    "production and dramatically potentiating the anticoagulant effect."
)

add_colored_heading(doc, "Pathophysiology of Supratherapeutic INR", 2, 46, 64, 87)
add_table(doc,
    ["Factor Affected", "Half-Life", "Effect of Warfarin"],
    [
        ["Factor VII", "~6 hours", "First to fall; PT/INR rises early"],
        ["Protein C & S", "~8–12 hours", "Depleted first — initial hypercoagulable state"],
        ["Factor IX", "~24 hours", "Falls with prolonged therapy"],
        ["Factor X", "~36 hours", "Progressive inhibition"],
        ["Factor II (Prothrombin)", "~60–72 hours", "Last to be affected"],
    ],
    col_widths=[1.8, 1.4, 3.2]
)

add_colored_heading(doc, "INR-Based Reversal Protocol", 2, 46, 64, 87)
doc.add_paragraph(
    "Management depends on INR level, bleeding severity, and urgency. "
    "4-factor PCC (factors II, VII, IX, X) is preferred over FFP for urgent reversal. "
    "Vitamin K must be co-administered to sustain reversal (PCC half-life is short)."
)

add_table(doc,
    ["Clinical Situation", "INR", "Recommended Action"],
    [
        ["No bleeding, INR slightly high", "2.0–4.9", "Reduce or hold next dose; no vitamin K needed unless high bleed risk"],
        ["No bleeding, INR significantly elevated", "5.0–8.0", "Hold warfarin; monitor; consider oral Vit K 1–2.5 mg if risk factors"],
        ["No bleeding, INR very high", "> 8.0", "Hold warfarin; give oral vitamin K 5 mg; recheck in 24h"],
        ["Non-major bleeding", "Any elevated", "Hold warfarin; IV vitamin K 1–3 mg; correct INR within 6–8 hours"],
        ["Major/life-threatening bleeding or emergency surgery", "Any elevated", "4-factor PCC (INR 2–4: 25 U/kg; INR 4–6: 35 U/kg; INR >6: 50 U/kg, max 5000 U) PLUS IV vitamin K 5–10 mg"],
        ["PCC unavailable", "Any", "FFP 4–6 units (10–30 mL/kg); risk of TACO; slower and less reliable"],
    ],
    col_widths=[2.4, 0.9, 3.1]
)

add_alert(doc,
    "KEY POINT:",
    "rFVIIa (recombinant Factor VIIa) is NO longer recommended for warfarin reversal — "
    "it corrects INR but does not reliably stop clinical bleeding due to continued inhibition "
    "of factors II, IX, and X. (Barash Clinical Anesthesia 9e)",
    "FFE0E0", (120, 0, 0))

add_colored_heading(doc, "Ongoing Management", 2, 46, 64, 87)
add_bullet(doc, "Identify and remove precipitating factors (antibiotics, dietary changes, interacting drugs)")
add_bullet(doc, "Serial INR monitoring every 6–12 hours until therapeutic range regained")
add_bullet(doc, "When restarting warfarin: consider DOAC switch if recurrent supratherapeutic INR")
add_bullet(doc, "Note: High-dose vitamin K (5–10 mg) may cause warfarin resistance for 1–2 weeks")
add_bullet(doc, "Vitamin K can be given orally, IV, or IM (avoid SC — erratic absorption)")

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════
#  SCENARIO 2 – DIC
# ══════════════════════════════════════════════════════════════════
doc.add_page_break()
add_colored_heading(doc, "SCENARIO 2: Disseminated Intravascular Coagulation (DIC)", 1, 120, 40, 140)

add_alert(doc,
    "CASE:",
    "A 52-year-old female with septic shock secondary to gram-negative bacteraemia. "
    "Day 2 ICU admission. Petechiae spreading across her torso. Labs show: Platelets 45,000/µL, "
    "PT 24s (INR 2.1), aPTT 62s, Fibrinogen 95 mg/dL, D-dimer markedly elevated, "
    "peripheral smear shows schistocytes.",
    "FFF3CD")

add_colored_heading(doc, "Pathophysiology", 2, 120, 40, 140)
doc.add_paragraph(
    "DIC is a syndrome of pathological, systemic activation of the coagulation cascade "
    "triggered by an underlying condition. It is characterised by simultaneous microvascular "
    "thrombosis (consuming clotting factors and platelets) and paradoxical haemorrhage due "
    "to factor depletion and secondary fibrinolysis."
)

add_table(doc,
    ["Phase", "Process", "Clinical Effect"],
    [
        ["Initiation", "Massive tissue factor (TF) release from injured endothelium/monocytes activates extrinsic pathway", "Early hypercoagulable state; microvascular thrombi"],
        ["Amplification", "Thrombin generated in excess; activates factors V, VIII, XI, XIII; stimulates platelets", "Progressive consumption of factors and platelets"],
        ["Consumption", "Fibrinogen, factors I, II, V, VIII, XIII depleted; platelets consumed", "Prolonged PT, aPTT; falling fibrinogen and platelets"],
        ["Fibrinolysis", "Plasmin activated secondary to excess fibrin; degrades fibrin → fibrin degradation products (FDPs/D-dimer)", "Bleeding; elevated D-dimer; schistocytes on smear"],
    ],
    col_widths=[1.5, 3.2, 2.0]
)

add_colored_heading(doc, "Common Triggers", 2, 120, 40, 140)
add_table(doc,
    ["Category", "Examples"],
    [
        ["Infection/Sepsis", "Gram-negative bacteraemia (most common), fungal sepsis, viral (dengue, COVID-19)"],
        ["Obstetric", "Abruptio placentae, amniotic fluid embolism, pre-eclampsia/HELLP, retained dead fetus"],
        ["Malignancy", "Acute promyelocytic leukaemia (APL), mucin-secreting adenocarcinomas"],
        ["Trauma/Surgery", "Massive trauma, burns, major surgery, fat embolism"],
        ["Transfusion", "Incompatible blood transfusion, massive transfusion"],
        ["Vascular", "Giant haemangioma (Kasabach-Merritt), large aortic aneurysm"],
    ],
    col_widths=[2.0, 4.5]
)

add_colored_heading(doc, "Diagnostic Criteria (ISTH DIC Score)", 2, 120, 40, 140)
add_table(doc,
    ["Parameter", "Finding", "Score"],
    [
        ["Platelet count", "> 100,000/µL", "0"],
        ["", "50,000–100,000/µL", "1"],
        ["", "< 50,000/µL", "2"],
        ["Fibrin markers (D-dimer)", "No increase", "0"],
        ["", "Moderate increase", "2"],
        ["", "Strong increase", "3"],
        ["Prolonged PT", "< 3 seconds", "0"],
        ["", "3–6 seconds", "1"],
        ["", "> 6 seconds", "2"],
        ["Fibrinogen", "> 1.0 g/L", "0"],
        ["", "< 1.0 g/L", "1"],
        ["SCORE ≥ 5", "Compatible with overt DIC", "Treat as DIC"],
    ],
    col_widths=[2.0, 3.0, 1.0]
)

add_colored_heading(doc, "Management Protocol", 2, 120, 40, 140)

add_alert(doc,
    "PRIORITY 1 — TREAT THE UNDERLYING CAUSE:",
    "DIC will not resolve without treating the trigger. In sepsis: broad-spectrum antibiotics, "
    "source control, vasopressors as per Surviving Sepsis Guidelines.",
    "E8F4E8")

doc.add_paragraph("Blood product replacement (for bleeding patients):")
add_table(doc,
    ["Product", "Indication/Trigger", "Dose"],
    [
        ["Cryoprecipitate", "Fibrinogen < 150 mg/dL + bleeding", "10 units (raises fibrinogen ~50–75 mg/dL)"],
        ["Fresh Frozen Plasma (FFP)", "Prolonged PT/INR + evidence of bleeding", "10–15 mL/kg (4–6 units typically)"],
        ["Platelet Concentrate", "Platelets ≤ 50 × 10⁹/L + bleeding; ≤ 20 × 10⁹/L prophylaxis", "1 adult therapeutic dose (raises platelets ~25–50k)"],
        ["Packed RBCs", "Hb < 7.0 g/dL (or < 8–9 if haemodynamically unstable)", "Transfuse to maintain Hb > 7 g/dL"],
        ["Vitamin K", "If vitamin K deficiency also suspected (liver disease, poor nutrition)", "5–10 mg IV/oral"],
    ],
    col_widths=[1.8, 3.2, 1.6]
)

doc.add_paragraph("Additional considerations:")
add_bullet(doc, "VTE prophylaxis: LMWH preferred over UFH once active bleeding controlled")
add_bullet(doc, "Heparin therapy: controversial; may be considered in predominant thrombotic DIC (e.g. purpura fulminans, APL) under haematology guidance")
add_bullet(doc, "Antifibrinolytic agents (tranexamic acid): generally AVOIDED in DIC (risk of worsening microvascular thrombosis)")
add_bullet(doc, "Recombinant thrombomodulin or antithrombin: investigational; some evidence in sepsis-induced DIC")
add_bullet(doc, "Up to 35% of septic shock patients meet DIC criteria; associated with significantly increased mortality (Harrison's Principles 22e)")

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════
#  SCENARIO 3 – HEMOPHILIA
# ══════════════════════════════════════════════════════════════════
doc.add_page_break()
add_colored_heading(doc, "SCENARIO 3: Hemophilia Management", 1, 20, 100, 60)

add_alert(doc,
    "CASE:",
    "A 19-year-old male with known severe Hemophilia A (Factor VIII < 1%) presents to the ED "
    "after a fall from a bicycle. He has a swollen, painful right knee (hemarthrosis) and a "
    "severe headache. GCS 15, pupils equal. No visible scalp laceration. He has been self-treating "
    "at home with Factor VIII concentrate. His last dose was 8 hours ago.",
    "FFF3CD")

add_colored_heading(doc, "Background", 2, 20, 100, 60)
doc.add_paragraph(
    "Hemophilia A (Factor VIII deficiency) and Hemophilia B (Factor IX deficiency) are "
    "X-linked recessive disorders causing defective secondary haemostasis. Clinically "
    "identical, they are distinguished only by specific factor assays. Hemophilia A is 4x "
    "more common than Hemophilia B."
)

add_table(doc,
    ["Type", "Factor", "Gene", "Prevalence (males)", "Key Feature"],
    [
        ["Hemophilia A", "VIII", "F8 (186 kb, 26 exons)", "~1 in 5,000", "Most common; gene therapy now in late-phase trials"],
        ["Hemophilia B", "IX", "F9 (33 kb, 8 exons)", "~1 in 30,000", "'Christmas disease'; played role in European royal families"],
        ["Hemophilia C", "XI", "F11", "Autosomal; 1 in 100,000", "Milder bleeding; common in Ashkenazi Jews"],
    ],
    col_widths=[1.4, 0.8, 1.8, 1.5, 2.9]
)

add_colored_heading(doc, "Severity Classification", 2, 20, 100, 60)
add_table(doc,
    ["Severity", "Factor Level", "Clinical Pattern"],
    [
        ["Severe", "< 1% of normal", "Spontaneous bleeding into joints (hemarthrosis) and muscles; most debilitating"],
        ["Moderate", "1–5% of normal", "Bleeding after minor trauma; occasional spontaneous bleeds"],
        ["Mild", "5–40% of normal", "Bleeding only after significant trauma or surgery"],
    ],
    col_widths=[1.4, 1.8, 4.2]
)

add_colored_heading(doc, "Emergency Management Priorities", 2, 20, 100, 60)

add_alert(doc,
    "CRITICAL — INTRACRANIAL HAEMORRHAGE:",
    "Any hemophiliac with head injury or severe headache MUST receive IMMEDIATE factor "
    "replacement BEFORE head CT. Do not delay factor infusion for imaging. Target factor "
    "level 100% for suspected ICH.",
    "FFE0E0", (120, 0, 0))

add_table(doc,
    ["Bleeding Site", "Target Factor Level", "Duration of Treatment"],
    [
        ["Intracranial / life-threatening", "80–100%", "Minimum 14 days; haematology guidance essential"],
        ["Surgery (major)", "80–100% pre-op", "Maintain > 50% until healing complete"],
        ["Haemarthrosis (joint bleed)", "40–60%", "2–3 days; rest joint 4–5 days"],
        ["Muscle haematoma", "40–60%", "3–5 days"],
        ["Iliopsoas haematoma", "80–100%", "Minimum 7 days; high risk of femoral nerve compression"],
        ["Oral/mucosal bleeding", "30–50% + antifibrinolytics", "Until mucosal healing"],
        ["Mild superficial cut", "20–30%", "1–2 days or until haemostasis"],
    ],
    col_widths=[2.4, 1.8, 2.4]
)

add_colored_heading(doc, "Factor Replacement Dosing", 2, 20, 100, 60)
doc.add_paragraph(
    "Dosing formula for Factor VIII (Hemophilia A):"
)
p = doc.add_paragraph()
run = p.add_run("    Units required = Body weight (kg) × Desired % rise × 0.5")
run.bold = True
run.font.size = Pt(12)
run.font.color.rgb = RGBColor(46, 64, 87)

doc.add_paragraph(
    "Rule of thumb: 1 U/kg of Factor VIII raises plasma Factor VIII level by approximately 2%. "
    "(Tintinalli's Emergency Medicine)"
)
doc.add_paragraph()

doc.add_paragraph(
    "Dosing formula for Factor IX (Hemophilia B):"
)
p2 = doc.add_paragraph()
run2 = p2.add_run("    Units required = Body weight (kg) × Desired % rise × 1.0")
run2.bold = True
run2.font.size = Pt(12)
run2.font.color.rgb = RGBColor(46, 64, 87)

add_colored_heading(doc, "Treatment Options", 2, 20, 100, 60)
add_table(doc,
    ["Treatment", "Indication", "Notes"],
    [
        ["Recombinant Factor VIII concentrate", "Hemophilia A — all severities", "First-line; virus-free; extended half-life products available (efmoroctocog alfa, rurioctocog alfa)"],
        ["Recombinant Factor IX concentrate", "Hemophilia B", "Extended half-life: eftrenonacog alfa (fusion protein)"],
        ["DDAVP (desmopressin)", "Mild Hemophilia A only", "Stimulates release of Factor VIII and vWF from endothelial stores; 0.3 mcg/kg IV; NOT effective in severe disease"],
        ["Emicizumab (Hemlibra)", "Hemophilia A ± inhibitors", "Bispecific antibody mimicking Factor VIII; bridges FIXa and FX; given SC weekly/bi-weekly; not a factor replacement"],
        ["FEIBA (Factor VIII Inhibitor Bypass Activity)", "Hemophilia A with inhibitors", "Contains activated factors IIa, VIIa, IXa, Xa; 75 U/kg single dose; bypasses Factor VIII need"],
        ["Recombinant FVIIa (NovoSeven)", "Hemophilia with inhibitors", "Activates extrinsic pathway directly; used when FEIBA unavailable or ineffective"],
        ["Antifibrinolytics (Tranexamic acid)", "Adjunct for mucosal/oral bleeds", "Inhibits fibrinolysis; very useful for dental procedures, epistaxis, menorrhagia"],
        ["Gene therapy", "Severe Hemophilia A & B", "AAV-based; Valoctocogene roxaparvovec (A) and Etranacogene dezaparvovec (B) approved/late trials"],
    ],
    col_widths=[2.0, 2.0, 3.0]
)

add_colored_heading(doc, "Inhibitor Development", 2, 20, 100, 60)
doc.add_paragraph(
    "Up to 30% of severe Hemophilia A patients develop inhibitory IgG autoantibodies against "
    "Factor VIII (inhibitors), rendering standard factor replacement ineffective. Suspect if "
    "usual factor doses fail to achieve expected response."
)
add_bullet(doc, "Low-titre inhibitors (< 5 BU/mL): high-dose Factor VIII may overcome the inhibitor")
add_bullet(doc, "High-titre inhibitors (> 5 BU/mL): use bypassing agents — FEIBA or rFVIIa")
add_bullet(doc, "Long-term immune tolerance induction (ITI): high-dose daily Factor VIII until inhibitor eliminated")
add_bullet(doc, "Emicizumab: effective regardless of inhibitor status — major advance in management")

add_colored_heading(doc, "General Principles in the ED", 2, 20, 100, 60)
add_bullet(doc, "NEVER give IM injections without prior factor replacement")
add_bullet(doc, "NEVER place central lines or arterial lines without factor replacement")
add_bullet(doc, "Avoid NSAIDs and aspirin (impair platelet function — use paracetamol/opioids for pain)")
add_bullet(doc, "Contact regional Hemophilia Centre or on-call haematologist early")
add_bullet(doc, "Do NOT delay factor replacement for investigations — treat first, image second for life-threatening bleeds")
add_bullet(doc, "Many patients know their disease well and may have home supply — assess carefully")

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════
#  COMPARISON SUMMARY TABLE
# ══════════════════════════════════════════════════════════════════
doc.add_page_break()
add_colored_heading(doc, "Summary Comparison Table", 1, 46, 64, 87)

add_table(doc,
    ["Feature", "Warfarin Overdose", "DIC", "Hemophilia A/B"],
    [
        ["Cause", "VKA drug toxicity / drug interaction", "Underlying disease (sepsis, malignancy, obstetric)", "X-linked hereditary factor deficiency"],
        ["Factors affected", "II, VII, IX, X (Vit K-dependent)", "All factors consumed (I, II, V, VIII, XIII especially)", "VIII (A) or IX (B) only"],
        ["PT", "Prolonged", "Prolonged", "Normal"],
        ["aPTT", "Mildly prolonged (if severe)", "Prolonged", "Prolonged"],
        ["Platelets", "Normal", "Low (consumed)", "Normal"],
        ["Fibrinogen", "Normal", "Low (consumed)", "Normal"],
        ["D-dimer", "Normal", "Markedly elevated", "Normal"],
        ["Key treatment", "Vitamin K + 4-factor PCC", "Treat cause + FFP + Cryoprecipitate + Platelets", "Factor VIII/IX concentrate (or emicizumab)"],
        ["Reversal agent", "Vitamin K, PCC, FFP (last resort)", "No specific reversal — supportive replacement", "Factor concentrate; FEIBA/rFVIIa if inhibitors"],
        ["Avoid", "rFVIIa (unreliable), excess Vit K (warfarin resistance)", "Antifibrinolytics (worsen thrombosis), platelet Tx in TTP-like picture", "NSAIDs, IM injections, aspirin"],
    ],
    col_widths=[1.6, 2.0, 2.0, 2.0]
)

# ── Footer note ───────────────────────────────────────────────────
doc.add_paragraph()
footer_p = doc.add_paragraph()
footer_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
footer_run = footer_p.add_run(
    "This document is for educational purposes only. Clinical decisions should be made in "
    "conjunction with current institutional protocols and specialist haematology guidance.\n"
    "Generated July 2026 · Sources: Barash 9e, Harrison's 22e, Tintinalli 9e, Robbins & Kumar, "
    "Quick Compendium Clinical Pathology 5e, Sabiston Surgery"
)
footer_run.font.size = Pt(9)
footer_run.font.color.rgb = RGBColor(130, 130, 130)
footer_run.italic = True

# ── Save ──────────────────────────────────────────────────────────
out = "/tmp/workspace/bleeding-disorders/Clinical_Scenarios_Bleeding_Disorders.docx"
doc.save(out)
print(f"Saved: {out}")
Running Command

cd /tmp/workspace/bleeding-disorders && python3 build_doc.py

Running Command

python3 -c " from docx import Document doc = Document('/tmp/workspace/bleeding-disorders/Clinical_Scenarios_Bleeding_Disorders.docx') for p in doc.paragraphs[:30]: if p.text.strip(): print(f'[{p.style.name}] {p.text[:80]}') "

Your document is ready:

Clinical Scenarios Bleeding Disorders

Word Document · DOCX


What's Inside (4 pages)

Scenario 1 - Warfarin Overdose

  • Realistic case: 68-year-old on warfarin with INR 9.2 from antibiotic interaction
  • Mechanism table: which factors fall first (Factor VII shortest at ~6 hrs)
  • INR-Based Reversal Protocol table - 6-tier management (no bleeding → life-threatening)
  • PCC dosing: 25 U/kg (INR 2-4), 35 U/kg (INR 4-6), 50 U/kg (INR >6), max 5000 U
  • Alert box: why rFVIIa is no longer recommended

Scenario 2 - DIC

  • Case: septic shock with petechiae, fibrinogen 95, D-dimer markedly elevated
  • 4-phase pathophysiology table (initiation → amplification → consumption → fibrinolysis)
  • Common trigger table (sepsis, obstetric, malignancy, trauma)
  • ISTH DIC scoring criteria
  • Blood product replacement table with exact triggers and doses
  • When to use/avoid heparin and antifibrinolytics

Scenario 3 - Hemophilia Management

  • Case: severe Hemophilia A with hemarthrosis + head injury
  • Severity classification + factor level targets by bleeding site
  • Factor dosing formulas: Factor VIII = Weight × % rise × 0.5; Factor IX × 1.0
  • Full treatment options table: recombinant concentrates, emicizumab, FEIBA, gene therapy
  • Inhibitor management (up to 30% of severe Hemophilia A)
  • ED rules: never IM inject, never central line without factor replacement

Summary Comparison Table

Side-by-side comparison of all three conditions across 10 parameters (labs, treatment, what to avoid).

I don't need warfarin but can you make simple and understanding notes for all

Asking for Preferences
Finding Sources
Finding Sources
Finding Sources
Writing File

~/bleeding-disorders/build_notes.py

from docx import Document
from docx.shared import Pt, Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.oxml.ns import qn
from docx.oxml import OxmlElement

doc = Document()

# ── Margins ───────────────────────────────────────────────────────
for s in doc.sections:
    s.top_margin    = Inches(0.9)
    s.bottom_margin = Inches(0.9)
    s.left_margin   = Inches(1.1)
    s.right_margin  = Inches(1.1)

# ── Normal style ──────────────────────────────────────────────────
normal = doc.styles["Normal"]
normal.font.name = "Calibri"
normal.font.size = Pt(11)

# ──────────────────────────────────────────────────────────────────
# HELPERS
# ──────────────────────────────────────────────────────────────────
def shade_cell(cell, hex_color):
    shd = OxmlElement("w:shd")
    shd.set(qn("w:val"), "clear")
    shd.set(qn("w:color"), "auto")
    shd.set(qn("w:fill"), hex_color)
    cell._tc.get_or_add_tcPr().append(shd)

def add_section_title(doc, text, r, g, b):
    p = doc.add_heading(text, level=1)
    p.alignment = WD_ALIGN_PARAGRAPH.LEFT
    for run in p.runs:
        run.font.color.rgb = RGBColor(r, g, b)
        run.font.size = Pt(15)
    return p

def add_sub(doc, text, r=46, g=64, b=87):
    p = doc.add_heading(text, level=2)
    p.alignment = WD_ALIGN_PARAGRAPH.LEFT
    for run in p.runs:
        run.font.color.rgb = RGBColor(r, g, b)
        run.font.size = Pt(12)
    return p

def add_box(doc, label, content, fill, label_color=(255,255,255), text_color=(30,30,30)):
    t = doc.add_table(rows=1, cols=1)
    t.style = "Table Grid"
    cell = t.rows[0].cells[0]
    p = cell.paragraphs[0]
    r1 = p.add_run(label + "\n")
    r1.bold = True
    r1.font.color.rgb = RGBColor(*label_color)
    r1.font.size = Pt(10)
    r2 = p.add_run(content)
    r2.font.color.rgb = RGBColor(*text_color)
    r2.font.size = Pt(10.5)
    shade_cell(cell, fill)
    doc.add_paragraph()

def add_mnemonic(doc, title, mnemonic, lines):
    t = doc.add_table(rows=1, cols=1)
    t.style = "Table Grid"
    cell = t.rows[0].cells[0]
    p = cell.paragraphs[0]
    r1 = p.add_run("MNEMONIC — " + title + "\n")
    r1.bold = True
    r1.font.color.rgb = RGBColor(255, 255, 255)
    r1.font.size = Pt(10)
    r2 = p.add_run(mnemonic + "\n")
    r2.bold = True
    r2.font.color.rgb = RGBColor(255, 230, 100)
    r2.font.size = Pt(13)
    for line in lines:
        r3 = cell.add_paragraph().add_run(line)
        r3.font.color.rgb = RGBColor(230, 230, 230)
        r3.font.size = Pt(10)
    shade_cell(cell, "2C3E50")
    doc.add_paragraph()

def add_table(doc, headers, rows, col_widths=None, header_color="2E4057"):
    t = doc.add_table(rows=1+len(rows), cols=len(headers))
    t.style = "Table Grid"
    hdr = t.rows[0]
    for i, h in enumerate(headers):
        c = hdr.cells[i]
        c.text = h
        for run in c.paragraphs[0].runs:
            run.bold = True
            run.font.color.rgb = RGBColor(255,255,255)
            run.font.size = Pt(10)
        c.paragraphs[0].alignment = WD_ALIGN_PARAGRAPH.CENTER
        shade_cell(c, header_color)
    for ri, row in enumerate(rows):
        fill = "EEF2F7" if ri % 2 == 0 else "FFFFFF"
        for ci, val in enumerate(row):
            c = t.rows[ri+1].cells[ci]
            c.text = str(val)
            for run in c.paragraphs[0].runs:
                run.font.size = Pt(10)
            shade_cell(c, fill)
    if col_widths:
        for i, w in enumerate(col_widths):
            for row in t.rows:
                row.cells[i].width = Inches(w)
    doc.add_paragraph()

def bullet(doc, text, bold=""):
    p = doc.add_paragraph(style="List Bullet")
    if bold:
        r1 = p.add_run(bold)
        r1.bold = True
        r1.font.size = Pt(10.5)
        p.add_run(text[len(bold):]).font.size = Pt(10.5)
    else:
        p.add_run(text).font.size = Pt(10.5)

def divider(doc):
    doc.add_paragraph("─" * 85)

# ══════════════════════════════════════════════════════════════════
# COVER
# ══════════════════════════════════════════════════════════════════
tp = doc.add_paragraph()
tp.alignment = WD_ALIGN_PARAGRAPH.CENTER
r = tp.add_run("BLEEDING DISORDERS")
r.bold = True; r.font.size = Pt(26); r.font.color.rgb = RGBColor(46,64,87)

sp = doc.add_paragraph()
sp.alignment = WD_ALIGN_PARAGRAPH.CENTER
r2 = sp.add_run("Exam Revision Notes  |  Key Points, Mnemonics & Quick References")
r2.italic = True; r2.font.size = Pt(13); r2.font.color.rgb = RGBColor(100,100,100)

doc.add_paragraph()
divider(doc)
doc.add_paragraph()

# Table of contents
add_sub(doc, "Contents")
for item in [
    "1.  Haemophilia A",
    "2.  Haemophilia B",
    "3.  Haemophilia C",
    "4.  Von Willebrand Disease (vWD)",
    "5.  Disseminated Intravascular Coagulation (DIC)",
    "6.  Vitamin K Deficiency",
    "7.  Liver Disease Coagulopathy",
    "8.  Immune Thrombocytopenic Purpura (ITP)",
    "9.  Master Comparison Table",
    "10. Lab Pattern Cheat Sheet",
]:
    p = doc.add_paragraph(item)
    p.paragraph_format.left_indent = Inches(0.3)
    for run in p.runs:
        run.font.size = Pt(11)

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# 1. HAEMOPHILIA A
# ══════════════════════════════════════════════════════════════════
add_section_title(doc, "1. Haemophilia A", 150, 30, 30)

add_box(doc, "ONE-LINE SUMMARY",
    "X-linked recessive deficiency of Factor VIII causing deep tissue and joint bleeding.",
    "FDECEA", (150,30,30))

add_sub(doc, "Key Facts")
bullet(doc, "Factor VIII: antihemophilic factor — cofactor in intrinsic pathway (IXa + VIIIa complex activates X)")
bullet(doc, "Gene: F8 on X chromosome (186 kb, one of the largest known genes, 26 exons)")
bullet(doc, "Incidence: ~1 in 5,000 males. Most common hereditary coagulopathy.")
bullet(doc, "Females are carriers (usually asymptomatic; ~30% have mildly reduced levels)")
bullet(doc, "30% of cases are new mutations (no family history)")

add_sub(doc, "Severity Classification")
add_table(doc,
    ["Severity", "Factor VIII Level", "Bleeding Pattern"],
    [
        ["Severe", "< 1%", "Spontaneous bleeds — joints, muscles, CNS"],
        ["Moderate", "1–5%", "Bleeding after minor trauma; occasional spontaneous"],
        ["Mild", "5–40%", "Only after significant trauma or surgery"],
    ], [1.5, 1.8, 3.3])

add_sub(doc, "Clinical Features")
bullet(doc, "Haemarthrosis (joint bleeding): most common — knees, ankles, elbows")
bullet(doc, "Deep muscle haematomas (iliopsoas — causes hip flexion deformity + femoral nerve palsy)")
bullet(doc, "CNS bleeding: rare but life-threatening — immediate treatment before imaging")
bullet(doc, "Prolonged bleeding after cuts, dental work, surgery")
bullet(doc, "NO petechiae, NO mucosal bleeding (those suggest platelet problem)")

add_sub(doc, "Labs")
add_table(doc,
    ["Test", "Result", "Why"],
    [
        ["PT", "NORMAL", "Extrinsic pathway intact"],
        ["aPTT", "PROLONGED", "Intrinsic pathway defective (Factor VIII missing)"],
        ["Platelets", "NORMAL", "Not a platelet disorder"],
        ["Bleeding time", "NORMAL", "Primary haemostasis intact"],
        ["Factor VIII assay", "LOW", "Confirms diagnosis"],
    ], [1.5, 1.5, 3.5])

add_sub(doc, "Treatment")
bullet(doc, "Recombinant Factor VIII concentrate — FIRST LINE for all severities")
bullet(doc, "Dosing formula: Units = Weight (kg) × Desired % rise × 0.5")
bullet(doc, "Rule: 1 U/kg Factor VIII raises level by ~2%")
bullet(doc, "DDAVP (desmopressin 0.3 mcg/kg IV): MILD disease only — releases stored Factor VIII from endothelium; NOT effective in severe")
bullet(doc, "Emicizumab (Hemlibra): bispecific antibody mimicking Factor VIII; SC injection; works even with inhibitors — MAJOR advance")
bullet(doc, "Tranexamic acid: adjunct for mucosal/oral bleeds (antifibrinolytic)")
bullet(doc, "If inhibitors develop: FEIBA (bypass agent) or rFVIIa")
bullet(doc, "Gene therapy (valoctocogene roxaparvovec): approved; AAV-based; single infusion")

add_mnemonic(doc, "Haemophilia A Target Levels",
    "Think: 'I Need To Control Bleeding Surgically'",
    [
        "I   = ICH / life-threatening  → 100%",
        "N   = Normal major surgery    → 80–100%",
        "T   = Traumatic joint bleed   → 40–60%",
        "C   = Compartment / muscle    → 40–60%",
        "B   = Big iliopsoas bleed     → 80–100%",
        "S   = Superficial cut         → 20–30%",
    ])

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# 2. HAEMOPHILIA B
# ══════════════════════════════════════════════════════════════════
add_section_title(doc, "2. Haemophilia B  (Christmas Disease)", 150, 30, 30)

add_box(doc, "ONE-LINE SUMMARY",
    "X-linked recessive deficiency of Factor IX — clinically IDENTICAL to Haemophilia A, "
    "distinguished only by specific factor assay.",
    "FDECEA", (150,30,30))

add_sub(doc, "Key Facts")
bullet(doc, "Factor IX: Christmas factor — serine protease in intrinsic pathway")
bullet(doc, "Gene: F9 on X chromosome (33 kb, 8 exons — much smaller than F8)")
bullet(doc, "Incidence: ~1 in 30,000 males (4x less common than Haemophilia A)")
bullet(doc, "Historical note: affected royal families of Europe (Queen Victoria was a carrier)")
bullet(doc, "Vitamin K-dependent factor (unlike Factor VIII)")

add_sub(doc, "Clinical Features")
bullet(doc, "Identical to Haemophilia A: haemarthrosis, muscle haematomas, post-procedure bleeding")
bullet(doc, "CANNOT be distinguished from Haemophilia A clinically — only by factor assay")

add_sub(doc, "Labs")
add_table(doc,
    ["Test", "Result"],
    [("PT", "NORMAL"), ("aPTT", "PROLONGED"), ("Platelets", "NORMAL"),
     ("Factor IX assay", "LOW — confirms diagnosis"), ("Factor VIII assay", "Normal — excludes Haemophilia A")],
    [2.0, 4.5])

add_sub(doc, "Treatment")
bullet(doc, "Recombinant Factor IX concentrate — first line")
bullet(doc, "Dosing formula: Units = Weight (kg) × Desired % rise × 1.0  (note: factor of 1.0, not 0.5)")
bullet(doc, "Extended half-life products: eftrenonacog alfa (FIX-Fc fusion) — less frequent dosing")
bullet(doc, "Gene therapy: etranacogene dezaparvovec (Hemgenix) — approved; single AAV infusion")
bullet(doc, "DDAVP: NOT effective (Factor IX is not stored in endothelium)")
bullet(doc, "Inhibitors: less common than Haemophilia A (~3–5%); manage with rFVIIa or FEIBA")

add_box(doc, "EXAM TIP — A vs B",
    "Both: X-linked recessive | aPTT prolonged | PT normal | Haemarthrosis\n"
    "A: Factor VIII deficient | Gene F8 | 1 in 5,000 | DDAVP works (mild) | Factor VIII × 0.5\n"
    "B: Factor IX deficient  | Gene F9 | 1 in 30,000 | DDAVP NOT effective | Factor IX × 1.0\n"
    "Vitamin K-dependent: B (yes) | A (no)",
    "E8F4E8", (30,100,30))

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# 3. HAEMOPHILIA C
# ══════════════════════════════════════════════════════════════════
add_section_title(doc, "3. Haemophilia C  (Rosenthal Syndrome)", 150, 30, 30)

add_box(doc, "ONE-LINE SUMMARY",
    "Autosomal recessive deficiency of Factor XI — milder bleeding, common in Ashkenazi Jews.",
    "FDECEA", (150,30,30))

add_sub(doc, "Key Facts")
bullet(doc, "Factor XI: plasma thromboplastin antecedent — activates Factor IX in intrinsic pathway")
bullet(doc, "Inheritance: AUTOSOMAL recessive (unlike A and B which are X-linked)")
bullet(doc, "Affects both males and females equally")
bullet(doc, "High prevalence in Ashkenazi Jewish population (~8% are carriers)")
bullet(doc, "Milder bleeding than Haemophilia A or B — spontaneous bleeds are rare")
bullet(doc, "Bleeding severity correlates poorly with factor level (unlike A and B)")

add_sub(doc, "Clinical Features")
bullet(doc, "Post-operative or post-traumatic bleeding is the main problem")
bullet(doc, "Common sites: dental extraction, tonsillectomy, urological surgery (high fibrinolytic activity)")
bullet(doc, "Haemarthrosis is RARE (distinguishes from Haemophilia A and B)")
bullet(doc, "Menorrhagia common in affected women")

add_sub(doc, "Labs")
add_table(doc,
    ["Test", "Result"],
    [("PT", "NORMAL"), ("aPTT", "PROLONGED"), ("Factor XI assay", "LOW")], [2.0, 4.5])

add_sub(doc, "Treatment")
bullet(doc, "Fresh Frozen Plasma (FFP): mainstay — raises Factor XI levels")
bullet(doc, "Factor XI concentrate: available in some countries (UK, Israel, France)")
bullet(doc, "Tranexamic acid: very useful, especially for dental/oral procedures")
bullet(doc, "DDAVP: not effective")

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# 4. vWD
# ══════════════════════════════════════════════════════════════════
add_section_title(doc, "4. Von Willebrand Disease (vWD)", 20, 80, 140)

add_box(doc, "ONE-LINE SUMMARY",
    "Most common hereditary bleeding disorder (prevalence ~1%). Deficiency or dysfunction of "
    "von Willebrand Factor (vWF), causing both platelet plug defect AND reduced Factor VIII.",
    "E3F2FB", (10,60,110))

add_sub(doc, "Key Facts")
bullet(doc, "vWF has TWO functions: (1) platelet adhesion to subendothelium; (2) carries and protects Factor VIII in plasma")
bullet(doc, "Without vWF: platelets cannot stick + Factor VIII is rapidly degraded")
bullet(doc, "Synthesised by endothelial cells and megakaryocytes; stored in Weibel-Palade bodies")
bullet(doc, "Prevalence: up to 1% of population (most cases are mild and undiagnosed)")
bullet(doc, "Usually autosomal dominant (Types 1 and 2) — both sexes affected equally")

add_sub(doc, "Types of vWD")
add_table(doc,
    ["Type", "Defect", "Prevalence", "Key Features", "Treatment"],
    [
        ["Type 1", "Quantitative — low amount of vWF, but functional", "~80% of cases", "Mild to moderate; most common", "DDAVP (1st line for mild/moderate)"],
        ["Type 2", "Qualitative — vWF present but dysfunctional (subtypes 2A, 2B, 2M, 2N)", "~15–20%", "Variable severity; 2B: avoid DDAVP (can cause thrombocytopenia)", "vWF concentrate"],
        ["Type 3", "Complete absence of vWF", "~1–5%", "Severe; most like Haemophilia A (very low FVIII)", "vWF-FVIII concentrate; DDAVP does NOT work"],
    ], [0.7, 2.2, 1.1, 1.8, 1.8])

add_sub(doc, "Clinical Features")
bullet(doc, "Mucocutaneous bleeding: epistaxis, gum bleeding, easy bruising, menorrhagia")
bullet(doc, "Prolonged bleeding after cuts, dental work")
bullet(doc, "Deep tissue/joint bleeds: only in Type 3 (mimics Haemophilia A)")
bullet(doc, "Symptoms worsen with aspirin, NSAIDs")

add_sub(doc, "Labs")
add_table(doc,
    ["Test", "Result", "Note"],
    [
        ["PT", "Normal", ""],
        ["aPTT", "Normal or mildly prolonged", "Prolonged mainly in Type 3 (low FVIII)"],
        ["Platelets", "Normal (low in Type 2B)", ""],
        ["Bleeding time / PFA-100", "PROLONGED", "Platelet adhesion defect"],
        ["vWF antigen", "Low or normal", "Normal in Type 2 (dysfunctional)"],
        ["vWF activity (Ristocetin cofactor)", "Low", "Best functional test"],
        ["Factor VIII level", "Low (especially Type 3)", "vWF not protecting FVIII"],
    ], [2.0, 2.0, 2.5])

add_sub(doc, "Treatment")
bullet(doc, "DDAVP (desmopressin) 0.3 mcg/kg IV: releases stored vWF from endothelial cells — works in Type 1 and some Type 2; NOT Type 3; avoid in Type 2B")
bullet(doc, "vWF concentrate (Vonvendi / Wilate): used in Types 2 and 3, DDAVP non-responders, major bleeding or surgery")
bullet(doc, "Tranexamic acid: excellent adjunct for mucosal/dental bleeds")
bullet(doc, "Combined vWF-FVIII concentrate: for Type 3 with very low FVIII")
bullet(doc, "Oestrogen/OCP: can raise vWF levels in women with menorrhagia")

add_mnemonic(doc, "vWD Key Concept",
    "vWF = 'Very Wonderful Factor' that does TWO jobs:",
    [
        "Job 1: Sticks platelets to the injured vessel wall (via GPIb receptor)",
        "Job 2: Carries Factor VIII safely in the blood (prevents its degradation)",
        "So vWD = platelet problem + reduced Factor VIII = DOUBLE defect",
        "Labs: Normal PT, normal-ish aPTT, normal platelet COUNT, LONG bleeding time",
    ])

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# 5. DIC
# ══════════════════════════════════════════════════════════════════
add_section_title(doc, "5. Disseminated Intravascular Coagulation (DIC)", 120, 40, 140)

add_box(doc, "ONE-LINE SUMMARY",
    "Pathological systemic activation of coagulation → simultaneous microvascular thrombosis "
    "AND haemorrhage due to factor/platelet consumption. Always secondary to an underlying disease.",
    "F3E5F5", (80,20,100))

add_sub(doc, "Pathophysiology (4 steps)")
add_table(doc,
    ["Step", "What Happens", "Result"],
    [
        ["1. Trigger", "Underlying disease releases Tissue Factor massively", "Coagulation system activated everywhere"],
        ["2. Clotting", "Thrombin generated in excess → fibrin clots throughout microcirculation", "Organ ischaemia (kidneys, brain, adrenals)"],
        ["3. Consumption", "Factors I, II, V, VIII, XIII + platelets depleted", "Paradoxical BLEEDING despite clotting"],
        ["4. Fibrinolysis", "Plasmin activated → breaks down fibrin → FDPs/D-dimer rise", "Elevated D-dimer + schistocytes on smear"],
    ], [1.0, 3.5, 2.2])

add_sub(doc, "Common Triggers")
add_table(doc,
    ["Category", "Examples"],
    [
        ["Sepsis (MOST COMMON)", "Gram-negative bacteraemia, fungal sepsis"],
        ["Obstetric", "Abruptio placentae, amniotic fluid embolism, HELLP syndrome, eclampsia"],
        ["Malignancy", "Acute promyelocytic leukaemia (APL) — classic exam answer; mucin-secreting adenocarcinoma"],
        ["Trauma / Burns", "Massive trauma, fat embolism, crush injury"],
        ["Transfusion", "Incompatible blood, massive transfusion"],
        ["Vascular", "Giant haemangioma (Kasabach-Merritt syndrome), aortic aneurysm"],
    ], [2.2, 4.4])

add_sub(doc, "Clinical Features")
bullet(doc, "Bleeding: petechiae, purpura, oozing from IV sites, mucous membranes, wounds")
bullet(doc, "Thrombosis: skin necrosis, acral cyanosis, organ failure (renal, hepatic)")
bullet(doc, "Microangiopathic haemolytic anaemia (MAHA): schistocytes on blood smear")
bullet(doc, "Adrenal haemorrhage (Waterhouse-Friderichsen syndrome) in meningococcal sepsis")

add_sub(doc, "Labs — The DIC Pattern")
add_table(doc,
    ["Test", "Result", "Reason"],
    [
        ["PT", "PROLONGED", "Factors II, VII, X consumed"],
        ["aPTT", "PROLONGED", "Factors VIII, IX, XI consumed"],
        ["Platelets", "LOW", "Consumed in microthrombi"],
        ["Fibrinogen", "LOW (< 150 mg/dL)", "Consumed + degraded by plasmin"],
        ["D-dimer", "VERY HIGH", "Fibrin degradation products"],
        ["Blood smear", "Schistocytes", "RBCs sheared by fibrin strands"],
    ], [1.8, 1.8, 3.1])

add_sub(doc, "ISTH DIC Scoring")
add_table(doc,
    ["Parameter", "Value", "Score"],
    [
        ["Platelets", "> 100k = 0 | 50–100k = 1 | < 50k = 2", "0–2"],
        ["D-dimer / FDPs", "No rise = 0 | Moderate = 2 | Strong = 3", "0–3"],
        ["PT prolongation", "< 3 sec = 0 | 3–6 sec = 1 | > 6 sec = 2", "0–2"],
        ["Fibrinogen", "> 1.0 g/L = 0 | < 1.0 g/L = 1", "0–1"],
        ["TOTAL ≥ 5", "= Overt DIC — treat aggressively", ""],
    ], [1.8, 3.0, 0.9])

add_sub(doc, "Management")
add_box(doc, "STEP 1 — TREAT THE UNDERLYING CAUSE",
    "DIC will NEVER resolve without treating the trigger.\n"
    "Sepsis → antibiotics + source control | APL → ATRA (all-trans retinoic acid) | "
    "Obstetric → deliver baby / remove trigger",
    "E8F4E8", (30,100,30))

add_table(doc,
    ["Product", "Give When", "Dose"],
    [
        ["Cryoprecipitate", "Fibrinogen < 150 mg/dL + bleeding", "10 units → raises fibrinogen ~50 mg/dL"],
        ["FFP", "Prolonged PT/aPTT + active bleeding", "10–15 mL/kg (4–6 units)"],
        ["Platelets", "Platelets ≤ 50 × 10⁹/L + bleeding", "1 adult therapeutic dose"],
        ["Vitamin K", "Concurrent vitamin K deficiency", "5–10 mg IV/oral"],
        ["LMWH", "Prophylaxis once bleeding controlled", "Standard DVT prophylaxis dose"],
    ], [1.8, 2.8, 2.1])

bullet(doc, "AVOID tranexamic acid in DIC (risk of worsening microvascular thrombosis)")
bullet(doc, "Heparin: controversial; consider only in thrombosis-dominant DIC (APL, purpura fulminans) under specialist guidance")
bullet(doc, "Up to 35% of septic shock patients meet DIC criteria — associated with significantly increased mortality")

add_mnemonic(doc, "DIC Triggers",
    "STOP Making New Thrombi Violently",
    [
        "S = Sepsis (most common)",
        "T = Trauma / burns",
        "O = Obstetric emergency (APE, abruption, HELLP)",
        "P = Promyelocytic leukaemia (APL) + other malignancies",
        "M = Mismatched transfusion",
        "N = Necrosis (massive tissue injury)",
        "T = Toxins / venoms",
        "V = Vascular (giant haemangioma)",
    ])

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# 6. VITAMIN K DEFICIENCY
# ══════════════════════════════════════════════════════════════════
add_section_title(doc, "6. Vitamin K Deficiency", 180, 100, 0)

add_box(doc, "ONE-LINE SUMMARY",
    "Fat-soluble vitamin required for gamma-carboxylation of clotting factors II, VII, IX, X "
    "and anticoagulant proteins C and S. Deficiency prolongs both PT and aPTT.",
    "FFF8E1", (120,70,0))

add_sub(doc, "Vitamin K-Dependent Factors — Mnemonic")
add_mnemonic(doc, "Vitamin K factors",
    "1972 + PC  (the year 1972 + Proteins C & S)",
    [
        "1 = Factor I?  No — remember: 1-9-7-2",
        "1 = Factor... skip. Use: II, VII, IX, X",
        "Easier version: '1972' reads as Roman numerals backwards:",
        "X (10), IX (9), VII (7), II (2)  →  Factors II, VII, IX, X",
        "PLUS:  Protein C  and  Protein S  (anticoagulants — also Vit K dependent)",
    ])

add_sub(doc, "Causes")
add_table(doc,
    ["Cause", "Details"],
    [
        ["Newborns (HDN)", "Inadequate placental transfer + breast milk low in Vit K + sterile gut. Give IM Vit K at birth prophylactically"],
        ["Malabsorption", "Fat-soluble vitamin — needs bile salts. Obstructive jaundice, Crohn's, coeliac, short bowel syndrome"],
        ["Warfarin / VKA drugs", "Block Vit K recycling by inhibiting VKOR enzyme"],
        ["Antibiotics (broad-spectrum)", "Destroy gut flora → reduce Vit K2 synthesis"],
        ["Poor dietary intake", "Usually combined with another cause; prolonged fasting, TPN without Vit K supplementation"],
        ["Liver disease", "Impaired Vit K absorption and utilisation (secondary cause)"],
    ], [2.2, 4.4])

add_sub(doc, "Labs")
add_table(doc,
    ["Test", "Result", "Reason"],
    [
        ["PT", "PROLONGED (early)", "Factor VII (shortest half-life ~6h) falls first"],
        ["aPTT", "Prolonged (later)", "Factors IX, X, II depleted"],
        ["Platelets", "Normal", ""],
        ["Fibrinogen", "Normal", ""],
        ["Factor VII level", "First to fall", "Shortest half-life → best early marker"],
    ], [2.0, 2.0, 2.6])

add_sub(doc, "Treatment")
bullet(doc, "Oral Vitamin K1 (phytomenadione): mild deficiency, non-urgent situations")
bullet(doc, "IV Vitamin K1 5–10 mg: corrects INR within 6–24 hours; PREFERRED for active bleeding")
bullet(doc, "4-factor PCC: immediate effect for life-threatening bleeding (bridge until Vit K takes effect)")
bullet(doc, "FFP: only if PCC unavailable (slower, risk of TACO)")
bullet(doc, "Neonatal HDN: IM Vit K 1 mg at birth — universal prophylaxis")
bullet(doc, "Note: high-dose Vit K can cause warfarin resistance for 1–2 weeks when anticoagulation is restarted")

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# 7. LIVER DISEASE COAGULOPATHY
# ══════════════════════════════════════════════════════════════════
add_section_title(doc, "7. Liver Disease Coagulopathy", 60, 100, 60)

add_box(doc, "ONE-LINE SUMMARY",
    "The liver synthesises ALL clotting factors EXCEPT Factor VIII. Liver failure = complex "
    "coagulopathy with bleeding AND thrombotic risk (rebalanced haemostasis).",
    "E8F5E9", (30,100,30))

add_sub(doc, "Why Liver Disease Causes Coagulopathy")
bullet(doc, "Reduced synthesis of: Factors I, II, V, VII, IX, X, XI, XII, XIII")
bullet(doc, "Factor VIII: made by ENDOTHELIAL CELLS — NOT the liver (may be NORMAL or HIGH in liver disease)")
bullet(doc, "Vitamin K: liver disease causes poor absorption and utilisation → additional Vit K-dependent factor loss")
bullet(doc, "Thrombocytopenia: portal hypertension → splenomegaly → platelet sequestration")
bullet(doc, "Qualitative platelet defects: due to uraemia or circulating FDPs")
bullet(doc, "DIC: impaired clearance of activated clotting factors can trigger DIC")
bullet(doc, "BUT also: liver makes anticoagulants (Protein C, S, antithrombin) — also reduced, partly balancing out")

add_sub(doc, "Labs")
add_table(doc,
    ["Test", "Result"],
    [
        ("PT / INR", "Prolonged — best marker of synthetic function (PT remains normal until >80% hepatic function lost)"),
        ("aPTT", "Prolonged"),
        ("Platelets", "Low (sequestration) + qualitative defect"),
        ("Factor VIII", "NORMAL or elevated — key exam point"),
        ("Fibrinogen", "Low in advanced disease"),
        ("D-dimer", "May be raised (secondary DIC)"),
    ], [2.0, 4.5])

add_sub(doc, "Management")
bullet(doc, "Treat underlying liver disease")
bullet(doc, "Vitamin K 10 mg IV: give a trial even in liver disease (partial response expected)")
bullet(doc, "FFP: replaces multiple factors; use for active bleeding or before procedures")
bullet(doc, "Cryoprecipitate: if fibrinogen < 150 mg/dL")
bullet(doc, "Platelet transfusion: if platelets < 50,000 + bleeding or before invasive procedure")
bullet(doc, "Avoid over-correcting INR — 'rebalanced haemostasis' means standard INR is a poor predictor of bleeding risk in liver disease")
bullet(doc, "TIPSS (transjugular intrahepatic portosystemic shunt): can reduce portal hypertension and thrombocytopenia")

add_box(doc, "EXAM KEY POINT — Factor VIII in Liver Disease",
    "Factor VIII is the ONLY major clotting factor NOT made by the liver.\n"
    "In severe liver disease: all factors LOW except Factor VIII which may be NORMAL or HIGH.\n"
    "This helps distinguish liver disease from DIC (in DIC, Factor VIII is LOW from consumption).",
    "E3F2FB", (10,60,110))

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# 8. ITP
# ══════════════════════════════════════════════════════════════════
add_section_title(doc, "8. Immune Thrombocytopenic Purpura (ITP)", 30, 80, 160)

add_box(doc, "ONE-LINE SUMMARY",
    "Autoimmune destruction of platelets by IgG antibodies (anti-GPIIb/IIIa or anti-GPIb/IX). "
    "Coagulation factors are NORMAL — this is purely a platelet disorder.",
    "E3F2FB", (10,60,110))

add_sub(doc, "Key Facts")
bullet(doc, "IgG autoantibodies coat platelets → Fc receptor-mediated destruction in spleen")
bullet(doc, "Acute ITP: children, post-viral (e.g. EBV, CMV, VZV), self-limiting (80% resolve spontaneously)")
bullet(doc, "Chronic ITP: adults (especially women 20–40s), may need long-term management")
bullet(doc, "Secondary ITP: SLE, HIV, CLL, H. pylori infection, drug-induced")

add_sub(doc, "Clinical Features")
bullet(doc, "Petechiae and purpura (non-blanching flat spots — due to low platelet count)")
bullet(doc, "Easy bruising, epistaxis, gum bleeding, menorrhagia")
bullet(doc, "Wet purpura (blisters in mouth): suggests very severe thrombocytopenia — treat urgently")
bullet(doc, "Intracranial haemorrhage: rare but life-threatening (platelet < 10,000)")
bullet(doc, "NO splenomegaly, NO lymphadenopathy (if present, think secondary cause)")

add_sub(doc, "Labs")
add_table(doc,
    ["Test", "Result", "Note"],
    [
        ("Platelet count", "LOW (may be < 10,000/µL)", "Only platelet abnormality"),
        ("PT", "NORMAL", "Coagulation cascade intact"),
        ("aPTT", "NORMAL", ""),
        ("Blood smear", "Low platelets, large platelets", "Young platelets are large"),
        ("Antiplatelet antibody test", "Often positive", "Not always required for diagnosis"),
        ("Bone marrow biopsy", "Increased megakaryocytes", "Done if diagnosis uncertain or refractory"),
    ], [2.0, 1.8, 2.8])

add_sub(doc, "Treatment")
add_table(doc,
    ["Situation", "Treatment"],
    [
        ("Asymptomatic, platelets > 30,000", "Observe; no treatment needed"),
        ("Symptomatic or platelets < 20–30,000", "Corticosteroids (prednisolone 1 mg/kg) — first line"),
        ("Rapid rise needed (emergency)", "IV immunoglobulin (IVIG) 1 g/kg — raises platelets within 24–48h"),
        ("Rh-positive patients (non-splenectomised)", "Anti-D immunoglobulin (RhoGAM equivalent)"),
        ("Refractory / relapsing", "Splenectomy — removes primary site of platelet destruction (70% remission)"),
        ("Post-splenectomy relapse", "TPO receptor agonists: eltrombopag (oral), romiplostim (SC injection)"),
        ("Refractory to all", "Rituximab (anti-CD20), fostamatinib (spleen tyrosine kinase inhibitor)"),
        ("Life-threatening bleed", "IVIG + high-dose steroids + platelet transfusion (transfuse more frequently)"),
    ], [2.4, 4.2])

add_mnemonic(doc, "ITP Treatment Ladder",
    "So I Stopped Treating Rapidly",
    [
        "S = Steroids (prednisolone) — first line",
        "I = IVIG — rapid effect for emergencies",
        "S = Splenectomy — refractory cases",
        "T = TPO agonists (eltrombopag, romiplostim)",
        "R = Rituximab — last resort",
    ])

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# 9. MASTER COMPARISON TABLE
# ══════════════════════════════════════════════════════════════════
add_section_title(doc, "9. Master Comparison Table", 46, 64, 87)
doc.add_paragraph("Use this table for quick exam revision. Every column should be memorised.")
doc.add_paragraph()

add_table(doc,
    ["Feature", "Haem A", "Haem B", "Haem C", "vWD", "DIC", "Vit K Def", "Liver Disease", "ITP"],
    [
        ["Factor deficient", "VIII", "IX", "XI", "vWF (+VIII)", "Multiple", "II,VII,IX,X", "All except VIII", "None (platelets)"],
        ["Inheritance", "X-linked rec", "X-linked rec", "Autosomal rec", "Usually AD", "Acquired", "Acquired", "Acquired", "Acquired (autoimmune)"],
        ["PT", "Normal", "Normal", "Normal", "Normal/↑*", "↑↑", "↑↑ (early)", "↑↑", "Normal"],
        ["aPTT", "↑↑", "↑↑", "↑↑", "Normal/↑*", "↑↑", "↑ (later)", "↑↑", "Normal"],
        ["Platelets", "Normal", "Normal", "Normal", "Normal (↓ in 2B)", "↓↓ consumed", "Normal", "↓ (sequestration)", "↓↓ destroyed"],
        ["Fibrinogen", "Normal", "Normal", "Normal", "Normal", "↓↓", "Normal", "↓ in severe", "Normal"],
        ["D-dimer", "Normal", "Normal", "Normal", "Normal", "↑↑↑", "Normal", "May ↑", "Normal"],
        ["Bleeding type", "Deep / joints", "Deep / joints", "Post-op / dental", "Mucocutaneous", "Both + thrombosis", "Mucocutaneous", "Mixed", "Mucocutaneous"],
        ["Key treatment", "FVIII concentrate", "FIX concentrate", "FFP / TXA", "DDAVP / vWF cone", "Treat cause + products", "Vit K + PCC", "FFP + Vit K", "Steroids / IVIG"],
    ],
    [2.0, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85, 1.0, 0.85])

p = doc.add_paragraph("* vWD Type 3 or severe Type 2 can have prolonged aPTT (due to very low Factor VIII).")
p.runs[0].font.size = Pt(9)
p.runs[0].italic = True
doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════
# 10. LAB CHEAT SHEET
# ══════════════════════════════════════════════════════════════════
add_section_title(doc, "10. Lab Pattern Cheat Sheet", 46, 64, 87)
add_table(doc,
    ["Lab Pattern", "Think First Of"],
    [
        ("↑aPTT only, normal PT, normal platelets", "Haemophilia A (VIII), Haemophilia B (IX), Haemophilia C (XI), Heparin therapy"),
        ("↑PT only, normal aPTT, normal platelets", "Factor VII deficiency, early Vit K def, early warfarin (Factor VII shortest half-life)"),
        ("Both ↑PT and ↑aPTT, low platelets, low fibrinogen, high D-dimer", "DIC — check for underlying trigger (sepsis, obstetric, malignancy)"),
        ("Both ↑PT and ↑aPTT, normal or low platelets, Factor VIII normal/high", "Liver disease coagulopathy"),
        ("Both ↑PT and ↑aPTT, normal platelets, normal fibrinogen", "Vitamin K deficiency — give vitamin K trial"),
        ("Normal PT, normal aPTT, normal platelets, ↑bleeding time/PFA-100", "vWD Type 1, platelet function defect (aspirin, uraemia)"),
        ("Normal PT, normal aPTT, low platelets, no other abnormality", "ITP — check antiplatelet antibodies; bone marrow for megakaryocytes"),
        ("Normal ALL tests but bleeds after trauma/surgery", "Factor XIII deficiency (clot forms but is unstable), mild vWD"),
        ("↑aPTT only, no bleeding tendency (or thrombosis)", "Lupus anticoagulant / antiphospholipid syndrome, Factor XII deficiency"),
    ], [3.0, 4.6])

# Footer
doc.add_paragraph()
fp = doc.add_paragraph()
fp.alignment = WD_ALIGN_PARAGRAPH.CENTER
fr = fp.add_run(
    "Exam Revision Notes — Bleeding Disorders  |  July 2026\n"
    "Sources: Robbins & Kumar, Harrison's 22e, Tintinalli EM, Sabiston Surgery, "
    "Harper's Biochemistry, Barash Anaesthesia, Washington Manual"
)
fr.font.size = Pt(8.5)
fr.italic = True
fr.font.color.rgb = RGBColor(130,130,130)

out = "/tmp/workspace/bleeding-disorders/Bleeding_Disorders_Exam_Notes.docx"
doc.save(out)
print(f"Saved: {out}")
Running Command

cd /tmp/workspace/bleeding-disorders && python3 build_notes.py 2>&1

Running Command

python3 -c " from docx import Document doc = Document('/tmp/workspace/bleeding-disorders/Bleeding_Disorders_Exam_Notes.docx') headings = [p.text for p in doc.paragraphs if 'Heading' in p.style.name and p.text.strip()] for h in headings: print(h) "

Your exam revision notes are ready:

Bleeding Disorders Exam Notes

Word Document · DOCX


What's Inside

The document covers 8 bleeding disorders across 10 sections, all structured as: One-line summary → Key facts → Clinical features → Labs → Treatment → Mnemonics.
SectionDisorderHighlight
1Haemophilia AFactor VIII dosing formula, DDAVP rule, emicizumab, target levels mnemonic
2Haemophilia BA vs B comparison box, gene therapy, why DDAVP does NOT work
3Haemophilia CAutosomal inheritance, Ashkenazi Jews, FFP + tranexamic acid
4Von Willebrand DiseaseTypes 1/2/3 table, DDAVP rules (when to use/avoid), double-defect concept
5DIC4-step pathophysiology, ISTH scoring, triggers mnemonic, product thresholds
6Vitamin K Deficiency"1972" factor mnemonic, causes table, neonatal HDN
7Liver Disease CoagulopathyWhy Factor VIII is NORMAL/HIGH — key exam differentiator from DIC
8ITPTreatment ladder mnemonic, steroids → IVIG → splenectomy → TPO agonists
9Master Comparison TableAll 8 disorders side-by-side across 9 parameters
10Lab Cheat Sheet9 lab patterns with diagnoses — perfect for MCQ/OSCE prep

Make a quick reference poster comparing all bleeding disorders

Generating Image

A professional A3 medical quick reference poster titled "BLEEDING DISORDERS — Quick Reference Comparison" on a deep navy blue background (#1a2540). Clean, modern clinical design. TOP HEADER: Large white bold title "BLEEDING DISORDERS" with subtitle "Quick Reference Comparison Poster" in lighter blue. Small tagline: "Haemophilia A · Haemophilia B · Haemophilia C · vWD · DIC · Vitamin K Deficiency · Liver Disease · ITP" MAIN CONTENT: A large comparison grid table with colored column headers for each disorder: Column headers (each a distinct color pill/badge): - HAEM A (red) - HAEM B (dark red) - HAEM C (orange) - vWD (blue) - DIC (purple) - VIT K DEF (amber/gold) - LIVER (green) - ITP (teal) Row labels on the left in white bold text: 1. FACTOR DEFICIENT 2. INHERITANCE 3. PT 4. aPTT 5. PLATELETS 6. FIBRINOGEN 7. D-DIMER 8. BLEEDING TYPE 9. KEY TREATMENT Fill each cell with small white text (10-11pt equivalent): Row 1 - Factor: VIII | IX | XI | vWF+VIII | All consumed | II,VII,IX,X | All (not VIII) | None Row 2 - Inheritance: X-linked | X-linked | Autosomal | Autosomal Dom | Acquired | Acquired | Acquired | Autoimmune Row 3 - PT: Normal | Normal | Normal | Normal | ↑↑ | ↑↑ early | ↑↑ | Normal Row 4 - aPTT: ↑↑ | ↑↑ | ↑↑ | Normal/↑ | ↑↑ | ↑ later | ↑↑ | Normal Row 5 - Platelets: Normal | Normal | Normal | Normal | ↓↓ | Normal | ↓ | ↓↓ Row 6 - Fibrinogen: Normal | Normal | Normal | Normal | ↓↓ | Normal | ↓ severe | Normal Row 7 - D-dimer: Normal | Normal | Normal | Normal | ↑↑↑ | Normal | May ↑ | Normal Row 8 - Bleed type: Deep/Joints | Deep/Joints | Post-op | Mucocutaneous | Both+Thrombosis | Mucocutaneous | Mixed | Mucocutaneous Row 9 - Treatment: FVIII conc | FIX conc | FFP+TXA | DDAVP/vWF | Treat cause+FFP | Vit K + PCC | FFP+Vit K | Steroids/IVIG Alternating row shading: dark rows (#1e3060) and slightly lighter rows (#243570) BOTTOM SECTION: Three color-coded info boxes side by side: Box 1 (red header "HAEMOPHILIA DOSING"): Factor VIII: Wt × % rise × 0.5 Factor IX: Wt × % rise × 1.0 1 U/kg FVIII raises level by 2% Target ICH = 100% | Joint = 40-60% Box 2 (purple header "DIC TRIGGERS"): Sepsis (most common) Obstetric emergencies Malignancy (APL classic) Trauma / Burns Mismatched transfusion Box 3 (gold header "VITAMIN K FACTORS"): Factors II, VII, IX, X + Protein C and Protein S Mnemonic: "1972" First to fall: Factor VII (t½ ~6h) Treatment: IV Vit K + PCC VERY BOTTOM: A narrow LAB PATTERN KEY strip in dark background: "↑aPTT only → Haemophilia A/B/C or Heparin | ↑PT only → Factor VII def / Early Vit K | Both ↑PT+aPTT + ↓Plt + ↓Fibrinogen + ↑D-dimer → DIC | ↓Platelets only → ITP | All normal but bleeds → Factor XIII def or mild vWD" Overall: highly readable, professional medical poster style, all text crisp and clear, good contrast, suitable for printing at A3 size. Clean grid lines in light blue-grey.

Bleeding Disorders Quick Reference Poster
Here is your quick reference poster covering all 8 bleeding disorders across every key parameter. Here is a summary of what it contains:

Main Comparison Grid - 9 rows × 8 disorders:
  • Factor deficient, Inheritance, PT, aPTT, Platelets, Fibrinogen, D-dimer, Bleeding type, Key treatment
Three Bottom Info Boxes:
  • Haemophilia Dosing - Factor VIII/IX formulas + target levels
  • DIC Triggers - Sepsis, obstetric, APL, trauma, transfusion
  • Vitamin K Factors - "1972" mnemonic (II, VII, IX, X + Protein C & S)
Lab Pattern Strip at the bottom for quick differential diagnosis:
  • aPTT only raised → Haemophilia
  • PT only raised → Early Vit K / Factor VII
  • Both raised + low platelets + high D-dimer → DIC
  • Platelets only low → ITP
  • All normal but still bleeds → Factor XIII def / mild vWD
This is a shared conversation. Sign in to Orris to start your own chat.