# Fistula Risk Score after pancreatoduodenectomy

Fistula Risk Score

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

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

## What it computes

Sum the Callery 2013 Fistula Risk Score from caller-assigned gland texture, pathology, pancreatic duct diameter, and estimated blood loss, and return the published 0–10 total and fistula band.

## When to use

When an agent has already assigned Callery 2013 intraoperative inputs after pancreatoduodenectomy and needs the published integer FRS total and band, not a CR-POPF diagnosis, ISGPS grade, Ranson, or BISAP score.

## When not to use

- Not a medical device. magent does not palpate the gland or measure EBL. Gland texture, pathology, duct diameter, and EBL are caller-assigned intraoperative values.
- Intraoperative assignment: Callery 2013 is scored at pancreatoduodenectomy, not from a preoperative chart.
- Does not grade CR-POPF and is not an ISGPS grade. The score is a published risk total, not a fistula diagnosis.
- Not Ranson and not BISAP. This tool is the Callery 2013 Fistula Risk Score only.

## Formula

```
FRS = gland_texture (firm 0, soft 2) + pathology (pdac_or_pancreatitis 0, other 1) + duct_mm (>=5 0, >=4 1, >=3 2, >=2 3, else 4) + ebl_ml (<=400 0, <=700 1, <=1000 2, else 3); Callery 2013; max 10; negligible 0, low 1-2, intermediate 3-6, high 7-10
```

## Citation

