# ASCO irAE colitis grade

irAE colitis

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

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

## What it computes

Apply Brahmer 2018 ASCO Table 2.1 immune-related colitis grading (CTCAE diarrhea as used in the table) and return grade 1-4 plus icpi_action from stools_over_baseline and four caller-assigned flags.

## When to use

When an agent already has the increase of stools per day over baseline and caller-assigned incontinence, hospitalization-indicated, limiting-self-care, and life-threatening flags and needs the published first-match grade and ICI hold or discontinue action. magent does not count stools.

## When not to use

- Not a medical device.
- Not a diagnosis. Not a steroid dose or immunosuppression order.
- magent does not count stools. stools_over_baseline and the four flags are caller-assigned (Brahmer 2018 Table 2.1 CTCAE diarrhea as used in the table).
- Ostomy-output bands are not implemented (stool-increase plus incontinence, hospitalization_indicated, limiting_self_care, and life_threatening only).
- Not SITC 2021. Not CTCAE v5 diarrhea as a separate instrument.

## Formula

```
irae colitis first-match (Brahmer 2018 Table 2.1 CTCAE diarrhea): grade 4 if life_threatening; else grade 3 if stools_over_baseline >= 7 or incontinence or hospitalization_indicated or limiting_self_care; else grade 2 if stools_over_baseline >= 4; else grade 1. icpi_action continue (1), hold (2), hold_consider_discontinue_ctla4 (3), permanently_discontinue (4). Ostomy-output bands not implemented. magent does not count stools. Not a diagnosis. Not a steroid dose
```

## Citation

