# irAE nephritis

irAE nephritis

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

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

## What it computes

Apply Brahmer 2018 ASCO Table 6.1 immune-related nephritis bands (creatinine fold and delta versus baseline, plus caller-assigned hospitalization, dialysis, and life-threatening flags) and return grade 0–4 plus ICI action.

## When to use

When an agent has caller current and baseline creatinine (mg/dL) during immune checkpoint inhibitor therapy and needs the published ASCO 2018 nephritis grade and continue / consider hold / hold / permanently discontinue band, not a KDIGO or AKIN stage and not a diagnosis.

## When not to use

- Not a medical device. Not a diagnosis. magent does not assay creatinine.
- Creatinine is mg/dL only.
- Not KDIGO and not AKIN staging as a separate instrument.
- Not a steroid dose or immunosuppression schedule. icpi_action is the published continue / consider hold / hold / permanently discontinue band only.
- Hospitalization indicated, dialysis indicated, and life-threatening consequences are caller-assigned (Brahmer 2018 Table 6.1).

## Formula

```
irae_nephritis first-match worst-wins (Brahmer 2018 Table 6.1): fold = creatinine_mg_dl / baseline_creatinine_mg_dl; delta = creatinine_mg_dl - baseline_creatinine_mg_dl. Grade 4 if dialysis_indicated or life_threatening; else grade 3 if fold > 3 or creatinine_mg_dl >= 4.0 or hospitalization_indicated; else grade 2 if fold > 2; else grade 1 if fold >= 1.5 or delta >= 0.3; else grade 0. icpi_action: 0 continue, 1 consider_hold, 2 hold, 3-4 permanently_discontinue. mg/dL only. Not KDIGO/AKIN. magent does not assay creatinine. 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

### Creatinine 1.6 mg/dL, baseline 1.0 mg/dL, flags false

Given: `baseline_creatinine_mg_dl=1.0, creatinine_mg_dl=1.6, dialysis_indicated=false, hospitalization_indicated=false, life_threatening=false`

1. fold = 1.6 / 1.0 = 1.6; delta = 1.6 - 1.0 = 0.6 mg/dL
2. dialysis_indicated false and life_threatening false → not grade 4
3. fold 1.6 is not > 3, creatinine 1.6 is not >= 4.0, hospitalization_indicated false → not grade 3
4. fold 1.6 is not > 2 → not grade 2
5. fold 1.6 >= 1.5 → grade 1; icpi_action consider_hold


## Also searched as

- immune-related nephritis
- ICI nephritis
- ASCO irAE nephritis
- checkpoint inhibitor nephritis
- Brahmer 2018 nephritis
- immune checkpoint kidney toxicity
- CTCAE nephritis
- irAE kidney grade

## Parameters

- `creatinine_mg_dl` (number, required): Current serum creatinine in mg/dL (0.1-20). Used with baseline_creatinine_mg_dl for fold and delta (Brahmer 2018 Table 6.1). magent does not assay creatinine.
- `baseline_creatinine_mg_dl` (number, required): Baseline serum creatinine in mg/dL (0.1-20). µmol/L is not accepted. magent does not assay creatinine.
- `hospitalization_indicated` (boolean, required): Hospitalization indicated as assigned by the caller (Brahmer 2018 Table 6.1 grade 3). true or false. When true and neither dialysis_indicated nor life_threatening is true, grade is 3. magent does not admit the patient.
- `dialysis_indicated` (boolean, required): Dialysis indicated as assigned by the caller (Brahmer 2018 Table 6.1 grade 4). true or false. When true, grade is 4 regardless of fold. magent does not start dialysis.
- `life_threatening` (boolean, required): Life-threatening consequences as assigned by the caller (Brahmer 2018 Table 6.1 grade 4). true or false. When true, grade is 4 regardless of fold. 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_nephritis`
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": [
    {
      "baseline_creatinine_mg_dl": "1.0",
      "creatinine_mg_dl": "1.6",
      "dialysis_indicated": "false",
      "hospitalization_indicated": "false",
      "life_threatening": "false"
    },
    {
      "baseline_creatinine_mg_dl": "1.0",
      "creatinine_mg_dl": "1.6",
      "dialysis_indicated": "false",
      "hospitalization_indicated": "false",
      "life_threatening": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/irae_nephritis",
  "items": [
    {
      "fold": 1.6,
      "delta": 0.6,
      "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_nephritis",
      "formula_expression": "irae_nephritis first-match worst-wins (Brahmer 2018 Table 6.1): fold = creatinine_mg_dl / baseline_creatinine_mg_dl; delta = creatinine_mg_dl - baseline_creatinine_mg_dl. Grade 4 if dialysis_indicated or life_threatening; else grade 3 if fold > 3 or creatinine_mg_dl >= 4.0 or hospitalization_indicated; else grade 2 if fold > 2; else grade 1 if fold >= 1.5 or delta >= 0.3; else grade 0. icpi_action: 0 continue, 1 consider_hold, 2 hold, 3-4 permanently_discontinue. mg/dL only. Not KDIGO/AKIN. magent does not assay creatinine. Not a diagnosis. Not a steroid dose",
      "creatinine_mg_dl": 1.6,
      "criteria": [
        {
          "factor": "dialysis_indicated",
          "met": false
        },
        {
          "factor": "life_threatening",
          "met": false
        },
        {
          "value": 1.6,
          "factor": "fold_gt_3",
          "met": false
        },
        {
          "value": 1.6,
          "factor": "creatinine_ge_4",
          "met": false
        },
        {
          "factor": "hospitalization_indicated",
          "met": false
        },
        {
          "value": 1.6,
          "factor": "fold_gt_2",
          "met": false
        },
        {
          "value": 1.6,
          "factor": "fold_ge_1_5",
          "met": true
        },
        {
          "value": 0.6,
          "factor": "delta_ge_0_3",
          "met": true
        }
      ],
      "baseline_creatinine_mg_dl": 1.0,
      "grade": 1,
      "hospitalization_indicated": false,
      "icpi_action": "consider_hold",
      "life_threatening": false,
      "dialysis_indicated": false
    },
    {
      "fold": 1.6,
      "delta": 0.6,
      "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_nephritis",
      "formula_expression": "irae_nephritis first-match worst-wins (Brahmer 2018 Table 6.1): fold = creatinine_mg_dl / baseline_creatinine_mg_dl; delta = creatinine_mg_dl - baseline_creatinine_mg_dl. Grade 4 if dialysis_indicated or life_threatening; else grade 3 if fold > 3 or creatinine_mg_dl >= 4.0 or hospitalization_indicated; else grade 2 if fold > 2; else grade 1 if fold >= 1.5 or delta >= 0.3; else grade 0. icpi_action: 0 continue, 1 consider_hold, 2 hold, 3-4 permanently_discontinue. mg/dL only. Not KDIGO/AKIN. magent does not assay creatinine. Not a diagnosis. Not a steroid dose",
      "creatinine_mg_dl": 1.6,
      "criteria": [
        {
          "factor": "dialysis_indicated",
          "met": false
        },
        {
          "factor": "life_threatening",
          "met": false
        },
        {
          "value": 1.6,
          "factor": "fold_gt_3",
          "met": false
        },
        {
          "value": 1.6,
          "factor": "creatinine_ge_4",
          "met": false
        },
        {
          "factor": "hospitalization_indicated",
          "met": false
        },
        {
          "value": 1.6,
          "factor": "fold_gt_2",
          "met": false
        },
        {
          "value": 1.6,
          "factor": "fold_ge_1_5",
          "met": true
        },
        {
          "value": 0.6,
          "factor": "delta_ge_0_3",
          "met": true
        }
      ],
      "baseline_creatinine_mg_dl": 1.0,
      "grade": 1,
      "hospitalization_indicated": false,
      "icpi_action": "consider_hold",
      "life_threatening": false,
      "dialysis_indicated": false
    }
  ]
}
```

## Response fields

- `formula` (string): irae_nephritis
- `formula_expression` (string): Brahmer 2018 Table 6.1 nephritis first-match worst-wins grade and ICPi action
- `grade` (integer): 0-4. First-match: dialysis_indicated or life_threatening → 4; else fold > 3 or creatinine >= 4.0 mg/dL or hospitalization_indicated → 3; else fold > 2 → 2; else fold >= 1.5 or delta >= 0.3 → 1; else 0. Not a diagnosis.
- `icpi_action` (string): continue (grade 0), consider_hold (grade 1), hold (grade 2), or permanently_discontinue (grade 3 or 4). Not a steroid dose.
- `fold` (number): creatinine_mg_dl / baseline_creatinine_mg_dl, 4 decimal places
- `delta` (number): creatinine_mg_dl - baseline_creatinine_mg_dl (mg/dL), 4 decimal places
- `creatinine_mg_dl` (number): Current serum creatinine in mg/dL
- `baseline_creatinine_mg_dl` (number): Baseline serum creatinine in mg/dL
- `hospitalization_indicated` (boolean): Caller-assigned hospitalization-indicated flag
- `dialysis_indicated` (boolean): Caller-assigned dialysis-indicated flag
- `life_threatening` (boolean): Caller-assigned life-threatening flag
- `criteria` (array): Per-factor Tree rows with factor and met for dialysis_indicated, life_threatening, fold_gt_3, creatinine_ge_4, hospitalization_indicated, fold_gt_2, fold_ge_1_5, and delta_ge_0_3 (first-match worst-wins); fold and creatinine/delta rows include value
- `citation` (object): Brahmer 2018 J Clin Oncol citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "fold": 1.6,
  "delta": 0.6,
  "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_nephritis",
  "formula_expression": "irae_nephritis first-match worst-wins (Brahmer 2018 Table 6.1): fold = creatinine_mg_dl / baseline_creatinine_mg_dl; delta = creatinine_mg_dl - baseline_creatinine_mg_dl. Grade 4 if dialysis_indicated or life_threatening; else grade 3 if fold > 3 or creatinine_mg_dl >= 4.0 or hospitalization_indicated; else grade 2 if fold > 2; else grade 1 if fold >= 1.5 or delta >= 0.3; else grade 0. icpi_action: 0 continue, 1 consider_hold, 2 hold, 3-4 permanently_discontinue. mg/dL only. Not KDIGO/AKIN. magent does not assay creatinine. Not a diagnosis. Not a steroid dose",
  "creatinine_mg_dl": 1.6,
  "criteria": [
    {
      "factor": "dialysis_indicated",
      "met": false
    },
    {
      "factor": "life_threatening",
      "met": false
    },
    {
      "value": 1.6,
      "factor": "fold_gt_3",
      "met": false
    },
    {
      "value": 1.6,
      "factor": "creatinine_ge_4",
      "met": false
    },
    {
      "factor": "hospitalization_indicated",
      "met": false
    },
    {
      "value": 1.6,
      "factor": "fold_gt_2",
      "met": false
    },
    {
      "value": 1.6,
      "factor": "fold_ge_1_5",
      "met": true
    },
    {
      "value": 0.6,
      "factor": "delta_ge_0_3",
      "met": true
    }
  ],
  "baseline_creatinine_mg_dl": 1.0,
  "grade": 1,
  "hospitalization_indicated": false,
  "icpi_action": "consider_hold",
  "life_threatening": false,
  "dialysis_indicated": false
}
```

## Errors

- HTTP 400 `invalid_creatinine`: creatinine_mg_dl (0.1-20) or creatinine_umol_l (9-1768) is required Returned before settlement; you are not charged.
- HTTP 400 `invalid_baseline_creatinine`: baseline_creatinine_mg_dl must be a number from 0.1 to 20 (Brahmer 2018 baseline creatinine mg/dL). 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

- [AKIN](https://magentlab.com/docs/akin) — Apply Mehta 2007 Table 2 AKIN staging and return stage 0-3 as the worse of the creatinine and urine-output limbs, with initiated renal replacement therapy mapping to stage 3.
- [RIFLE](https://magentlab.com/docs/rifle) — Apply Bellomo 2004 Fig. 1 RIFLE classification and return the worse of the creatinine and urine-output limbs (none, risk, injury, failure), with persistent ARF beyond 4 weeks mapping to loss and ESRD beyond 3 months mapping to esrd.

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