# Ranson criteria

Ranson

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

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

## What it computes

Sum the eleven Ranson 1974 prognostic signs (five at admission, six during the first 48 hours) and return the published mortality band.

## When to use

When an agent already has the published cutoffs as flags and must not invent a Ranson total or an ICU triage decision.

## When not to use

- Not a diagnosis, operative plan, or ICU order. Mortality bands group scores 0-2, 3-4, 5-6, and 7-11 as commonly reported from the 1974 series; magent does not reprint a percent as a prognosis for a named patient.
- Complete score needs 48-hour signs. This tool does not parse raw labs; each cutoff is a boolean. Does not apply the later gallstone-modified cutoffs.

## Formula

```
Ranson = 5 admission signs + 6 signs during first 48 h; each 1 if present; max 11
```

## Citation

[Prognostic signs and the role of operative management in acute pancreatitis](https://pubmed.ncbi.nlm.nih.gov/4834279)
Ranson JH, Rifkind KM, Roses DF, Fink SD, Eng K, Spencer FC
Surg Gynecol Obstet. 1974;139(1):69-81
DOI: none

## Worked example

### No signs

Given: `age_gt_55=false, ast_gt_250=false, base_deficit_gt_4=false, bun_rise_gt_5=false, calcium_lt_8=false, fluid_seq_gt_6l=false, glucose_gt_200=false, hct_drop_gt_10=false, ldh_gt_350=false, pao2_lt_60=false, wbc_gt_16k=false`

1. score = 0
2. band 0-2


### Seven signs present

Given: `age_gt_55=true, ast_gt_250=true, base_deficit_gt_4=false, bun_rise_gt_5=true, calcium_lt_8=false, fluid_seq_gt_6l=false, glucose_gt_200=true, hct_drop_gt_10=true, ldh_gt_350=true, pao2_lt_60=false, wbc_gt_16k=true`

1. score = 7
2. band 7-11


## Also searched as

- Ranson criteria
- Ranson score
- pancreatitis prognostic signs
- Ranson 1974
- acute pancreatitis score

## Parameters

- `age_gt_55` (boolean, required): Admission: age >55 years (Ranson 1974). true or false.
- `wbc_gt_16k` (boolean, required): Admission: WBC >16 000/mm^3. true or false.
- `glucose_gt_200` (boolean, required): Admission: blood glucose >200 mg/dL. true or false.
- `ldh_gt_350` (boolean, required): Admission: LDH >350 IU/L. true or false.
- `ast_gt_250` (boolean, required): Admission: AST >250 U/L. true or false.
- `hct_drop_gt_10` (boolean, required): First 48 h: hematocrit fall >10 percentage points. true or false.
- `bun_rise_gt_5` (boolean, required): First 48 h: BUN rise >5 mg/dL. true or false.
- `calcium_lt_8` (boolean, required): First 48 h: serum calcium <8 mg/dL. true or false.
- `pao2_lt_60` (boolean, required): First 48 h: arterial PaO2 <60 mm Hg. true or false.
- `base_deficit_gt_4` (boolean, required): First 48 h: base deficit >4 mEq/L. true or false.
- `fluid_seq_gt_6l` (boolean, required): First 48 h: estimated fluid sequestration >6 L. true or false.

## 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/ranson`
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_gt_55": "false",
      "ast_gt_250": "false",
      "base_deficit_gt_4": "false",
      "bun_rise_gt_5": "false",
      "calcium_lt_8": "false",
      "fluid_seq_gt_6l": "false",
      "glucose_gt_200": "false",
      "hct_drop_gt_10": "false",
      "ldh_gt_350": "false",
      "pao2_lt_60": "false",
      "wbc_gt_16k": "false"
    },
    {
      "age_gt_55": "false",
      "ast_gt_250": "false",
      "base_deficit_gt_4": "false",
      "bun_rise_gt_5": "false",
      "calcium_lt_8": "false",
      "fluid_seq_gt_6l": "false",
      "glucose_gt_200": "false",
      "hct_drop_gt_10": "false",
      "ldh_gt_350": "false",
      "pao2_lt_60": "false",
      "wbc_gt_16k": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/ranson",
  "items": [
    {
      "components": [
        {
          "factor": "age_gt_55",
          "points": 0,
          "present": false
        },
        {
          "factor": "wbc_gt_16k",
          "points": 0,
          "present": false
        },
        {
          "factor": "glucose_gt_200",
          "points": 0,
          "present": false
        },
        {
          "factor": "ldh_gt_350",
          "points": 0,
          "present": false
        },
        {
          "factor": "ast_gt_250",
          "points": 0,
          "present": false
        },
        {
          "factor": "hct_drop_gt_10",
          "points": 0,
          "present": false
        },
        {
          "factor": "bun_rise_gt_5",
          "points": 0,
          "present": false
        },
        {
          "factor": "calcium_lt_8",
          "points": 0,
          "present": false
        },
        {
          "factor": "pao2_lt_60",
          "points": 0,
          "present": false
        },
        {
          "factor": "base_deficit_gt_4",
          "points": 0,
          "present": false
        },
        {
          "factor": "fluid_seq_gt_6l",
          "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": "Ranson JH, Rifkind KM, Roses DF, Fink SD, Eng K, Spencer FC",
        "id": "ranson-1974",
        "pmid": "4834279",
        "source": "Surg Gynecol Obstet. 1974;139(1):69-81",
        "title": "Prognostic signs and the role of operative management in acute pancreatitis"
      },
      "formula": "ranson",
      "formula_expression": "Ranson = 5 admission signs + 6 signs during first 48 h; each 1 if present; max 11",
      "max_score": 11,
      "score": 0,
      "mortality_band": "0-2"
    },
    {
      "components": [
        {
          "factor": "age_gt_55",
          "points": 0,
          "present": false
        },
        {
          "factor": "wbc_gt_16k",
          "points": 0,
          "present": false
        },
        {
          "factor": "glucose_gt_200",
          "points": 0,
          "present": false
        },
        {
          "factor": "ldh_gt_350",
          "points": 0,
          "present": false
        },
        {
          "factor": "ast_gt_250",
          "points": 0,
          "present": false
        },
        {
          "factor": "hct_drop_gt_10",
          "points": 0,
          "present": false
        },
        {
          "factor": "bun_rise_gt_5",
          "points": 0,
          "present": false
        },
        {
          "factor": "calcium_lt_8",
          "points": 0,
          "present": false
        },
        {
          "factor": "pao2_lt_60",
          "points": 0,
          "present": false
        },
        {
          "factor": "base_deficit_gt_4",
          "points": 0,
          "present": false
        },
        {
          "factor": "fluid_seq_gt_6l",
          "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": "Ranson JH, Rifkind KM, Roses DF, Fink SD, Eng K, Spencer FC",
        "id": "ranson-1974",
        "pmid": "4834279",
        "source": "Surg Gynecol Obstet. 1974;139(1):69-81",
        "title": "Prognostic signs and the role of operative management in acute pancreatitis"
      },
      "formula": "ranson",
      "formula_expression": "Ranson = 5 admission signs + 6 signs during first 48 h; each 1 if present; max 11",
      "max_score": 11,
      "score": 0,
      "mortality_band": "0-2"
    }
  ]
}
```

## Response fields

- `formula` (string): ranson
- `formula_expression` (string): Exact expression used
- `score` (integer): Ranson points 0-11
- `max_score` (integer): 11
- `mortality_band` (string): Published grouped mortality: 0-2, 3-4, 5-6, or 7-11. A band, not an ICU order.
- `components` (array): Per-sign points
- `citation` (object): Ranson et al. 1974 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "factor": "age_gt_55",
      "points": 0,
      "present": false
    },
    {
      "factor": "wbc_gt_16k",
      "points": 0,
      "present": false
    },
    {
      "factor": "glucose_gt_200",
      "points": 0,
      "present": false
    },
    {
      "factor": "ldh_gt_350",
      "points": 0,
      "present": false
    },
    {
      "factor": "ast_gt_250",
      "points": 0,
      "present": false
    },
    {
      "factor": "hct_drop_gt_10",
      "points": 0,
      "present": false
    },
    {
      "factor": "bun_rise_gt_5",
      "points": 0,
      "present": false
    },
    {
      "factor": "calcium_lt_8",
      "points": 0,
      "present": false
    },
    {
      "factor": "pao2_lt_60",
      "points": 0,
      "present": false
    },
    {
      "factor": "base_deficit_gt_4",
      "points": 0,
      "present": false
    },
    {
      "factor": "fluid_seq_gt_6l",
      "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": "Ranson JH, Rifkind KM, Roses DF, Fink SD, Eng K, Spencer FC",
    "id": "ranson-1974",
    "pmid": "4834279",
    "source": "Surg Gynecol Obstet. 1974;139(1):69-81",
    "title": "Prognostic signs and the role of operative management in acute pancreatitis"
  },
  "formula": "ranson",
  "formula_expression": "Ranson = 5 admission signs + 6 signs during first 48 h; each 1 if present; max 11",
  "max_score": 11,
  "score": 0,
  "mortality_band": "0-2"
}
```

## Errors

- 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

- [BISAP](https://magentlab.com/docs/bisap) — Compute the Wu 2008 BISAP score for early prediction of mortality in acute pancreatitis from BUN, caller-assigned impaired mental status, caller-assigned SIRS, age, and caller-assigned pleural effusion.

## 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 echoing accepted, payload, and extensions when present).
- 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.
- 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.
