MAGENT

Neurology · LIVE

Therapy-Disability-Neurology grade

TDN Grade

Apply the Terrapon 2021 Therapy-Disability-Neurology grade and return tdn_grade 1-5 as the maximum of caller-assigned therapy, mapped mRS disability, and new-deficit neurology grades.

LIVE $0.005 USDC GET /api/calc/tdn_grade

Markdown: /docs/tdn-grade.md · Canonical: https://magentlab.com/docs/tdn-grade

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

What it computes

Apply the Terrapon 2021 Therapy-Disability-Neurology grade and return tdn_grade 1-5 as the maximum of caller-assigned therapy, mapped mRS disability, and new-deficit neurology grades.

When to use

When an agent already has a caller-assigned therapy intensity (t1-t5), modified Rankin 0-6, and whether a new neurologic deficit occurred, and needs the published TDN grade. magent does not grade the adverse event.

When not to use

  • Not a medical device and not a diagnosis. magent does not examine the patient and does not grade the adverse event; the caller assigns therapy, modified Rankin, and new deficit.
  • Not Clavien-Dindo alone. TDN grades therapy, disability, and neurology together; the overall grade is the maximum of the three dimensions.
  • Disability uses modified Rankin 0-6 including death (6). This is not van Swieten 1988 modified Rankin 0-5, which omits death.
  • Therapy t5 or disability_mrs 6 is always TDN grade 5 (death).

Formula

tdn_grade = max(T, D, N); T is therapy t1-t5 (t1 no treatment beyond antiemetics, antipyretics, analgesics, diuretics, electrolytes, physiotherapy, bedside wound opening; t2 pharmacologic including transfusion or TPN; t3 invasive procedure; t4 life-threatening ICU; t5 death); D maps disability_mrs 0-1→1, 2-3→2, 4→3, 5→4, 6→5; N is 2 if new_neurologic_deficit else 1; if therapy is t5 or disability_mrs is 6, tdn_grade is 5 (Terrapon 2021)

Citation

Title
Adverse Events in Neurosurgery: The Novel Therapy-Disability-Neurology Grade
Authors
Terrapon APR, Zattra CM, Voglis S, et al.
Source
Neurosurgery. 2021;89(2):236-245
DOI
10.1093/neuros/nyab121

Worked example

TDN 1

Given: disability_mrs=0new_neurologic_deficit=falsetherapy=t1

  1. therapy t1 maps to T=1
  2. disability_mrs 0 maps to D=1
  3. new_neurologic_deficit false maps to N=1
  4. tdn_grade = max(1, 1, 1) = 1

TDN 2

Given: disability_mrs=1new_neurologic_deficit=truetherapy=t2

  1. therapy t2 maps to T=2
  2. disability_mrs 1 maps to D=1
  3. new_neurologic_deficit true maps to N=2
  4. tdn_grade = max(2, 1, 2) = 2

TDN 3

Given: disability_mrs=4new_neurologic_deficit=falsetherapy=t3

  1. therapy t3 maps to T=3
  2. disability_mrs 4 maps to D=3
  3. new_neurologic_deficit false maps to N=1
  4. tdn_grade = max(3, 3, 1) = 3

TDN 4

Given: disability_mrs=5new_neurologic_deficit=falsetherapy=t2

  1. therapy t2 maps to T=2
  2. disability_mrs 5 maps to D=4
  3. new_neurologic_deficit false maps to N=1
  4. tdn_grade = max(2, 4, 1) = 4

TDN 5

Given: disability_mrs=0new_neurologic_deficit=falsetherapy=t5

  1. therapy t5 maps to T=5 (death)
  2. disability_mrs 0 maps to D=1
  3. new_neurologic_deficit false maps to N=1
  4. therapy t5 forces tdn_grade 5

Also searched as

  • TDN grade
  • Therapy-Disability-Neurology grade
  • Terrapon TDN
  • neurosurgical adverse event grade
  • TDN classification
  • therapy disability neurology
  • TDN grade neurosurgery

Try

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

/api/calc/tdn_grade?therapy=t1&disability_mrs=0&new_neurologic_deficit=false

Full URL: https://api.magentlab.com/api/calc/tdn_grade?therapy=t1&disability_mrs=0&new_neurologic_deficit=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/tdn_grade?therapy=t1&disability_mrs=0&new_neurologic_deficit=false"

Parameters

Name Type Required Description
therapy string required · t1, t2, t3, t4, t5 Terrapon 2021 Therapy dimension as assigned by the caller. t1 no treatment or intervention beyond antiemetics, antipyretics, analgesics, diuretics, electrolytes, physiotherapy, or bedside wound opening (T=1). t2 pharmacologic treatment including blood transfusion or TPN (T=2). t3 invasive procedure, surgical, endoscopic, or radiologic (T=3). t4 life-threatening, ICU management (T=4). t5 death (T=5). magent does not grade the adverse event.
disability_mrs integer required Modified Rankin 0-6 as assigned by the caller, including death as 6. Maps to Disability D: 0-1→1, 2-3→2, 4→3, 5→4, 6→5. This is not van Swieten 1988 modified Rankin 0-5, which omits death. magent does not interview the patient.
new_neurologic_deficit boolean required New neurologic deficit as assigned by the caller (Terrapon 2021 Neurology dimension). true or false. false is N=1; true is N=2. 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.