[A prospectively validated clinical risk score accurately predicts pancreatic fistula after pancreatoduodenectomy.](https://doi.org/10.1016/j.jamcollsurg.2012.09.002)
Callery MP, Pratt WB, Kent TS, Chaikof EL, Vollmer CM
J Am Coll Surg. 2013;216(1):1-14
DOI: [10.1016/j.jamcollsurg.2012.09.002](https://doi.org/10.1016/j.jamcollsurg.2012.09.002)

## Worked example

### Firm PDAC, 5 mm duct, EBL 300 mL

Given: `duct_mm=5, ebl_ml=300, gland_texture=firm, pathology=pdac_or_pancreatitis`

1. firm → 0; pdac_or_pancreatitis → 0; duct 5 mm → 0; EBL 300 → 0
2. Score = 0 (max 10); fistula_band negligible


### Soft other pathology, 1 mm duct, EBL 1100 mL

Given: `duct_mm=1, ebl_ml=1100, gland_texture=soft, pathology=other`

1. soft → 2; other → 1; duct 1 mm → 4; EBL 1100 → 3
2. Score = 10 (max 10); fistula_band high


## Also searched as

- Fistula Risk Score
- Callery FRS
- pancreatic fistula risk
- CR-POPF risk score
- Callery 2013 score
- pancreatoduodenectomy fistula
- soft pancreas fistula score

## Parameters

- `gland_texture` (string, required): Caller-assigned pancreatic gland texture at pancreatoduodenectomy (Callery 2013). firm or soft. firm scores 0; soft scores 2. magent does not palpate the gland.
- `pathology` (string, required): Caller-assigned pathology (Callery 2013). pdac_or_pancreatitis (pancreatic ductal adenocarcinoma or pancreatitis) scores 0. other (ampullary, duodenal, cystic, or islet cell) scores 1.
- `duct_mm` (number, required): Caller-assigned pancreatic duct diameter in mm, number 0.5–20 (Callery 2013 integer-mm table). ≥5 scores 0; ≥4 scores 1; ≥3 scores 2; ≥2 scores 3; else 4 (so 4.0–4.999 scores 1; 1.5 and ≤1 score 4). magent does not measure the duct.
- `ebl_ml` (number, required): Caller-assigned estimated blood loss in mL, number 0–10000 (Callery 2013). ≤400 scores 0; 401–700 scores 1; 701–1000 scores 2; >1000 scores 3. magent does not measure EBL.

## 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/fistula_risk`
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": [
    {
      "duct_mm": "5",
      "ebl_ml": "300",
      "gland_texture": "firm",
      "pathology": "pdac_or_pancreatitis"
    },
    {
      "duct_mm": "5",
      "ebl_ml": "300",
      "gland_texture": "firm",
      "pathology": "pdac_or_pancreatitis"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/fistula_risk",
  "items": [
    {
      "components": [
        {
          "value": "firm",
          "factor": "gland_texture",
          "points": 0,
          "present": true
        },
        {
          "value": "pdac_or_pancreatitis",
          "factor": "pathology",
          "points": 0,
          "present": true
        },
        {
          "value": 5.0,
          "factor": "duct_mm",
          "points": 0,
          "present": true
        },
        {
          "value": 300.0,
          "factor": "ebl_ml",
          "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": "Callery MP, Pratt WB, Kent TS, Chaikof EL, Vollmer CM",
        "doi": "10.1016/j.jamcollsurg.2012.09.002",
        "id": "callery-2013",
        "pmid": "23122535",
        "source": "J Am Coll Surg. 2013;216(1):1-14",
        "title": "A prospectively validated clinical risk score accurately predicts pancreatic fistula after pancreatoduodenectomy."
      },
      "formula": "fistula_risk",
      "formula_expression": "FRS = gland_texture (firm 0, soft 2) + pathology (pdac_or_pancreatitis 0, other 1) + duct_mm (>=5 0, >=4 1, >=3 2, >=2 3, else 4) + ebl_ml (<=400 0, <=700 1, <=1000 2, else 3); Callery 2013; max 10; negligible 0, low 1-2, intermediate 3-6, high 7-10",
      "max_score": 10,
      "score": 0,
      "duct_mm": 5.0,
      "ebl_ml": 300.0,
      "fistula_band": "negligible",
      "gland_texture": "firm",
      "pathology": "pdac_or_pancreatitis"
    },
    {
      "components": [
        {
          "value": "firm",
          "factor": "gland_texture",
          "points": 0,
          "present": true
        },
        {
          "value": "pdac_or_pancreatitis",
          "factor": "pathology",
          "points": 0,
          "present": true
        },
        {
          "value": 5.0,
          "factor": "duct_mm",
          "points": 0,
          "present": true
        },
        {
          "value": 300.0,
          "factor": "ebl_ml",
          "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": "Callery MP, Pratt WB, Kent TS, Chaikof EL, Vollmer CM",
        "doi": "10.1016/j.jamcollsurg.2012.09.002",
        "id": "callery-2013",
        "pmid": "23122535",
        "source": "J Am Coll Surg. 2013;216(1):1-14",
        "title": "A prospectively validated clinical risk score accurately predicts pancreatic fistula after pancreatoduodenectomy."
      },
      "formula": "fistula_risk",
      "formula_expression": "FRS = gland_texture (firm 0, soft 2) + pathology (pdac_or_pancreatitis 0, other 1) + duct_mm (>=5 0, >=4 1, >=3 2, >=2 3, else 4) + ebl_ml (<=400 0, <=700 1, <=1000 2, else 3); Callery 2013; max 10; negligible 0, low 1-2, intermediate 3-6, high 7-10",
      "max_score": 10,
      "score": 0,
      "duct_mm": 5.0,
      "ebl_ml": 300.0,
      "fistula_band": "negligible",
      "gland_texture": "firm",
      "pathology": "pdac_or_pancreatitis"
    }
  ]
}
```

## Response fields

- `formula` (string): fistula_risk
- `formula_expression` (string): Exact expression used
- `score` (integer): Callery 2013 Fistula Risk Score 0-10
- `max_score` (integer): 10
- `fistula_band` (string): Callery 2013 band: negligible (0), low (1-2), intermediate (3-6), or high (7-10). Not a CR-POPF diagnosis and not an ISGPS grade.
- `gland_texture` (string): Caller-assigned gland texture used (firm or soft)
- `pathology` (string): Caller-assigned pathology used (pdac_or_pancreatitis or other)
- `duct_mm` (number): Pancreatic duct diameter in mm used
- `ebl_ml` (number): Estimated blood loss in mL used
- `components` (array): Per-factor Callery 2013 points
- `citation` (object): Callery et al. J Am Coll Surg 2013 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": "firm",
      "factor": "gland_texture",
      "points": 0,
      "present": true
    },
    {
      "value": "pdac_or_pancreatitis",
      "factor": "pathology",
      "points": 0,
      "present": true
    },
    {
      "value": 5.0,
      "factor": "duct_mm",
      "points": 0,
      "present": true
    },
    {
      "value": 300.0,
      "factor": "ebl_ml",
      "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": "Callery MP, Pratt WB, Kent TS, Chaikof EL, Vollmer CM",
    "doi": "10.1016/j.jamcollsurg.2012.09.002",
    "id": "callery-2013",
    "pmid": "23122535",
    "source": "J Am Coll Surg. 2013;216(1):1-14",
    "title": "A prospectively validated clinical risk score accurately predicts pancreatic fistula after pancreatoduodenectomy."
  },
  "formula": "fistula_risk",
  "formula_expression": "FRS = gland_texture (firm 0, soft 2) + pathology (pdac_or_pancreatitis 0, other 1) + duct_mm (>=5 0, >=4 1, >=3 2, >=2 3, else 4) + ebl_ml (<=400 0, <=700 1, <=1000 2, else 3); Callery 2013; max 10; negligible 0, low 1-2, intermediate 3-6, high 7-10",
  "max_score": 10,
  "score": 0,
  "duct_mm": 5.0,
  "ebl_ml": 300.0,
  "fistula_band": "negligible",
  "gland_texture": "firm",
  "pathology": "pdac_or_pancreatitis"
}
```

## Errors

- HTTP 400 `invalid_fistula_risk`: gland_texture must be firm or soft, pathology pdac_or_pancreatitis or other, duct_mm a number 0.5-20, and ebl_ml a number 0-10000 (Callery 2013 Fistula Risk Score). 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

- [Ranson](https://magentlab.com/docs/ranson) — Sum the eleven Ranson 1974 prognostic signs (five at admission, six during the first 48 hours) and return the published mortality band.
- [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 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.
