# Glasgow-Blatchford score

Glasgow-Blatchford score

Status: LIVE
Price: $0.005 USDC
`GET /api/calc/glasgow_blatchford`
HTML: https://magentlab.com/docs/glasgow-blatchford
Markdown: https://magentlab.com/docs/glasgow-blatchford.md

Not a medical device. Not a diagnosis, dose, or listing recommendation.

## What it computes

Compute the Blatchford 2000 Glasgow-Blatchford score from urea, haemoglobin, systolic BP, heart rate, and four clinical flags.

## When to use

When an agent needs the Blatchford 2000 Glasgow-Blatchford arithmetic for upper-gastrointestinal haemorrhage and must not invent Rockall, AIMS65, or extra GBS risk bands.

## When not to use

- Not a diagnosis of the cause or severity of bleeding.
- Not Rockall (full or pre-endoscopy) and not AIMS65.
- Score 0 is the published low-risk screen for needing treatment; magent does not invent other GBS bands.
- Urea may be mmol/L or BUN mg/dL (÷ 2.8); haemoglobin may be g/L or g/dL (× 10). Points use unrounded converted SI values.
- Adults as in Blatchford 2000. The caller assigns findings; magent does not examine the patient.

## Formula

```
GBS = urea_mmol_l table + haemoglobin_g_l table (sex-specific) + systolic_mm_hg table + (heart_rate_bpm >= 100) + melena + 2*syncope + 2*hepatic_disease + 2*cardiac_failure; max 23; score 0 low, else not_low
```

## Citation

