# Edinburgh gastric ulcer score (EGUS)

EGUS

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

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

## What it computes

Return the Brindle 2021 Edinburgh gastric ulcer score (age, ulcer size, and location; total 0-6) and the published Youden cut higher_malignancy_risk at score ≥ 3.

## When to use

When an agent already has age, endoscopist-estimated ulcer size in cm, and antral versus non-antral location at index OGD and needs the published 0-6 total and ≥3 cut. magent does not read endoscopy images or decide follow-up OGD.

## When not to use

- Not a medical device. Not a biopsy protocol, follow-up-OGD order, or gastric-cancer diagnosis.
- Human gastric ulcer malignancy risk at index OGD (Brindle 2021). Not equine EGUS (equine gastric ulcer syndrome).
- The score applies only alongside a macroscopically benign appearance and at least six negative biopsies, as that paper states. magent does not read endoscopy images, measure the ulcer, or assign location.
- Age <68 scores 0; 68-79 scores 1; ≥80 scores 2. Ulcer size <1.25 cm scores 0; 1.25-2.99 cm scores 2; ≥3.00 cm scores 3. There is no 1-point size band. Location antral (antrum or pre-pylorus) scores 0; non-antral scores 1. The caller assigns location as antral or non-antral.
- higher_malignancy_risk is the published Youden cut score ≥ 3 of 6. Derivation NPV below 3 was 97.4%; validation NPV was 98.6% (Brindle 2021 citation facts). magent does not emit extra risk classes or follow-up bands.

## Formula

```
EGUS = age_points + ulcer_size_points + location_points; age <68 → 0, 68-79 → 1, ≥80 → 2; size <1.25 cm → 0, 1.25-2.99 cm → 2, ≥3.00 cm → 3 (no 1-point size band); antral 0, non-antral 1; max 6; higher_malignancy_risk iff score ≥ 3 (Brindle 2021 Youden cut)
```

## Citation