POST /api/calc/tdn_grade 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": [
    {
      "disability_mrs": "0",
      "new_neurologic_deficit": "false",
      "therapy": "t1"
    },
    {
      "disability_mrs": "0",
      "new_neurologic_deficit": "false",
      "therapy": "t1"
    }
  ]
}

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/tdn_grade",
  "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": "Terrapon APR, Zattra CM, Voglis S, et al.",
        "doi": "10.1093/neuros/nyab121",
        "id": "terrapon-2021",
        "pmid": "33887774",
        "source": "Neurosurgery. 2021;89(2):236-245",
        "title": "Adverse Events in Neurosurgery: The Novel Therapy-Disability-Neurology Grade"
      },
      "formula": "tdn_grade",
      "formula_expression": "tdn_grade = max(T, D, N); T is therapy t1-t5 (t1 no treatment beyond antiemetics, antipyretics, analgesics, diuretics, electrolytes, physiotherapy, bedside wound opening; t2 pharmacologic including transfusion or TPN; t3 invasive procedure; t4 life-threatening ICU; t5 death); D maps disability_mrs 0-1→1, 2-3→2, 4→3, 5→4, 6→5; N is 2 if new_neurologic_deficit else 1; if therapy is t5 or disability_mrs is 6, tdn_grade is 5 (Terrapon 2021)",
      "criteria": [
        {
          "value": 1,
          "factor": "therapy",
          "met": true
        },
        {
          "value": 1,
          "factor": "disability",
          "met": true
        },
        {
          "value": 1,
          "factor": "neurology",
          "met": true
        }
      ],
      "disability_grade": 1,
      "neurology_grade": 1,
      "tdn_grade": 1,
      "therapy_grade": 1
    },
    {
      "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": "Terrapon APR, Zattra CM, Voglis S, et al.",
        "doi": "10.1093/neuros/nyab121",
        "id": "terrapon-2021",
        "pmid": "33887774",
        "source": "Neurosurgery. 2021;89(2):236-245",
        "title": "Adverse Events in Neurosurgery: The Novel Therapy-Disability-Neurology Grade"
      },
      "formula": "tdn_grade",
      "formula_expression": "tdn_grade = max(T, D, N); T is therapy t1-t5 (t1 no treatment beyond antiemetics, antipyretics, analgesics, diuretics, electrolytes, physiotherapy, bedside wound opening; t2 pharmacologic including transfusion or TPN; t3 invasive procedure; t4 life-threatening ICU; t5 death); D maps disability_mrs 0-1→1, 2-3→2, 4→3, 5→4, 6→5; N is 2 if new_neurologic_deficit else 1; if therapy is t5 or disability_mrs is 6, tdn_grade is 5 (Terrapon 2021)",
      "criteria": [
        {
          "value": 1,
          "factor": "therapy",
          "met": true
        },
        {
          "value": 1,
          "factor": "disability",
          "met": true
        },
        {
          "value": 1,
          "factor": "neurology",
          "met": true
        }
      ],
      "disability_grade": 1,
      "neurology_grade": 1,
      "tdn_grade": 1,
      "therapy_grade": 1
    }
  ]
}

Response

Field Type Description
formula string tdn_grade
formula_expression string Published Terrapon 2021 max(T, D, N) rule
tdn_grade integer Overall TDN grade 1-5, the maximum of therapy, disability, and neurology grades. Always 5 when therapy is t5 or disability_mrs is 6. Not a diagnosis.
therapy_grade integer Therapy dimension T 1-5 from caller-assigned t1-t5
disability_grade integer Disability dimension D 1-5 from caller-assigned mRS 0-6
neurology_grade integer Neurology dimension N 1 without a new deficit, 2 with a new deficit
criteria array Per-dimension Tree rows for therapy, disability, and neurology with factor, met (true when that dimension equals tdn_grade), and value
citation object Terrapon 2021 Neurosurgery 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": "Terrapon APR, Zattra CM, Voglis S, et al.",
    "doi": "10.1093/neuros/nyab121",
    "id": "terrapon-2021",
    "pmid": "33887774",
    "source": "Neurosurgery. 2021;89(2):236-245",
    "title": "Adverse Events in Neurosurgery: The Novel Therapy-Disability-Neurology Grade"
  },
  "formula": "tdn_grade",
  "formula_expression": "tdn_grade = max(T, D, N); T is therapy t1-t5 (t1 no treatment beyond antiemetics, antipyretics, analgesics, diuretics, electrolytes, physiotherapy, bedside wound opening; t2 pharmacologic including transfusion or TPN; t3 invasive procedure; t4 life-threatening ICU; t5 death); D maps disability_mrs 0-1→1, 2-3→2, 4→3, 5→4, 6→5; N is 2 if new_neurologic_deficit else 1; if therapy is t5 or disability_mrs is 6, tdn_grade is 5 (Terrapon 2021)",
  "criteria": [
    {
      "value": 1,
      "factor": "therapy",
      "met": true
    },
    {
      "value": 1,
      "factor": "disability",
      "met": true
    },
    {
      "value": 1,
      "factor": "neurology",
      "met": true
    }
  ],
  "disability_grade": 1,
  "neurology_grade": 1,
  "tdn_grade": 1,
  "therapy_grade": 1
}

Client errors (HTTP 400)

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

HTTP Code When
400 invalid_tdn_therapy therapy must be t1, t2, t3, t4, or t5 (Terrapon 2021 Therapy dimension). Returned before settlement; you are not charged.
400 invalid_tdn_mrs disability_mrs must be an integer from 0 to 6 (Terrapon 2021 mRS; 6 is death). 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

  • Modified Rankin — Return the van Swieten 1988 modified Rankin handicap grade 0-5 from a caller-assigned integer, with the published grade wording.
  • Glasgow Coma Scale — Compute the Glasgow Coma Scale as the sum of caller-assigned eye, verbal, and motor integers. The 1974 or 1976 edition is required.

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.