[A risk score to predict need for treatment for upper-gastrointestinal haemorrhage](https://doi.org/10.1016/S0140-6736(00)02816-6)
Blatchford O, Murray WR, Blatchford M
Lancet. 2000;356(9238):1318-1321
DOI: [10.1016/S0140-6736(00)02816-6](https://doi.org/10.1016/S0140-6736(00)02816-6)

## Worked example

### All items absent (score 0, low)

Given: `cardiac_failure=false, heart_rate_bpm=80, hemoglobin_g_l=140, hepatic_disease=false, melena=false, sex=male, syncope=false, systolic_mm_hg=120, urea_mmol_l=5.0`

1. Urea 5.0 mmol/L < 6.5 → 0; male Hb 140 g/L ≥ 130 → 0; SBP 120 ≥ 110 → 0; HR 80 is not ≥100 → 0
2. Melena, syncope, hepatic disease, and cardiac failure all false
3. Score = 0 (max 23); gbs_risk low


### Urea 25.0 mmol/L scores 6 (not_low)

Given: `cardiac_failure=false, heart_rate_bpm=80, hemoglobin_g_l=140, hepatic_disease=false, melena=false, sex=male, syncope=false, systolic_mm_hg=120, urea_mmol_l=25.0`

1. Urea 25.0 mmol/L ≥ 25.0 → 6; remaining items absent
2. Score = 6 (max 23); gbs_risk not_low


## Also searched as

- Glasgow-Blatchford score
- GBS
- Blatchford score
- upper GI bleed score
- UGIB risk score
- Glasgow Blatchford

## Parameters

- `sex` (string, required): Sex (female or male). Haemoglobin points use the Blatchford 2000 sex-specific table.
- `urea_mmol_l` (number, optional): Blood urea in mmol/L (1-50). Provide this or bun_mg_dl, not both. <6.5 scores 0; 6.5–7.9 scores 2; 8.0–9.9 scores 3; 10.0–24.9 scores 4; ≥25.0 scores 6.
- `bun_mg_dl` (number, optional): BUN in mg/dL (3-140). Converted as urea_mmol_l = bun_mg_dl / 2.8. Provide this or urea_mmol_l, not both.
- `hemoglobin_g_l` (number, optional): Haemoglobin in g/L (30-220). Provide this or hemoglobin_g_dl, not both. Men: <100 → 6; 100–119 → 3; 120–129 → 1; ≥130 → 0. Women: <100 → 6; 100–119 → 1; ≥120 → 0.
- `hemoglobin_g_dl` (number, optional): Haemoglobin in g/dL (3-22). Converted as hemoglobin_g_l = hemoglobin_g_dl × 10. Provide this or hemoglobin_g_l, not both.
- `systolic_mm_hg` (number, required): Systolic blood pressure in mm Hg (50-250). <90 scores 3; 90–99 scores 2; 100–109 scores 1; ≥110 scores 0.
- `heart_rate_bpm` (integer, required): Heart rate in beats per minute (integer 30-220). Scores 1 when ≥100; 99 does not score.
- `melena` (boolean, required): Melena as assigned by the caller. true or false. 1 point if true.
- `syncope` (boolean, required): Syncope as assigned by the caller. true or false. 2 points if true.
- `hepatic_disease` (boolean, required): Hepatic disease as assigned by the caller. true or false. 2 points if true.
- `cardiac_failure` (boolean, required): Cardiac failure as assigned by the caller. true or false. 2 points if true.

## Bulk (POST)

POST the same path with a JSON items array. Price is n times the GET unit. Invalid items return HTTP 400 before settlement.

Method: `POST /api/calc/glasgow_blatchford`
Max items: 25
Price: unit_amount * n (unit 5000 atomic)
Status: PREVIEW

- 1 to 25 items. Each item uses the same keys as the GET query parameters.
- The first invalid item fails the whole request (index in the 400 JSON). You are not charged.
- HTTP 200 is {count, path, items}. Each items[i] is the GET 200 body for that row.
- Catalog misses (empty matches, found=false) stay paid 200s inside that slot.
- x402 resource URL is this path plus n and body_sha256. Browsers that prefer text/html get the same paywall as GET; Pay retries POST with the same items.

Example request:

```json
{
  "items": [
    {
      "cardiac_failure": "false",
      "heart_rate_bpm": "80",
      "hemoglobin_g_l": "140",
      "hepatic_disease": "false",
      "melena": "false",
      "sex": "male",
      "syncope": "false",
      "systolic_mm_hg": "120",
      "urea_mmol_l": "5.0"
    },
    {
      "cardiac_failure": "false",
      "heart_rate_bpm": "80",
      "hemoglobin_g_l": "140",
      "hepatic_disease": "false",
      "melena": "false",
      "sex": "male",
      "syncope": "false",
      "systolic_mm_hg": "120",
      "urea_mmol_l": "5.0"
    }
  ]
}
```

Human paywall (two-item fixture): https://api.magentlab.com/paywall/bulk/glasgow-blatchford

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/glasgow_blatchford",
  "items": [
    {
      "components": [
        {
          "value": 5.0,
          "factor": "urea",
          "points": 0,
          "present": false
        },
        {
          "value": 140.0,
          "factor": "hemoglobin",
          "points": 0,
          "present": false
        },
        {
          "value": 120.0,
          "factor": "systolic",
          "points": 0,
          "present": false
        },
        {
          "value": 80,
          "factor": "heart_rate",
          "points": 0,
          "present": false
        },
        {
          "factor": "melena",
          "points": 0,
          "present": false
        },
        {
          "factor": "syncope",
          "points": 0,
          "present": false
        },
        {
          "factor": "hepatic_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "cardiac_failure",
          "points": 0,
          "present": false
        }
      ],
      "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
      "citation": {
        "authors": "Blatchford O, Murray WR, Blatchford M",
        "doi": "10.1016/S0140-6736(00)02816-6",
        "id": "blatchford-2000",
        "source": "Lancet. 2000;356(9238):1318-1321",
        "title": "A risk score to predict need for treatment for upper-gastrointestinal haemorrhage"
      },
      "formula": "glasgow_blatchford",
      "formula_expression": "GBS = urea_mmol_l table + haemoglobin_g_l table (sex-specific) + systolic_mm_hg table + (heart_rate_bpm >= 100) + melena + 2*syncope + 2*hepatic_disease + 2*cardiac_failure; max 23; score 0 low, else not_low",
      "max_score": 23,
      "score": 0,
      "sex": "male",
      "systolic_mm_hg": 120.0,
      "gbs_risk": "low",
      "heart_rate_bpm": 80,
      "hemoglobin_g_l": 140.0,
      "urea_mmol_l": 5.0
    },
    {
      "components": [
        {
          "value": 5.0,
          "factor": "urea",
          "points": 0,
          "present": false
        },
        {
          "value": 140.0,
          "factor": "hemoglobin",
          "points": 0,
          "present": false
        },
        {
          "value": 120.0,
          "factor": "systolic",
          "points": 0,
          "present": false
        },
        {
          "value": 80,
          "factor": "heart_rate",
          "points": 0,
          "present": false
        },
        {
          "factor": "melena",
          "points": 0,
          "present": false
        },
        {
          "factor": "syncope",
          "points": 0,
          "present": false
        },
        {
          "factor": "hepatic_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "cardiac_failure",
          "points": 0,
          "present": false
        }
      ],
      "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
      "citation": {
        "authors": "Blatchford O, Murray WR, Blatchford M",
        "doi": "10.1016/S0140-6736(00)02816-6",
        "id": "blatchford-2000",
        "source": "Lancet. 2000;356(9238):1318-1321",
        "title": "A risk score to predict need for treatment for upper-gastrointestinal haemorrhage"
      },
      "formula": "glasgow_blatchford",
      "formula_expression": "GBS = urea_mmol_l table + haemoglobin_g_l table (sex-specific) + systolic_mm_hg table + (heart_rate_bpm >= 100) + melena + 2*syncope + 2*hepatic_disease + 2*cardiac_failure; max 23; score 0 low, else not_low",
      "max_score": 23,
      "score": 0,
      "sex": "male",
      "systolic_mm_hg": 120.0,
      "gbs_risk": "low",
      "heart_rate_bpm": 80,
      "hemoglobin_g_l": 140.0,
      "urea_mmol_l": 5.0
    }
  ]
}
```

## Response fields

- `formula` (string): glasgow_blatchford
- `formula_expression` (string): Exact expression used
- `score` (integer): Total points 0-23
- `max_score` (integer): Always 23
- `gbs_risk` (string): low when score is 0; not_low otherwise. Score 0 is the published low-risk screen. magent does not invent other GBS bands.
- `urea_mmol_l` (number): Urea used in mmol/L (after conversion), 1 decimal
- `hemoglobin_g_l` (number): Haemoglobin used in g/L (after conversion), 1 decimal
- `sex` (string): female or male
- `systolic_mm_hg` (number): Systolic BP used, mm Hg
- `heart_rate_bpm` (integer): Heart rate used, beats per minute
- `components` (array): Per-item points
- `citation` (object): Blatchford 2000 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": 5.0,
      "factor": "urea",
      "points": 0,
      "present": false
    },
    {
      "value": 140.0,
      "factor": "hemoglobin",
      "points": 0,
      "present": false
    },
    {
      "value": 120.0,
      "factor": "systolic",
      "points": 0,
      "present": false
    },
    {
      "value": 80,
      "factor": "heart_rate",
      "points": 0,
      "present": false
    },
    {
      "factor": "melena",
      "points": 0,
      "present": false
    },
    {
      "factor": "syncope",
      "points": 0,
      "present": false
    },
    {
      "factor": "hepatic_disease",
      "points": 0,
      "present": false
    },
    {
      "factor": "cardiac_failure",
      "points": 0,
      "present": false
    }
  ],
  "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
  "citation": {
    "authors": "Blatchford O, Murray WR, Blatchford M",
    "doi": "10.1016/S0140-6736(00)02816-6",
    "id": "blatchford-2000",
    "source": "Lancet. 2000;356(9238):1318-1321",
    "title": "A risk score to predict need for treatment for upper-gastrointestinal haemorrhage"
  },
  "formula": "glasgow_blatchford",
  "formula_expression": "GBS = urea_mmol_l table + haemoglobin_g_l table (sex-specific) + systolic_mm_hg table + (heart_rate_bpm >= 100) + melena + 2*syncope + 2*hepatic_disease + 2*cardiac_failure; max 23; score 0 low, else not_low",
  "max_score": 23,
  "score": 0,
  "sex": "male",
  "systolic_mm_hg": 120.0,
  "gbs_risk": "low",
  "heart_rate_bpm": 80,
  "hemoglobin_g_l": 140.0,
  "urea_mmol_l": 5.0
}
```

## Errors

- HTTP 400 `invalid_urea`: urea_mmol_l (1-50) or bun_mg_dl (3-140) is required, not both. Returned before settlement; you are not charged.
- HTTP 400 `invalid_hemoglobin`: hemoglobin_g_l (30-220) or hemoglobin_g_dl (3-22) is required, not both. Returned before settlement; you are not charged.
- HTTP 400 `invalid_sex`: sex must be female or male Returned before settlement; you are not charged.
- HTTP 400 `invalid_systolic_bp`: systolic_mm_hg or systolic_bp_mm_hg must be a number from 50 to 250. Returned before settlement; you are not charged.
- HTTP 400 `invalid_heart_rate`: heart_rate_bpm must be an integer from 30 to 220 Returned before settlement; you are not charged.
- HTTP 400 `invalid_flag`: boolean clinical flags must be true or false Returned before settlement; you are not charged.
- HTTP 400 `invalid_items`: POST body must be a JSON object with only an items array Returned before settlement; you are not charged.
- HTTP 400 `invalid_item_count`: items must be an array of 1 to 25 objects Returned before settlement; you are not charged.
- HTTP 400 `invalid_item`: each items entry must be a JSON object Returned before settlement; you are not charged.

Shared HTTP 402 and 503: https://magentlab.com/docs/payments

## Related tools

- None

## Payment

Required query parameters must be present and valid. Invalid params return HTTP 400 JSON before settlement. magent does not charge. Fix the params, then request a new 402 quote for that complete URL. Catalog misses (empty matches, found=false) are valid paid 200s.

- GET the tool with Accept: application/json (do not send Accept: text/html unless you want the human paywall).
- HTTP 402 means you have not paid. Decode the base64 PAYMENT-REQUIRED header. HTTP 503 is not a new quote.
- Sign EIP-3009 (scheme exact, assetTransferMethod eip3009) with validBefore = now + accepts[0].maxTimeoutSeconds (600 seconds). That window starts when you sign and must cover wallet confirmation plus CDP verify and settle. Magent retries transient facilitator 429/5xx before answering. Do not send upto or batch-settlement payloads; magent does not offer those schemes.
- Retry the same URL with PAYMENT-SIGNATURE (base64 JSON echoing accepted, payload, and extensions when present).
- Success is HTTP 200 JSON plus PAYMENT-RESPONSE. Settlement happens before the tool runs. HTTP 503 settlement_uncertain or settle_failed: retry the same PAYMENT-SIGNATURE. Mint a new nonce only after a new HTTP 402.

- offered `exact` on eip155:8453: Fixed-price USDC on Base. The buyer authorizes the advertised amount (EIP-3009). magent settles before the tool runs (paymentFlow upfront). extra.assetTransferMethod=eip3009 extra.paymentFlow=upfront.

- not offered `upto`: Not offered. Usage-based: buyer authorizes a ceiling, seller settles the actual amount after work. Reserved for a future metered tool. Not for current calculators or code search.
- not offered `batch-settlement`: Not offered. Payment-channel vouchers claimed later in batches. Not the same as POST {items} bulk (that is still exact).

Same-path POST {items} is still scheme exact: one EIP-3009 authorization for n times the GET unit. That is not x402 batch-settlement (payment channels / vouchers).

Shared HTTP 402 and 503 table: https://magentlab.com/docs/payments

Stdio MCP (one process per host): https://magentlab.com/docs/mcp

## Guarantees

- Invalid query parameters return HTTP 400 before settlement. You are not charged.
- Settlement finishes before the tool executes (paymentFlow upfront). Uncertain or failed settlement fails closed (HTTP 503). Retry the same PAYMENT-SIGNATURE.
- HTTP 402 is unpaid only. Do not sign a second authorization because of a 503.
- Execution is timeout-bounded and concurrency-capped.
- Calculator inputs are stored encrypted for allowlisted operators (Magent Console). They are not in public logs, SSH lookups, catalog, or rollups. Request logs store path without query.
