MAGENT

Electrolytes / glucose · LIVE

ASCO irAE diabetes

irAE diabetes

Apply Brahmer 2018 ASCO Table 4.4 immune-related diabetes fasting-glucose bands and return grade 0–4 plus icpi_action from glucose_mg_dl and caller-assigned ketosis, t1dm, severe_unable_adl, and life_threatening flags.

LIVE $0.005 USDC GET /api/calc/irae_diabetes

Markdown: /docs/irae-diabetes.md · Canonical: https://magentlab.com/docs/irae-diabetes

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

What it computes

Apply Brahmer 2018 ASCO Table 4.4 immune-related diabetes fasting-glucose bands and return grade 0–4 plus icpi_action from glucose_mg_dl and caller-assigned ketosis, t1dm, severe_unable_adl, and life_threatening flags.

When to use

When an agent already has a fasting glucose in mg/dL and those caller-assigned flags during immune checkpoint inhibitor therapy and needs the published ASCO 2018 diabetes grade and continue / hold-until-control / hold-admit band. magent does not assay glucose.

When not to use

  • Not a medical device.
  • Not a diagnosis. Not an insulin dose.
  • mg/dL only; mmol/L is not accepted. magent does not assay glucose.
  • Not DKA diagnostic criteria as a separate instrument.
  • ketosis, t1dm, severe_unable_adl, and life_threatening are caller-assigned (Brahmer 2018 Table 4.4).

Formula

irae_diabetes first-match worst-wins (Brahmer 2018 Table 4.4 fasting glucose mg/dL): grade 4 if life_threatening or glucose_mg_dl > 500; else grade 3 if severe_unable_adl or glucose_mg_dl > 250; else grade 2 if ketosis or t1dm or glucose_mg_dl > 160; else grade 1 if glucose_mg_dl > 99; else grade 0. icpi_action continue (0-1), hold_until_control (2), hold_admit (3-4). mg/dL only. Not DKA diagnostic criteria as a separate instrument. magent does not assay glucose. Not a diagnosis. Not an insulin dose

Citation

Title
Management of Immune-Related Adverse Events in Patients Treated With Immune Checkpoint Inhibitor Therapy: American Society of Clinical Oncology Clinical Practice Guideline
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
DOI
10.1200/JCO.2017.77.6385

Worked example

Glucose 140 mg/dL, all flags false, grade 1 continue

Given: glucose_mg_dl=140ketosis=falselife_threatening=falsesevere_unable_adl=falset1dm=false

  1. glucose_mg_dl is 140 (fasting; above typical ULN and not >160)
  2. ketosis, t1dm, severe_unable_adl, and life_threatening are false
  3. first-match is grade 1 (glucose > 99); icpi_action is continue

Also searched as

  • irAE diabetes
  • immune checkpoint diabetes
  • ASCO 2018 diabetes
  • Brahmer diabetes grade
  • ICI hyperglycemia
  • immune-related diabetes
  • checkpoint inhibitor diabetes
  • CTCAE hyperglycemia grade

Try

Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.

/api/calc/irae_diabetes?glucose_mg_dl=140&ketosis=false&t1dm=false&life_threatening=false&severe_unable_adl=false

Full URL: https://api.magentlab.com/api/calc/irae_diabetes?glucose_mg_dl=140&ketosis=false&t1dm=false&life_threatening=false&severe_unable_adl=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_diabetes?glucose_mg_dl=140&ketosis=false&t1dm=false&life_threatening=false&severe_unable_adl=false"

Parameters

