# ASCO irAE pneumonitis

irAE pneumonitis

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

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

## What it computes

Apply Brahmer 2018 ASCO Table 3.1 immune-related pneumonitis grading and return grade 1-4 plus the published ICPi hold or permanently-discontinue action from caller-assigned flags.

## When to use

When an agent already has caller-assigned flags for life-threatening respiratory compromise, hospitalization, oxygen, self-care or instrumental ADL limitation, radiographic extent, and symptoms, and needs the published ASCO 2018 pneumonitis grade and ICPi action. magent does not read CT or pulse oximetry.

## When not to use

- Not a medical device.
- Not a diagnosis. Grade is not a pneumonitis diagnosis and not a steroid dose.
- magent does not read CT or pulse oximetry. All flags are caller-assigned.
- ASCO 2018 (Brahmer) Table 3.1 pneumonitis only. Not SITC 2021.
- Not CTCAE pneumonitis as a separate instrument.

## Formula

```
irae_pneumonitis first-match worst-wins (Brahmer 2018 Table 3.1): grade 4 if life_threatening_respiratory; else grade 3 if hospitalization_required or oxygen_indicated or limiting_self_care or all_lobes_or_gt_50_pct; else grade 2 if symptomatic or more_than_one_lobe or extent_25_to_50_pct or limiting_instrumental_adl; else grade 1. icpi_action hold_if_radiographic_progression (grade 1), hold (grade 2), permanently_discontinue (grade 3 or 4). magent does not read CT or pulse oximetry. Not SITC 2021. Not CTCAE pneumonitis as a separate instrument. 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

### Grade 1: all flags false

Given: `all_lobes_or_gt_50_pct=false, extent_25_to_50_pct=false, hospitalization_required=false, life_threatening_respiratory=false, limiting_instrumental_adl=false, limiting_self_care=false, more_than_one_lobe=false, oxygen_indicated=false, symptomatic=false`

1. life_threatening_respiratory false, so not grade 4
2. No grade 3 flags (hospitalization, oxygen, limiting self-care, all lobes or >50%)
3. No grade 2 flags (symptomatic, more than one lobe, 25%-50% parenchyma, limiting instrumental ADL)
4. grade is 1; icpi_action is hold_if_radiographic_progression


### Grade 2: symptomatic only

Given: `all_lobes_or_gt_50_pct=false, extent_25_to_50_pct=false, hospitalization_required=false, life_threatening_respiratory=false, limiting_instrumental_adl=false, limiting_self_care=false, more_than_one_lobe=false, oxygen_indicated=false, symptomatic=true`

1. No grade 4 or grade 3 flags
2. symptomatic true (Brahmer 2018 Table 3.1 grade 2)
3. grade is 2; icpi_action is hold


### Grade 3: oxygen indicated

Given: `all_lobes_or_gt_50_pct=false, extent_25_to_50_pct=false, hospitalization_required=false, life_threatening_respiratory=false, limiting_instrumental_adl=false, limiting_self_care=false, more_than_one_lobe=false, oxygen_indicated=true, symptomatic=false`

1. life_threatening_respiratory false, so not grade 4
2. oxygen_indicated true (Brahmer 2018 Table 3.1 grade 3)
3. grade is 3; icpi_action is permanently_discontinue


### Grade 4: life-threatening respiratory compromise

Given: `all_lobes_or_gt_50_pct=false, extent_25_to_50_pct=false, hospitalization_required=false, life_threatening_respiratory=true, limiting_instrumental_adl=false, limiting_self_care=false, more_than_one_lobe=false, oxygen_indicated=false, symptomatic=false`

1. life_threatening_respiratory true (urgent intervention indicated, intubation)
2. grade is 4; icpi_action is permanently_discontinue


## Also searched as

- irAE pneumonitis
- immune checkpoint pneumonitis
- ASCO 2018 pneumonitis
- Brahmer pneumonitis grade
- ICI pneumonitis
- immune-related lung toxicity
- checkpoint inhibitor pneumonitis
- ICPi pneumonitis hold

## Parameters

- `life_threatening_respiratory` (boolean, required): Life-threatening respiratory compromise with urgent intervention indicated (intubation) as assigned by the caller (Brahmer 2018 Table 3.1 grade 4). true or false. When true, grade is 4 regardless of other flags. magent does not examine the patient or set a ventilator.
- `hospitalization_required` (boolean, required): Hospitalization required as assigned by the caller (Brahmer 2018 Table 3.1 grade 3). true or false. magent does not decide admission.
- `oxygen_indicated` (boolean, required): Oxygen indicated as assigned by the caller (Brahmer 2018 Table 3.1 grade 3). true or false. magent does not read pulse oximetry or start oxygen.
- `limiting_self_care` (boolean, required): Limiting self-care ADL as assigned by the caller (Brahmer 2018 Table 3.1 grade 3). true or false. magent does not assess ADL.
- `all_lobes_or_gt_50_pct` (boolean, required): Involves all lung lobes or >50% of lung parenchyma as assigned by the caller (Brahmer 2018 Table 3.1 grade 3). true or false. magent does not read CT.
- `symptomatic` (boolean, required): Symptomatic as assigned by the caller (Brahmer 2018 Table 3.1 grade 2). true or false. magent does not examine the patient.
- `more_than_one_lobe` (boolean, required): Involves more than one lobe as assigned by the caller (Brahmer 2018 Table 3.1 grade 2). true or false. magent does not read CT.
- `extent_25_to_50_pct` (boolean, required): Involves 25%–50% of lung parenchyma as assigned by the caller (Brahmer 2018 Table 3.1 grade 2). true or false. magent does not read CT.
- `limiting_instrumental_adl` (boolean, required): Limiting instrumental ADL as assigned by the caller (Brahmer 2018 Table 3.1 grade 2). true or false. magent does not assess ADL.

## 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_pneumonitis`
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": [
    {
      "all_lobes_or_gt_50_pct": "false",
      "extent_25_to_50_pct": "false",
      "hospitalization_required": "false",
      "life_threatening_respiratory": "false",
      "limiting_instrumental_adl": "false",
      "limiting_self_care": "false",
      "more_than_one_lobe": "false",
      "oxygen_indicated": "false",
      "symptomatic": "false"
    },
    {
      "all_lobes_or_gt_50_pct": "false",
      "extent_25_to_50_pct": "false",
      "hospitalization_required": "false",
      "life_threatening_respiratory": "false",
      "limiting_instrumental_adl": "false",
      "limiting_self_care": "false",
      "more_than_one_lobe": "false",
      "oxygen_indicated": "false",
      "symptomatic": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/irae_pneumonitis",
  "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_pneumonitis",
      "formula_expression": "irae_pneumonitis first-match worst-wins (Brahmer 2018 Table 3.1): grade 4 if life_threatening_respiratory; else grade 3 if hospitalization_required or oxygen_indicated or limiting_self_care or all_lobes_or_gt_50_pct; else grade 2 if symptomatic or more_than_one_lobe or extent_25_to_50_pct or limiting_instrumental_adl; else grade 1. icpi_action hold_if_radiographic_progression (grade 1), hold (grade 2), permanently_discontinue (grade 3 or 4). magent does not read CT or pulse oximetry. Not SITC 2021. Not CTCAE pneumonitis as a separate instrument. Not a diagnosis. Not a steroid dose",
      "criteria": [
        {
          "factor": "life_threatening_respiratory",
          "met": false
        },
        {
          "factor": "hospitalization_required",
          "met": false
        },
        {
          "factor": "oxygen_indicated",
          "met": false
        },
        {
          "factor": "limiting_self_care",
          "met": false
        },
        {
          "factor": "all_lobes_or_gt_50_pct",
          "met": false
        },
        {
          "factor": "symptomatic",
          "met": false
        },
        {
          "factor": "more_than_one_lobe",
          "met": false
        },
        {
          "factor": "extent_25_to_50_pct",
          "met": false
        },
        {
          "factor": "limiting_instrumental_adl",
          "met": false
        }
      ],
      "grade": 1,
      "icpi_action": "hold_if_radiographic_progression",
      "limiting_self_care": false,
      "all_lobes_or_gt_50_pct": false,
      "extent_25_to_50_pct": false,
      "hospitalization_required": false,
      "life_threatening_respiratory": false,
      "limiting_instrumental_adl": false,
      "more_than_one_lobe": false,
      "oxygen_indicated": false,
      "symptomatic": 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": "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_pneumonitis",
      "formula_expression": "irae_pneumonitis first-match worst-wins (Brahmer 2018 Table 3.1): grade 4 if life_threatening_respiratory; else grade 3 if hospitalization_required or oxygen_indicated or limiting_self_care or all_lobes_or_gt_50_pct; else grade 2 if symptomatic or more_than_one_lobe or extent_25_to_50_pct or limiting_instrumental_adl; else grade 1. icpi_action hold_if_radiographic_progression (grade 1), hold (grade 2), permanently_discontinue (grade 3 or 4). magent does not read CT or pulse oximetry. Not SITC 2021. Not CTCAE pneumonitis as a separate instrument. Not a diagnosis. Not a steroid dose",
      "criteria": [
        {
          "factor": "life_threatening_respiratory",
          "met": false
        },
        {
          "factor": "hospitalization_required",
          "met": false
        },
        {
          "factor": "oxygen_indicated",
          "met": false
        },
        {
          "factor": "limiting_self_care",
          "met": false
        },
        {
          "factor": "all_lobes_or_gt_50_pct",
          "met": false
        },
        {
          "factor": "symptomatic",
          "met": false
        },
        {
          "factor": "more_than_one_lobe",
          "met": false
        },
        {
          "factor": "extent_25_to_50_pct",
          "met": false
        },
        {
          "factor": "limiting_instrumental_adl",
          "met": false
        }
      ],
      "grade": 1,
      "icpi_action": "hold_if_radiographic_progression",
      "limiting_self_care": false,
      "all_lobes_or_gt_50_pct": false,
      "extent_25_to_50_pct": false,
      "hospitalization_required": false,
      "life_threatening_respiratory": false,
      "limiting_instrumental_adl": false,
      "more_than_one_lobe": false,
      "oxygen_indicated": false,
      "symptomatic": false
    }
  ]
}
```

## Response fields

- `formula` (string): irae_pneumonitis
- `formula_expression` (string): Brahmer 2018 Table 3.1 first-match worst-wins pneumonitis grade and ICPi action
- `grade` (integer): 1, 2, 3, or 4. First-match worst-wins on caller-assigned Brahmer 2018 Table 3.1 flags. Not a diagnosis. Not a steroid dose.
- `icpi_action` (string): hold_if_radiographic_progression (grade 1), hold (grade 2), or permanently_discontinue (grade 3 or 4)
- `life_threatening_respiratory` (boolean): Echo of caller-assigned life_threatening_respiratory (true or false)
- `hospitalization_required` (boolean): Echo of caller-assigned hospitalization_required (true or false)
- `oxygen_indicated` (boolean): Echo of caller-assigned oxygen_indicated (true or false)
- `limiting_self_care` (boolean): Echo of caller-assigned limiting_self_care (true or false)
- `all_lobes_or_gt_50_pct` (boolean): Echo of caller-assigned all_lobes_or_gt_50_pct (true or false)
- `symptomatic` (boolean): Echo of caller-assigned symptomatic (true or false)
- `more_than_one_lobe` (boolean): Echo of caller-assigned more_than_one_lobe (true or false)
- `extent_25_to_50_pct` (boolean): Echo of caller-assigned extent_25_to_50_pct (true or false)
- `limiting_instrumental_adl` (boolean): Echo of caller-assigned limiting_instrumental_adl (true or false)
- `criteria` (array): Per-factor Tree rows with factor and met for each Brahmer 2018 Table 3.1 caller-assigned flag
- `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_pneumonitis",
  "formula_expression": "irae_pneumonitis first-match worst-wins (Brahmer 2018 Table 3.1): grade 4 if life_threatening_respiratory; else grade 3 if hospitalization_required or oxygen_indicated or limiting_self_care or all_lobes_or_gt_50_pct; else grade 2 if symptomatic or more_than_one_lobe or extent_25_to_50_pct or limiting_instrumental_adl; else grade 1. icpi_action hold_if_radiographic_progression (grade 1), hold (grade 2), permanently_discontinue (grade 3 or 4). magent does not read CT or pulse oximetry. Not SITC 2021. Not CTCAE pneumonitis as a separate instrument. Not a diagnosis. Not a steroid dose",
  "criteria": [
    {
      "factor": "life_threatening_respiratory",
      "met": false
    },
    {
      "factor": "hospitalization_required",
      "met": false
    },
    {
      "factor": "oxygen_indicated",
      "met": false
    },
    {
      "factor": "limiting_self_care",
      "met": false
    },
    {
      "factor": "all_lobes_or_gt_50_pct",
      "met": false
    },
    {
      "factor": "symptomatic",
      "met": false
    },
    {
      "factor": "more_than_one_lobe",
      "met": false
    },
    {
      "factor": "extent_25_to_50_pct",
      "met": false
    },
    {
      "factor": "limiting_instrumental_adl",
      "met": false
    }
  ],
  "grade": 1,
  "icpi_action": "hold_if_radiographic_progression",
  "limiting_self_care": false,
  "all_lobes_or_gt_50_pct": false,
  "extent_25_to_50_pct": false,
  "hospitalization_required": false,
  "life_threatening_respiratory": false,
  "limiting_instrumental_adl": false,
  "more_than_one_lobe": false,
  "oxygen_indicated": false,
  "symptomatic": false
}
```

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

- [LIPS](https://magentlab.com/docs/lips) — Sum Gajic 2011 Table 3 lung injury prediction score items from caller-assigned flags and return the published ROC cutoff band (low <4, high ≥4).
- [qCSI](https://magentlab.com/docs/qcsi) — Sum Haimovich 2020 qCSI bedside points (Table 2) from respiratory rate, lowest SpO2, and nasal-cannula oxygen flow and return the integer total (max 12).

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