[Management of Immune-Related Adverse Events in Patients Treated With Immune Checkpoint Inhibitor Therapy: American Society of Clinical Oncology Clinical Practice Guideline](https://doi.org/10.1200/JCO.2017.77.6385)
Brahmer JR, Lacchetti C, Schneider BJ, Atkins MB, Brassil KJ, Caterino JM, Chau I, Ernstoff MS, Gardner JM, Ginex P, Hallmeyer S, Holter Chakrabarty J, Leighl NB, Mammen JS, McDermott DF, Naing A, Nastoupil LJ, Phillips T, Porter LD, Puzanov I, Reichner CA, Santomasso BD, Seigel C, Spira A, Suarez-Almazor ME, Wang Y, Weber JS, Wolchok JD, Thompson JA
J Clin Oncol. 2018;36(17):1714-1768
DOI: [10.1200/JCO.2017.77.6385](https://doi.org/10.1200/JCO.2017.77.6385)

## Worked example

### Two stools over baseline, grade 1 continue

Given: `hospitalization_indicated=false, incontinence=false, life_threatening=false, limiting_self_care=false, stools_over_baseline=2`

1. stools_over_baseline is 2 (increase of fewer than four stools per day over baseline)
2. incontinence, hospitalization_indicated, limiting_self_care, and life_threatening are false
3. first-match is grade 1; icpi_action is continue


### Life-threatening flag, grade 4 discontinue

Given: `hospitalization_indicated=false, incontinence=false, life_threatening=true, limiting_self_care=false, stools_over_baseline=1`

1. life_threatening is true (life-threatening consequences; urgent intervention indicated)
2. stools_over_baseline is 1; first-match grade 4 overrides the stool band
3. icpi_action is permanently_discontinue


## Also searched as

- irAE colitis
- immune-related colitis
- ASCO colitis grade
- Brahmer 2018 colitis
- ICI colitis CTCAE
- checkpoint inhibitor diarrhea
- immune checkpoint colitis grade
- CTCAE diarrhea colitis

## Parameters

- `stools_over_baseline` (integer, required): Increase of stools per day over baseline as assigned by the caller (integer 0-40; Brahmer 2018 Table 2.1 CTCAE diarrhea). Fewer than four is grade 1; four to six is grade 2; seven or more is grade 3 unless life_threatening is true. Ostomy-output increase is not an input. magent does not count stools.
- `incontinence` (boolean, required): Incontinence as assigned by the caller (Brahmer 2018 Table 2.1 grade 3). true or false. When true and life_threatening is false, grade is 3. magent does not examine the patient.
- `hospitalization_indicated` (boolean, required): Hospitalization indicated as assigned by the caller (Brahmer 2018 Table 2.1 grade 3). true or false. When true and life_threatening is false, grade is 3. magent does not admit the patient.
- `limiting_self_care` (boolean, required): Limiting self-care ADL as assigned by the caller (Brahmer 2018 Table 2.1 grade 3). true or false. When true and life_threatening is false, grade is 3. magent does not assess ADL.
- `life_threatening` (boolean, required): Life-threatening consequences with urgent intervention indicated, as assigned by the caller (Brahmer 2018 Table 2.1 grade 4). true or false. When true, grade is 4 regardless of stool count. magent does not examine the patient.

## 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/irae_colitis`
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": [
    {
      "hospitalization_indicated": "false",
      "incontinence": "false",
      "life_threatening": "false",
      "limiting_self_care": "false",
      "stools_over_baseline": "2"
    },
    {
      "hospitalization_indicated": "false",
      "incontinence": "false",
      "life_threatening": "false",
      "limiting_self_care": "false",
      "stools_over_baseline": "2"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/irae_colitis",
  "items": [
    {
      "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": "Brahmer JR, Lacchetti C, Schneider BJ, Atkins MB, Brassil KJ, Caterino JM, Chau I, Ernstoff MS, Gardner JM, Ginex P, Hallmeyer S, Holter Chakrabarty J, Leighl NB, Mammen JS, McDermott DF, Naing A, Nastoupil LJ, Phillips T, Porter LD, Puzanov I, Reichner CA, Santomasso BD, Seigel C, Spira A, Suarez-Almazor ME, Wang Y, Weber JS, Wolchok JD, Thompson JA",
        "doi": "10.1200/JCO.2017.77.6385",
        "id": "brahmer-2018",
        "pmid": "29442540",
        "source": "J Clin Oncol. 2018;36(17):1714-1768",
        "title": "Management of Immune-Related Adverse Events in Patients Treated With Immune Checkpoint Inhibitor Therapy: American Society of Clinical Oncology Clinical Practice Guideline"
      },
      "formula": "irae_colitis",
      "formula_expression": "irae colitis first-match (Brahmer 2018 Table 2.1 CTCAE diarrhea): grade 4 if life_threatening; else grade 3 if stools_over_baseline >= 7 or incontinence or hospitalization_indicated or limiting_self_care; else grade 2 if stools_over_baseline >= 4; else grade 1. icpi_action continue (1), hold (2), hold_consider_discontinue_ctla4 (3), permanently_discontinue (4). Ostomy-output bands not implemented. magent does not count stools. Not a diagnosis. Not a steroid dose",
      "criteria": [
        {
          "factor": "life_threatening",
          "met": false
        },
        {
          "value": 2,
          "factor": "stools_ge_7",
          "met": false
        },
        {
          "factor": "incontinence",
          "met": false
        },
        {
          "factor": "hospitalization_indicated",
          "met": false
        },
        {
          "factor": "limiting_self_care",
          "met": false
        },
        {
          "value": 2,
          "factor": "stools_ge_4",
          "met": false
        }
      ],
      "grade": 1,
      "icpi_action": "continue",
      "life_threatening": false,
      "hospitalization_indicated": false,
      "incontinence": false,
      "limiting_self_care": false,
      "stools_over_baseline": 2
    },
    {
      "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": "Brahmer JR, Lacchetti C, Schneider BJ, Atkins MB, Brassil KJ, Caterino JM, Chau I, Ernstoff MS, Gardner JM, Ginex P, Hallmeyer S, Holter Chakrabarty J, Leighl NB, Mammen JS, McDermott DF, Naing A, Nastoupil LJ, Phillips T, Porter LD, Puzanov I, Reichner CA, Santomasso BD, Seigel C, Spira A, Suarez-Almazor ME, Wang Y, Weber JS, Wolchok JD, Thompson JA",
        "doi": "10.1200/JCO.2017.77.6385",
        "id": "brahmer-2018",
        "pmid": "29442540",
        "source": "J Clin Oncol. 2018;36(17):1714-1768",
        "title": "Management of Immune-Related Adverse Events in Patients Treated With Immune Checkpoint Inhibitor Therapy: American Society of Clinical Oncology Clinical Practice Guideline"
      },
      "formula": "irae_colitis",
      "formula_expression": "irae colitis first-match (Brahmer 2018 Table 2.1 CTCAE diarrhea): grade 4 if life_threatening; else grade 3 if stools_over_baseline >= 7 or incontinence or hospitalization_indicated or limiting_self_care; else grade 2 if stools_over_baseline >= 4; else grade 1. icpi_action continue (1), hold (2), hold_consider_discontinue_ctla4 (3), permanently_discontinue (4). Ostomy-output bands not implemented. magent does not count stools. Not a diagnosis. Not a steroid dose",
      "criteria": [
        {
          "factor": "life_threatening",
          "met": false
        },
        {
          "value": 2,
          "factor": "stools_ge_7",
          "met": false
        },
        {
          "factor": "incontinence",
          "met": false
        },
        {
          "factor": "hospitalization_indicated",
          "met": false
        },
        {
          "factor": "limiting_self_care",
          "met": false
        },
        {
          "value": 2,
          "factor": "stools_ge_4",
          "met": false
        }
      ],
      "grade": 1,
      "icpi_action": "continue",
      "life_threatening": false,
      "hospitalization_indicated": false,
      "incontinence": false,
      "limiting_self_care": false,
      "stools_over_baseline": 2
    }
  ]
}
```

## Response fields

- `formula` (string): irae_colitis
- `formula_expression` (string): Brahmer 2018 Table 2.1 first-match colitis grade and icpi_action rule
- `grade` (integer): Colitis grade 1, 2, 3, or 4 (Brahmer 2018 Table 2.1 CTCAE diarrhea as used in the table). First-match worst-wins. Not a diagnosis.
- `icpi_action` (string): continue (grade 1), hold (grade 2), hold_consider_discontinue_ctla4 (grade 3), or permanently_discontinue (grade 4). Not a steroid dose.
- `stools_over_baseline` (integer): Echo of the caller-assigned stool increase over baseline (0-40)
- `incontinence` (boolean): Echo of caller-assigned incontinence (grade 3 when true)
- `hospitalization_indicated` (boolean): Echo of caller-assigned hospitalization indicated (grade 3 when true)
- `limiting_self_care` (boolean): Echo of caller-assigned limiting self-care ADL (grade 3 when true)
- `life_threatening` (boolean): Echo of caller-assigned life-threatening flag (grade 4 when true)
- `criteria` (array): Per-factor Tree rows with factor and met for life_threatening, stools_ge_7, incontinence, hospitalization_indicated, limiting_self_care, and stools_ge_4; stool rows include value
- `citation` (object): Brahmer 2018 J Clin Oncol ASCO irAE guideline citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "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": "Brahmer JR, Lacchetti C, Schneider BJ, Atkins MB, Brassil KJ, Caterino JM, Chau I, Ernstoff MS, Gardner JM, Ginex P, Hallmeyer S, Holter Chakrabarty J, Leighl NB, Mammen JS, McDermott DF, Naing A, Nastoupil LJ, Phillips T, Porter LD, Puzanov I, Reichner CA, Santomasso BD, Seigel C, Spira A, Suarez-Almazor ME, Wang Y, Weber JS, Wolchok JD, Thompson JA",
    "doi": "10.1200/JCO.2017.77.6385",
    "id": "brahmer-2018",
    "pmid": "29442540",
    "source": "J Clin Oncol. 2018;36(17):1714-1768",
    "title": "Management of Immune-Related Adverse Events in Patients Treated With Immune Checkpoint Inhibitor Therapy: American Society of Clinical Oncology Clinical Practice Guideline"
  },
  "formula": "irae_colitis",
  "formula_expression": "irae colitis first-match (Brahmer 2018 Table 2.1 CTCAE diarrhea): grade 4 if life_threatening; else grade 3 if stools_over_baseline >= 7 or incontinence or hospitalization_indicated or limiting_self_care; else grade 2 if stools_over_baseline >= 4; else grade 1. icpi_action continue (1), hold (2), hold_consider_discontinue_ctla4 (3), permanently_discontinue (4). Ostomy-output bands not implemented. magent does not count stools. Not a diagnosis. Not a steroid dose",
  "criteria": [
    {
      "factor": "life_threatening",
      "met": false
    },
    {
      "value": 2,
      "factor": "stools_ge_7",
      "met": false
    },
    {
      "factor": "incontinence",
      "met": false
    },
    {
      "factor": "hospitalization_indicated",
      "met": false
    },
    {
      "factor": "limiting_self_care",
      "met": false
    },
    {
      "value": 2,
      "factor": "stools_ge_4",
      "met": false
    }
  ],
  "grade": 1,
  "icpi_action": "continue",
  "life_threatening": false,
  "hospitalization_indicated": false,
  "incontinence": false,
  "limiting_self_care": false,
  "stools_over_baseline": 2
}
```

## Errors

- HTTP 400 `invalid_stools_over_baseline`: stools_over_baseline must be an integer from 0 to 40 (Brahmer 2018 CTCAE diarrhea stools per day over baseline). 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

- [irAE hepatitis](https://magentlab.com/docs/irae-hepatitis) — Apply Brahmer 2018 ASCO Table 2.2 immune-related hepatitis lab folds (AST or ALT × ULN and total bilirubin × ULN) and return grade 0–4 plus ICI action, with caller-assigned decompensation (grade 4) and symptomatic compensated liver dysfunction (grade 3) upgrades.
- [Mayo DAI](https://magentlab.com/docs/mayo-uc) — Sum four caller-assigned Schroeder 1987 ulcerative colitis disease-activity index items (each integer 0-3) and return the total (max 12). Does not return later remission or activity bands.

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