Liver · LIVE
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.
Markdown: /docs/irae-hepatitis.md · Canonical: https://magentlab.com/docs/irae-hepatitis
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
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.
When to use
When an agent has caller AST, ALT, total bilirubin, and laboratory ULNs during immune checkpoint inhibitor therapy and needs the published ASCO 2018 hepatitis grade and continue/hold/permanently discontinue band, not a DILI diagnosis, RUCAM score, or R factor.
When not to use
- Not a medical device. Not a diagnosis. magent does not assay enzymes.
- Total bilirubin is mg/dL only; µmol/L is not accepted.
- Not DILI causality and not RUCAM. Not the CIOMS R factor (r-factor).
- Not a steroid dose or immunosuppression schedule. icpi_action is the published continue / hold / permanently discontinue band only.
- Decompensated liver and symptomatic liver dysfunction are caller-assigned (ascites, encephalopathy, coagulopathy, or coma; symptomatic compensated hepatitis).
Formula
lab_grade = max(transaminase_grade(max(AST/AST_ULN, ALT/ALT_ULN)), bilirubin_grade(TBili/TBili_ULN)); first-match: decompensated_liver -> max(lab_grade, 4); else symptomatic_liver_dysfunction -> max(lab_grade, 3); else lab_grade. Transaminase: <1x -> 0, ULN-3x -> 1, >3-5x -> 2, >5-20x -> 3, >20x -> 4. Bilirubin: <1x -> 0, ULN-1.5x -> 1, >1.5-3x -> 2, >3-10x -> 3, >10x -> 4 (Brahmer 2018 Table 2.2). icpi_action: 0-1 continue, 2 hold, 3-4 permanently_discontinue. mg/dL bilirubin only. Not DILI/RUCAM. Not R factor. magent does not assay enzymes. Not a diagnosis. Not a steroid dose
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
- Source
- J Clin Oncol. 2018;36(17):1714-1768
Worked example
AST 80 U/L (ULN 40), ALT 50 U/L (ULN 40), bilirubin 1.0 mg/dL (ULN 1.0)
Given:
alt_u_l=50alt_uln_u_l=40ast_u_l=80ast_uln_u_l=40bilirubin_mg_dl=1.0bilirubin_uln_mg_dl=1.0decompensated_liver=falsesymptomatic_liver_dysfunction=false
- AST / AST_ULN = 80 / 40 = 2.0; ALT / ALT_ULN = 50 / 40 = 1.25; transaminase_ratio = max = 2.0 → transaminase grade 1
- bilirubin / ULN = 1.0 / 1.0 = 1.0 → bilirubin grade 1
- lab_grade = max(1, 1) = 1
- decompensated_liver false and symptomatic_liver_dysfunction false → grade 1
- grade 1 → icpi_action continue
Also searched as
- immune-related hepatitis
- ICI hepatitis
- ASCO irAE hepatitis
- checkpoint inhibitor hepatitis
- Brahmer 2018 hepatitis
- immune checkpoint liver toxicity
- CTCAE hepatitis
- irAE liver grade
Try
Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.
Full URL: https://api.magentlab.com/api/calc/irae_hepatitis?ast_u_l=80&ast_uln_u_l=40&alt_u_l=50&alt_uln_u_l=40&bilirubin_mg_dl=1.0&bilirubin_uln_mg_dl=1.0&decompensated_liver=false&symptomatic_liver_dysfunction=false
Call
Expect HTTP 402 until you retry with PAYMENT-SIGNATURE. Incomplete query params
return HTTP 400 before any quote or charge.
curl -i -H "Accept: application/json" "https://api.magentlab.com/api/calc/irae_hepatitis?ast_u_l=80&ast_uln_u_l=40&alt_u_l=50&alt_uln_u_l=40&bilirubin_mg_dl=1.0&bilirubin_uln_mg_dl=1.0&decompensated_liver=false&symptomatic_liver_dysfunction=false"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ast_u_l |
number | required | Aspartate aminotransferase in U/L (1-10000). Used with ast_uln_u_l for the AST fold. magent does not assay enzymes. |
ast_uln_u_l |
number | required | Laboratory AST upper limit of normal in U/L (5-200). Required; magent does not assume 40. |
alt_u_l |
number | required | Alanine aminotransferase in U/L (1-10000). Used with alt_uln_u_l for the ALT fold. magent does not assay enzymes. |
alt_uln_u_l |
number | required | Laboratory ALT upper limit of normal in U/L (5-200). Required; magent does not assume 40. |
bilirubin_mg_dl |
number | required | Total bilirubin in mg/dL (0.1-40). µmol/L is not accepted. magent does not assay bilirubin. |
bilirubin_uln_mg_dl |
number | required | Laboratory total-bilirubin upper limit of normal in mg/dL (0.1-5). Required; magent does not assume 1.0. |
decompensated_liver |
boolean | required | Decompensated liver (ascites, encephalopathy, coagulopathy, or coma) as assigned by the caller (Brahmer 2018). true or false. When true, grade is max(lab_grade, 4). magent does not examine the patient. |
symptomatic_liver_dysfunction |
boolean | required | Symptomatic compensated hepatitis / liver dysfunction as assigned by the caller (Brahmer 2018). true or false. When true and decompensated_liver is false, grade is max(lab_grade, 3). 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.
- 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 (fixture)
{
"items": [
{
"alt_u_l": "50",
"alt_uln_u_l": "40",
"ast_u_l": "80",
"ast_uln_u_l": "40",
"bilirubin_mg_dl": "1.0",
"bilirubin_uln_mg_dl": "1.0",
"decompensated_liver": "false",
"symptomatic_liver_dysfunction": "false"
},
{
"alt_u_l": "50",
"alt_uln_u_l": "40",
"ast_u_l": "80",
"ast_uln_u_l": "40",
"bilirubin_mg_dl": "1.0",
"bilirubin_uln_mg_dl": "1.0",
"decompensated_liver": "false",
"symptomatic_liver_dysfunction": "false"
}
]
}
Opens a two-item fixture on the API host. Unpaid browsers get the same MetaMask paywall as GET; Pay retries POST with those items.
Example 200 (fixture)
{
"count": 2,
"path": "/api/calc/irae_hepatitis",
"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_hepatitis",
"formula_expression": "lab_grade = max(transaminase_grade(max(AST/AST_ULN, ALT/ALT_ULN)), bilirubin_grade(TBili/TBili_ULN)); first-match: decompensated_liver -> max(lab_grade, 4); else symptomatic_liver_dysfunction -> max(lab_grade, 3); else lab_grade. Transaminase: <1x -> 0, ULN-3x -> 1, >3-5x -> 2, >5-20x -> 3, >20x -> 4. Bilirubin: <1x -> 0, ULN-1.5x -> 1, >1.5-3x -> 2, >3-10x -> 3, >10x -> 4 (Brahmer 2018 Table 2.2). icpi_action: 0-1 continue, 2 hold, 3-4 permanently_discontinue. mg/dL bilirubin only. Not DILI/RUCAM. Not R factor. magent does not assay enzymes. Not a diagnosis. Not a steroid dose",
"ast_u_l": 80.0,
"ast_uln_u_l": 40.0,
"bilirubin_mg_dl": 1.0,
"criteria": [
{
"factor": "decompensated_liver",
"met": false
},
{
"factor": "symptomatic_liver_dysfunction",
"met": false
}
],
"grade": 1,
"alt_u_l": 50.0,
"icpi_action": "continue",
"alt_uln_u_l": 40.0,
"bilirubin_ratio": 1.0,
"bilirubin_uln_mg_dl": 1.0,
"decompensated_liver": false,
"symptomatic_liver_dysfunction": false,
"transaminase_ratio": 2.0
},
{
"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_hepatitis",
"formula_expression": "lab_grade = max(transaminase_grade(max(AST/AST_ULN, ALT/ALT_ULN)), bilirubin_grade(TBili/TBili_ULN)); first-match: decompensated_liver -> max(lab_grade, 4); else symptomatic_liver_dysfunction -> max(lab_grade, 3); else lab_grade. Transaminase: <1x -> 0, ULN-3x -> 1, >3-5x -> 2, >5-20x -> 3, >20x -> 4. Bilirubin: <1x -> 0, ULN-1.5x -> 1, >1.5-3x -> 2, >3-10x -> 3, >10x -> 4 (Brahmer 2018 Table 2.2). icpi_action: 0-1 continue, 2 hold, 3-4 permanently_discontinue. mg/dL bilirubin only. Not DILI/RUCAM. Not R factor. magent does not assay enzymes. Not a diagnosis. Not a steroid dose",
"ast_u_l": 80.0,
"ast_uln_u_l": 40.0,
"bilirubin_mg_dl": 1.0,
"criteria": [
{
"factor": "decompensated_liver",
"met": false
},
{
"factor": "symptomatic_liver_dysfunction",
"met": false
}
],
"grade": 1,
"alt_u_l": 50.0,
"icpi_action": "continue",
"alt_uln_u_l": 40.0,
"bilirubin_ratio": 1.0,
"bilirubin_uln_mg_dl": 1.0,
"decompensated_liver": false,
"symptomatic_liver_dysfunction": false,
"transaminase_ratio": 2.0
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | irae_hepatitis |
formula_expression |
string | Brahmer 2018 Table 2.2 hepatitis lab folds plus clinical upgrades |
grade |
integer | 0-4. Lab grade is the max of transaminase and bilirubin bands; decompensated_liver upgrades to at least 4; symptomatic_liver_dysfunction upgrades to at least 3. Not a diagnosis. |
icpi_action |
string | continue (grade 0 or 1), hold (grade 2), or permanently_discontinue (grade 3 or 4). Not a steroid dose. |
transaminase_ratio |
number | max(AST/AST_ULN, ALT/ALT_ULN), 4 decimal places |
bilirubin_ratio |
number | total bilirubin / bilirubin ULN (mg/dL), 4 decimal places |
ast_u_l |
number | AST in U/L |
ast_uln_u_l |
number | Laboratory AST upper limit of normal in U/L |
alt_u_l |
number | ALT in U/L |
alt_uln_u_l |
number | Laboratory ALT upper limit of normal in U/L |
bilirubin_mg_dl |
number | Total bilirubin in mg/dL |
bilirubin_uln_mg_dl |
number | Laboratory total-bilirubin ULN in mg/dL |
decompensated_liver |
boolean | Caller-assigned decompensated-liver flag |
symptomatic_liver_dysfunction |
boolean | Caller-assigned symptomatic compensated hepatitis / liver dysfunction flag |
criteria |
array | Per-factor Tree rows with factor and met for decompensated_liver then symptomatic_liver_dysfunction (first-match clinical upgrade) |
citation |
object | Brahmer 2018 J Clin Oncol citation |
disclaimer |
string | Not-a-device notice |
Example JSON
Machine form of the same example. Frozen fixture. Not a live lookup.
{
"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_hepatitis",
"formula_expression": "lab_grade = max(transaminase_grade(max(AST/AST_ULN, ALT/ALT_ULN)), bilirubin_grade(TBili/TBili_ULN)); first-match: decompensated_liver -> max(lab_grade, 4); else symptomatic_liver_dysfunction -> max(lab_grade, 3); else lab_grade. Transaminase: <1x -> 0, ULN-3x -> 1, >3-5x -> 2, >5-20x -> 3, >20x -> 4. Bilirubin: <1x -> 0, ULN-1.5x -> 1, >1.5-3x -> 2, >3-10x -> 3, >10x -> 4 (Brahmer 2018 Table 2.2). icpi_action: 0-1 continue, 2 hold, 3-4 permanently_discontinue. mg/dL bilirubin only. Not DILI/RUCAM. Not R factor. magent does not assay enzymes. Not a diagnosis. Not a steroid dose",
"ast_u_l": 80.0,
"ast_uln_u_l": 40.0,
"bilirubin_mg_dl": 1.0,
"criteria": [
{
"factor": "decompensated_liver",
"met": false
},
{
"factor": "symptomatic_liver_dysfunction",
"met": false
}
],
"grade": 1,
"alt_u_l": 50.0,
"icpi_action": "continue",
"alt_uln_u_l": 40.0,
"bilirubin_ratio": 1.0,
"bilirubin_uln_mg_dl": 1.0,
"decompensated_liver": false,
"symptomatic_liver_dysfunction": false,
"transaminase_ratio": 2.0
}
Client errors (HTTP 400)
Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_ast |
ast_u_l must be a number from 1 to 10000 Returned before settlement; you are not charged. |
| 400 | invalid_ast_uln |
ast_uln_u_l must be a number from 5 to 200. Returned before settlement; you are not charged. |
| 400 | invalid_alt |
alt_u_l must be a number from 1 to 10000 Returned before settlement; you are not charged. |
| 400 | invalid_alt_uln |
alt_uln_u_l must be a number from 5 to 200. Returned before settlement; you are not charged. |
| 400 | invalid_bilirubin |
bilirubin_mg_dl (0.1-40) or bilirubin_umol_l (2-684) is required Returned before settlement; you are not charged. |
| 400 | invalid_bilirubin_uln |
bilirubin_uln_mg_dl must be a number from 0.1 to 5 (laboratory total-bilirubin ULN mg/dL). Returned before settlement; you are not charged. |
| 400 | invalid_flag |
boolean clinical flags must be true or false Returned before settlement; you are not charged. |
| 400 | invalid_items |
POST body must be a JSON object with only an items array Returned before settlement; you are not charged. |
| 400 | invalid_item_count |
items must be an array of 1 to 25 objects Returned before settlement; you are not charged. |
| 400 | invalid_item |
each items entry must be a JSON object Returned before settlement; you are not charged. |
Related tools
- irAE colitis — 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.
- R factor — Compute the Bénichou 1990 / CIOMS R ratio from ALT, ALP, and their laboratory upper limits of normal, then classify hepatocellular (R ≥ 5), cholestatic (R ≤ 2), or mixed (2 < R < 5).
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. Unpaid valid requests return HTTP 402 with a base64
PAYMENT-REQUIRED
header. HTTP 503 is not a new quote: retry the same PAYMENT-SIGNATURE. Full handshake
and shared payment errors: Payments.
Stdio MCP: /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.