Name Type Required Description
glucose_mg_dl number required Fasting glucose in mg/dL (50-1000). Brahmer 2018 Table 4.4 bands: >500 grade 4; >250 grade 3; >160 grade 2; >99 grade 1; else grade 0 unless a flag upgrades. mmol/L is not accepted. magent does not assay glucose.
ketosis boolean required Ketosis as assigned by the caller (Brahmer 2018 Table 4.4 grade 2; ketosis at any glucose). true or false. When true and grade 4/3 criteria are not met, grade is 2. magent does not assay ketones.
t1dm boolean required Evidence of type 1 diabetes as assigned by the caller (Brahmer 2018 Table 4.4 grade 2; T1DM at any glucose). true or false. When true and grade 4/3 criteria are not met, grade is 2. magent does not diagnose diabetes.
life_threatening boolean required Life-threatening consequences as assigned by the caller (Brahmer 2018 Table 4.4 grade 4). true or false. When true, grade is 4 regardless of glucose. magent does not examine the patient.
severe_unable_adl boolean required Severe symptoms limiting self-care ADL as assigned by the caller (Brahmer 2018 Table 4.4 grade 3). true or false. When true and life_threatening is false and glucose is not >500, grade is 3. 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.

POST /api/calc/irae_diabetes Max 25 unit_amount + extra_item_amount * (n - 1) extra $0.002 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 (fixture)

{
  "items": [
    {
      "glucose_mg_dl": "140",
      "ketosis": "false",
      "life_threatening": "false",
      "severe_unable_adl": "false",
      "t1dm": "false"
    },
    {
      "glucose_mg_dl": "140",
      "ketosis": "false",
      "life_threatening": "false",
      "severe_unable_adl": "false",
      "t1dm": "false"
    }
  ]
}

Open bulk paywall →

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_diabetes",
  "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_diabetes",
      "formula_expression": "irae_diabetes first-match worst-wins (Brahmer 2018 Table 4.4 fasting glucose mg/dL): grade 4 if life_threatening or glucose_mg_dl > 500; else grade 3 if severe_unable_adl or glucose_mg_dl > 250; else grade 2 if ketosis or t1dm or glucose_mg_dl > 160; else grade 1 if glucose_mg_dl > 99; else grade 0. icpi_action continue (0-1), hold_until_control (2), hold_admit (3-4). mg/dL only. Not DKA diagnostic criteria as a separate instrument. magent does not assay glucose. Not a diagnosis. Not an insulin dose",
      "criteria": [
        {
          "factor": "life_threatening",
          "met": false
        },
        {
          "value": 140.0,
          "factor": "glucose_gt_500",
          "met": false
        },
        {
          "factor": "severe_unable_adl",
          "met": false
        },
        {
          "value": 140.0,
          "factor": "glucose_gt_250",
          "met": false
        },
        {
          "factor": "ketosis",
          "met": false
        },
        {
          "factor": "t1dm",
          "met": false
        },
        {
          "value": 140.0,
          "factor": "glucose_gt_160",
          "met": false
        },
        {
          "value": 140.0,
          "factor": "glucose_gt_99",
          "met": true
        }
      ],
      "grade": 1,
      "glucose_mg_dl": 140.0,
      "icpi_action": "continue",
      "life_threatening": false,
      "ketosis": false,
      "severe_unable_adl": false,
      "t1dm": 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_diabetes",
      "formula_expression": "irae_diabetes first-match worst-wins (Brahmer 2018 Table 4.4 fasting glucose mg/dL): grade 4 if life_threatening or glucose_mg_dl > 500; else grade 3 if severe_unable_adl or glucose_mg_dl > 250; else grade 2 if ketosis or t1dm or glucose_mg_dl > 160; else grade 1 if glucose_mg_dl > 99; else grade 0. icpi_action continue (0-1), hold_until_control (2), hold_admit (3-4). mg/dL only. Not DKA diagnostic criteria as a separate instrument. magent does not assay glucose. Not a diagnosis. Not an insulin dose",
      "criteria": [
        {
          "factor": "life_threatening",
          "met": false
        },
        {
          "value": 140.0,
          "factor": "glucose_gt_500",
          "met": false
        },
        {
          "factor": "severe_unable_adl",
          "met": false
        },
        {
          "value": 140.0,
          "factor": "glucose_gt_250",
          "met": false
        },
        {
          "factor": "ketosis",
          "met": false
        },
        {
          "factor": "t1dm",
          "met": false
        },
        {
          "value": 140.0,
          "factor": "glucose_gt_160",
          "met": false
        },
        {
          "value": 140.0,
          "factor": "glucose_gt_99",
          "met": true
        }
      ],
      "grade": 1,
      "glucose_mg_dl": 140.0,
      "icpi_action": "continue",
      "life_threatening": false,
      "ketosis": false,
      "severe_unable_adl": false,
      "t1dm": false
    }
  ]
}