[Risk stratifying gastric ulcers: development and validation of a scoring system](https://doi.org/10.1136/flgastro-2020-101759)
Brindle WM, Grant RK, Smith M, Suddaby M, Wallace A, Gillespie SL, Church NI, Noble CL, Penman ID, Plevris JN, Robertson AR, Watson EF, Selinger CP, Kalla R, Masterton GSM, EGAR (Edinburgh GI Audit and Research) Collaborative
Frontline Gastroenterol. 2021;13(2):111-118
DOI: [10.1136/flgastro-2020-101759](https://doi.org/10.1136/flgastro-2020-101759)

## Worked example

### Age 50, 1.0 cm antral ulcer

Given: `age=50, location=antral, ulcer_size_cm=1.0`

1. age 50 → 0; ulcer_size_cm 1.0 (<1.25) → 0; location antral → 0
2. Score = 0 (max 6); higher_malignancy_risk false


### Age 80, 3.0 cm non-antral ulcer

Given: `age=80, location=non-antral, ulcer_size_cm=3.0`

1. age 80 → 2; ulcer_size_cm 3.0 (≥3.00) → 3; location non-antral → 1
2. Score = 6 (max 6); higher_malignancy_risk true


## Also searched as

- Edinburgh gastric ulcer score
- EGUS
- Brindle gastric ulcer score
- gastric ulcer malignancy risk score
- antral gastric ulcer score
- Brindle 2021 gastric ulcer
- index OGD gastric ulcer score
- human gastric ulcer risk score

## Parameters

- `age` (integer, required): Age in years (18-120). Brindle 2021: <68 → 0; 68-79 → 1; ≥80 → 2.
- `ulcer_size_cm` (number, required): Endoscopist-estimated ulcer size in cm as assigned by the caller (Brindle 2021). <1.25 cm → 0; 1.25-2.99 cm → 2; ≥3.00 cm → 3. There is no 1-point size band. Magent clamp 0.1-40, not a published range. magent does not measure the ulcer.
- `location` (string, required): Caller-assigned ulcer location (Brindle 2021). antral (antrum or pre-pylorus) scores 0; non-antral scores 1. Case-insensitive. magent does not read endoscopy images or assign location.

## Bulk (POST)

POST the same path with a JSON items array. The first item is the GET unit; each additional item is $0.002. Invalid items return HTTP 400 before settlement.

Method: `POST /api/calc/egus`
Max items: 25
Price: unit_amount + extra_item_amount * (n - 1) (unit 5000 atomic, extra 2000 atomic)
Status: PREVIEW

- 1 to 25 items. Each item uses the same keys as the GET query parameters.
- POST of 1 item costs the same as GET. Lists longer than 25: chunk into multiple POSTs. Extra items still execute; do not pad dummy rows.
- 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": [
    {
      "age": "50",
      "location": "antral",
      "ulcer_size_cm": "1.0"
    },
    {
      "age": "50",
      "location": "antral",
      "ulcer_size_cm": "1.0"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/egus",
  "items": [
    {
      "components": [
        {
          "value": 50,
          "factor": "age",
          "points": 0,
          "present": true
        },
        {
          "value": 1.0,
          "factor": "ulcer_size_cm",
          "points": 0,
          "present": true
        },
        {
          "value": "antral",
          "factor": "location",
          "points": 0,
          "present": true
        }
      ],
      "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": "Brindle WM, Grant RK, Smith M, Suddaby M, Wallace A, Gillespie SL, Church NI, Noble CL, Penman ID, Plevris JN, Robertson AR, Watson EF, Selinger CP, Kalla R, Masterton GSM, EGAR (Edinburgh GI Audit and Research) Collaborative",
        "doi": "10.1136/flgastro-2020-101759",
        "id": "brindle-2021",
        "pmid": "35295750",
        "source": "Frontline Gastroenterol. 2021;13(2):111-118",
        "title": "Risk stratifying gastric ulcers: development and validation of a scoring system"
      },
      "formula": "egus",
      "formula_expression": "EGUS = age_points + ulcer_size_points + location_points; age <68 → 0, 68-79 → 1, ≥80 → 2; size <1.25 cm → 0, 1.25-2.99 cm → 2, ≥3.00 cm → 3 (no 1-point size band); antral 0, non-antral 1; max 6; higher_malignancy_risk iff score ≥ 3 (Brindle 2021 Youden cut)",
      "max_score": 6,
      "score": 0,
      "higher_malignancy_risk": false
    },
    {
      "components": [
        {
          "value": 50,
          "factor": "age",
          "points": 0,
          "present": true
        },
        {
          "value": 1.0,
          "factor": "ulcer_size_cm",
          "points": 0,
          "present": true
        },
        {
          "value": "antral",
          "factor": "location",
          "points": 0,
          "present": true
        }
      ],
      "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": "Brindle WM, Grant RK, Smith M, Suddaby M, Wallace A, Gillespie SL, Church NI, Noble CL, Penman ID, Plevris JN, Robertson AR, Watson EF, Selinger CP, Kalla R, Masterton GSM, EGAR (Edinburgh GI Audit and Research) Collaborative",
        "doi": "10.1136/flgastro-2020-101759",
        "id": "brindle-2021",
        "pmid": "35295750",
        "source": "Frontline Gastroenterol. 2021;13(2):111-118",
        "title": "Risk stratifying gastric ulcers: development and validation of a scoring system"
      },
      "formula": "egus",
      "formula_expression": "EGUS = age_points + ulcer_size_points + location_points; age <68 → 0, 68-79 → 1, ≥80 → 2; size <1.25 cm → 0, 1.25-2.99 cm → 2, ≥3.00 cm → 3 (no 1-point size band); antral 0, non-antral 1; max 6; higher_malignancy_risk iff score ≥ 3 (Brindle 2021 Youden cut)",
      "max_score": 6,
      "score": 0,
      "higher_malignancy_risk": false
    }
  ]
}
```

## Response fields

- `formula` (string): egus
- `formula_expression` (string): Exact expression used
- `score` (integer): Total points 0-6
- `max_score` (integer): Always 6
- `higher_malignancy_risk` (boolean): true iff score ≥ 3 (Brindle 2021 Youden cut). Not a gastric-cancer diagnosis.
- `components` (array): Age, ulcer-size, and location points
- `citation` (object): Brindle 2021 citation
- `disclaimer` (string): Not a medical device

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": 50,
      "factor": "age",
      "points": 0,
      "present": true
    },
    {
      "value": 1.0,
      "factor": "ulcer_size_cm",
      "points": 0,
      "present": true
    },
    {
      "value": "antral",
      "factor": "location",
      "points": 0,
      "present": true
    }
  ],
  "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": "Brindle WM, Grant RK, Smith M, Suddaby M, Wallace A, Gillespie SL, Church NI, Noble CL, Penman ID, Plevris JN, Robertson AR, Watson EF, Selinger CP, Kalla R, Masterton GSM, EGAR (Edinburgh GI Audit and Research) Collaborative",
    "doi": "10.1136/flgastro-2020-101759",
    "id": "brindle-2021",
    "pmid": "35295750",
    "source": "Frontline Gastroenterol. 2021;13(2):111-118",
    "title": "Risk stratifying gastric ulcers: development and validation of a scoring system"
  },
  "formula": "egus",
  "formula_expression": "EGUS = age_points + ulcer_size_points + location_points; age <68 → 0, 68-79 → 1, ≥80 → 2; size <1.25 cm → 0, 1.25-2.99 cm → 2, ≥3.00 cm → 3 (no 1-point size band); antral 0, non-antral 1; max 6; higher_malignancy_risk iff score ≥ 3 (Brindle 2021 Youden cut)",
  "max_score": 6,
  "score": 0,
  "higher_malignancy_risk": false
}
```