Response

Field Type Description
formula string irae_diabetes
formula_expression string Brahmer 2018 Table 4.4 first-match diabetes grade and icpi_action rule
grade integer 0-4. First-match worst-wins on fasting glucose_mg_dl and caller-assigned ketosis, t1dm, severe_unable_adl, and life_threatening (Brahmer 2018 Table 4.4). Not a diagnosis.
icpi_action string continue (grade 0 or 1), hold_until_control (grade 2), or hold_admit (grade 3 or 4). Not an insulin dose.
glucose_mg_dl number Echo of fasting glucose in mg/dL
ketosis boolean Echo of caller-assigned ketosis (grade 2 when true unless a worse match)
t1dm boolean Echo of caller-assigned evidence of type 1 diabetes (grade 2 when true unless a worse match)
life_threatening boolean Echo of caller-assigned life-threatening flag (grade 4 when true)
severe_unable_adl boolean Echo of caller-assigned severe symptoms limiting self-care ADL (grade 3 when true unless a worse match)
criteria array Per-factor Tree rows with factor and met for life_threatening, glucose_gt_500, severe_unable_adl, glucose_gt_250, ketosis, t1dm, glucose_gt_160, and glucose_gt_99; glucose rows include value
citation object Brahmer 2018 J Clin Oncol ASCO irAE guideline 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_diabetes",
  "formula_expression": "irae_diabetes first-match worst-wins (Brahmer 2018 Table 4.4 fasting glucose mg/dL): grade 4 if life_threatening or glucose_mg_dl > 500; else grade 3 if severe_unable_adl or glucose_mg_dl > 250; else grade 2 if ketosis or t1dm or glucose_mg_dl > 160; else grade 1 if glucose_mg_dl > 99; else grade 0. icpi_action continue (0-1), hold_until_control (2), hold_admit (3-4). mg/dL only. Not DKA diagnostic criteria as a separate instrument. magent does not assay glucose. Not a diagnosis. Not an insulin dose",
  "criteria": [
    {
      "factor": "life_threatening",
      "met": false
    },
    {
      "value": 140.0,
      "factor": "glucose_gt_500",
      "met": false
    },
    {
      "factor": "severe_unable_adl",
      "met": false
    },
    {
      "value": 140.0,
      "factor": "glucose_gt_250",
      "met": false
    },
    {
      "factor": "ketosis",
      "met": false
    },
    {
      "factor": "t1dm",
      "met": false
    },
    {
      "value": 140.0,
      "factor": "glucose_gt_160",
      "met": false
    },
    {
      "value": 140.0,
      "factor": "glucose_gt_99",
      "met": true
    }
  ],
  "grade": 1,
  "glucose_mg_dl": 140.0,
  "icpi_action": "continue",
  "life_threatening": false,
  "ketosis": false,
  "severe_unable_adl": false,
  "t1dm": false
}

Client errors (HTTP 400)

Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.

HTTP Code When
400 invalid_glucose glucose_mg_dl (50-1000) or glucose_mmol_l (2.8-55.5) is required 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

  • Bang diabetes screening — Sum the Bang 2009 Table 2 development screening score for undiagnosed diabetes and return high_risk when the total is ≥5.
  • DKA-MPM — Sum the Efstathiou 2002 DKA-MPM flags (max 25) and return the published in-hospital death percents only for scores 0–14 (0.86%) and 19–25 (93.3%).

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.