## Errors

- HTTP 400 `invalid_age`: age must be an integer from 18 to 120 Returned before settlement; you are not charged.
- HTTP 400 `invalid_egus`: EGUS inputs must match Brindle 2021 age, ulcer size, and location bands from that paper. 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

- [Rockall](https://magentlab.com/docs/rockall) — Compute the Rockall 1996 complete (post-endoscopy) score from age, heart rate, systolic blood pressure, caller-assigned comorbidity, diagnosis, and stigmata of recent haemorrhage after acute upper gastrointestinal haemorrhage.
- [AIMS65](https://magentlab.com/docs/aims65) — Compute the Saltzman 2011 AIMS65 score for in-hospital mortality in acute upper GI bleeding from albumin, INR, caller-assigned altered mental status, systolic blood pressure, and age.

## Payment

Unpaid requests return HTTP 402 even if query parameters or POST items are missing or invalid, so CDP and agents can index the path. After a PAYMENT-SIGNATURE, 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 accepts[0] (exact, EIP-3009) with validBefore = now + maxTimeoutSeconds (600 seconds), or accepts[1] (batch-settlement deposit/voucher) on product GET. Ping and POST {items} stay exact. Magent retries transient facilitator 429/5xx before answering.
- Retry the same URL with PAYMENT-SIGNATURE (base64 JSON of accepted and payload). Magent attaches canonical extensions.bazaar on CDP verify/settle; echoing 402 bazaar is optional.
- Success is HTTP 200 JSON plus PAYMENT-RESPONSE. exact settles before the tool. batch-settlement verifies (and deposit-settles) before the tool and commits the charge after HTTP 2xx. HTTP 503: retry the same PAYMENT-SIGNATURE. Mint a new exact 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.
- offered `batch-settlement` on eip155:8453: Payment-channel vouchers claimed later in batches. Exact stays accepts[0]. Same-path POST {items} is still exact. extra.assetTransferMethod=eip3009 extra.paymentFlow=authorization.

- 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.

Same-path POST {items} is still scheme exact: one EIP-3009 authorization for GET unit plus $0.002 per extra item. 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

- HTTP 402 is unpaid, including a missing query. After PAYMENT-SIGNATURE, invalid parameters return HTTP 400 before settlement. You are not charged. HTTP 402 never includes the tool JSON.
- exact: settlement finishes before the tool (paymentFlow upfront). batch-settlement: verify/deposit before the tool; chargedCumulativeAmount commits after HTTP 2xx. 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.
