MAGENT

Neurology · LIVE

GI-GPA

Compute the Sperduto 2019 updated GI-GPA (graded prognostic assessment for gastrointestinal cancers with brain metastases) from caller-assigned KPS, age, extracranial metastases, and number of brain metastases, and report the published GPA group and median survival.

LIVE $0.005 USDC GET /api/calc/gi_gpa

Markdown: /docs/gi-gpa.md · Canonical: https://magentlab.com/docs/gi-gpa

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

What it computes

Compute the Sperduto 2019 updated GI-GPA (graded prognostic assessment for gastrointestinal cancers with brain metastases) from caller-assigned KPS, age, extracranial metastases, and number of brain metastases, and report the published GPA group and median survival.

When to use

When an agent already has Karnofsky Performance Status (decades 10-100), age, presence or absence of extracranial metastases, and brain-metastasis count, and must not invent GI-GPA points, assign KPS, or treat the score as a treatment order or lung-molGPA.

When not to use

  • Not a medical device and not a treatment order.
  • Sperduto 2019 Table 4 footnote lists median survival 3, 9, 12, 17 months; magent uses the abstract/Kaplan-Meier figures 3, 7, 11, 17 months for GPA groups 0-1.0, 1.5-2.0, 2.5-3.0, and 3.5-4.0.
  • Not lung-molGPA. This is the updated GI-GPA for gastrointestinal cancers with brain metastases (Sperduto 2019), not the lung-molGPA index.
  • The caller assigns KPS 10-100 by tens. magent does not assign KPS or examine the patient.

Formula

GI-GPA = kps_pts + age_pts + extracranial_pts + brain_met_pts; KPS <80 (10-70) 0, 80 1.0, 90-100 2.0; age >=60 0, <60 0.5; extracranial mets present 0, absent 0.5; brain mets >3 0, 2-3 0.5, 1 1.0; groups 0-1.0 / 1.5-2.0 / 2.5-3.0 / 3.5-4.0; max 4.0 (Sperduto 2019 Table 4; median survival from abstract/KM 3, 7, 11, 17 months)

Citation

Title
Estimating survival in patients with gastrointestinal cancers and brain metastases: An update of the graded prognostic assessment for gastrointestinal cancers (GI-GPA)
Authors
Sperduto PW, Fang P, Li J, et al.
Source
Clin Transl Radiat Oncol. 2019;18:39-45
DOI
10.1016/j.ctro.2019.06.007

Worked example

KPS 100, age 50, no extracranial mets, one brain met

Given: age=50brain_metastasis_count=1extracranial_metastases=falsekps=100

  1. KPS 100 is 90-100 → 2.0; age 50 is <60 → 0.5; extracranial mets absent → 0.5; one brain met → 1.0
  2. Score = 4.0 (max 4.0); gpa_group 3.5-4.0; median survival 17 months (abstract/KM)

KPS 70, age 70, extracranial mets, five brain mets

Given: age=70brain_metastasis_count=5extracranial_metastases=truekps=70

  1. KPS 70 is <80 → 0; age 70 is >=60 → 0; extracranial mets present → 0; five brain mets >3 → 0
  2. Score = 0 (max 4.0); gpa_group 0-1.0; median survival 3 months (abstract/KM)

KPS 80, age 55, no extracranial mets, two brain mets

Given: age=55brain_metastasis_count=2extracranial_metastases=falsekps=80

  1. KPS 80 → 1.0; age 55 is <60 → 0.5; extracranial mets absent → 0.5; two brain mets → 0.5
  2. Score = 2.5 (max 4.0); gpa_group 2.5-3.0; median survival 11 months (abstract/KM)

KPS 80, age 70, extracranial mets, one brain met

Given: age=70brain_metastasis_count=1extracranial_metastases=truekps=80

  1. KPS 80 → 1.0; age 70 is >=60 → 0; extracranial mets present → 0; one brain met → 1.0
  2. Score = 2.0 (max 4.0); gpa_group 1.5-2.0; median survival 7 months (abstract/KM)

Also searched as

  • GI-GPA
  • gastrointestinal GPA
  • Sperduto GI-GPA
  • graded prognostic assessment GI
  • GI cancer brain metastases GPA
  • updated GI-GPA
  • Sperduto 2019 GI-GPA
  • GI GPA median survival

Try

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

/api/calc/gi_gpa?kps=100&age=50&extracranial_metastases=false&brain_metastasis_count=1

Full URL: https://api.magentlab.com/api/calc/gi_gpa?kps=100&age=50&extracranial_metastases=false&brain_metastasis_count=1

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/gi_gpa?kps=100&age=50&extracranial_metastases=false&brain_metastasis_count=1"

Parameters

Name Type Required Description
kps integer required Caller-assigned Karnofsky Performance Status decade 10, 20, 30, 40, 50, 60, 70, 80, 90, or 100. Sperduto 2019 Table 4: <80 (10-70) scores 0; 80 scores 1.0; 90-100 scores 2.0. Grade 0 (dead) is not scored. magent does not assign KPS.
age integer required Age in years (18-120). Sperduto 2019 Table 4: >=60 scores 0; <60 scores 0.5.
extracranial_metastases boolean required Extracranial metastases (ECM). true (present) scores 0; false (absent) scores 0.5 (Sperduto 2019 Table 4). magent does not stage extracranial disease.
brain_metastasis_count integer required Number of brain metastases (integer 1-50). Sperduto 2019 Table 4: >3 scores 0; 2-3 scores 0.5; 1 scores 1.0. magent does not count metastases on imaging.

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/gi_gpa 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": [
    {
      "age": "50",
      "brain_metastasis_count": "1",
      "extracranial_metastases": "false",
      "kps": "100"
    },
    {
      "age": "50",
      "brain_metastasis_count": "1",
      "extracranial_metastases": "false",
      "kps": "100"
    }
  ]
}

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/gi_gpa",
  "items": [
    {
      "components": [
        {
          "value": 100,
          "factor": "kps",
          "points": 2.0,
          "present": true
        },
        {
          "value": 50,
          "factor": "age",
          "points": 0.5,
          "present": true
        },
        {
          "value": false,
          "factor": "extracranial_metastases",
          "points": 0.5,
          "present": true
        },
        {
          "value": 1,
          "factor": "brain_metastasis_count",
          "points": 1.0,
          "present": true
        }
      ],
      "age": 50,
      "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": "Sperduto PW, Fang P, Li J, et al.",
        "doi": "10.1016/j.ctro.2019.06.007",
        "id": "sperduto-2019-gi-gpa",
        "pmid": "31341974",
        "source": "Clin Transl Radiat Oncol. 2019;18:39-45",
        "title": "Estimating survival in patients with gastrointestinal cancers and brain metastases: An update of the graded prognostic assessment for gastrointestinal cancers (GI-GPA)"
      },
      "formula": "gi_gpa",
      "formula_expression": "GI-GPA = kps_pts + age_pts + extracranial_pts + brain_met_pts; KPS <80 (10-70) 0, 80 1.0, 90-100 2.0; age >=60 0, <60 0.5; extracranial mets present 0, absent 0.5; brain mets >3 0, 2-3 0.5, 1 1.0; groups 0-1.0 / 1.5-2.0 / 2.5-3.0 / 3.5-4.0; max 4.0 (Sperduto 2019 Table 4; median survival from abstract/KM 3, 7, 11, 17 months)",
      "max_score": 4.0,
      "score": 4.0,
      "brain_metastasis_count": 1,
      "extracranial_metastases": false,
      "gpa_group": "3.5-4.0",
      "kps": 100,
      "median_survival_months": 17
    },
    {
      "components": [
        {
          "value": 100,
          "factor": "kps",
          "points": 2.0,
          "present": true
        },
        {
          "value": 50,
          "factor": "age",
          "points": 0.5,
          "present": true
        },
        {
          "value": false,
          "factor": "extracranial_metastases",
          "points": 0.5,
          "present": true
        },
        {
          "value": 1,
          "factor": "brain_metastasis_count",
          "points": 1.0,
          "present": true
        }
      ],
      "age": 50,
      "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": "Sperduto PW, Fang P, Li J, et al.",
        "doi": "10.1016/j.ctro.2019.06.007",
        "id": "sperduto-2019-gi-gpa",
        "pmid": "31341974",
        "source": "Clin Transl Radiat Oncol. 2019;18:39-45",
        "title": "Estimating survival in patients with gastrointestinal cancers and brain metastases: An update of the graded prognostic assessment for gastrointestinal cancers (GI-GPA)"
      },
      "formula": "gi_gpa",
      "formula_expression": "GI-GPA = kps_pts + age_pts + extracranial_pts + brain_met_pts; KPS <80 (10-70) 0, 80 1.0, 90-100 2.0; age >=60 0, <60 0.5; extracranial mets present 0, absent 0.5; brain mets >3 0, 2-3 0.5, 1 1.0; groups 0-1.0 / 1.5-2.0 / 2.5-3.0 / 3.5-4.0; max 4.0 (Sperduto 2019 Table 4; median survival from abstract/KM 3, 7, 11, 17 months)",
      "max_score": 4.0,
      "score": 4.0,
      "brain_metastasis_count": 1,
      "extracranial_metastases": false,
      "gpa_group": "3.5-4.0",
      "kps": 100,
      "median_survival_months": 17
    }
  ]
}

Response

Field Type Description
formula string gi_gpa
formula_expression string Exact expression used
score number Total GI-GPA points 0-4.0 in 0.5 steps
max_score number Always 4.0
gpa_group string 0-1.0, 1.5-2.0, 2.5-3.0, or 3.5-4.0 from Sperduto 2019
median_survival_months integer Published median survival in months for that GPA group from the Sperduto 2019 abstract/Kaplan-Meier figures (3, 7, 11, 17), not the Table 4 footnote
kps integer Caller-assigned Karnofsky decade used for points
age integer Age in years used for points
extracranial_metastases boolean true if extracranial metastases are present
brain_metastasis_count integer Number of brain metastases used for points
components array Per-factor points
citation object Sperduto 2019 Clin Transl Radiat Oncol citation
disclaimer string Not-a-device notice

Example JSON

Machine form of the same example. Frozen fixture. Not a live lookup.

{
  "components": [
    {
      "value": 100,
      "factor": "kps",
      "points": 2.0,
      "present": true
    },
    {
      "value": 50,
      "factor": "age",
      "points": 0.5,
      "present": true
    },
    {
      "value": false,
      "factor": "extracranial_metastases",
      "points": 0.5,
      "present": true
    },
    {
      "value": 1,
      "factor": "brain_metastasis_count",
      "points": 1.0,
      "present": true
    }
  ],
  "age": 50,
  "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": "Sperduto PW, Fang P, Li J, et al.",
    "doi": "10.1016/j.ctro.2019.06.007",
    "id": "sperduto-2019-gi-gpa",
    "pmid": "31341974",
    "source": "Clin Transl Radiat Oncol. 2019;18:39-45",
    "title": "Estimating survival in patients with gastrointestinal cancers and brain metastases: An update of the graded prognostic assessment for gastrointestinal cancers (GI-GPA)"
  },
  "formula": "gi_gpa",
  "formula_expression": "GI-GPA = kps_pts + age_pts + extracranial_pts + brain_met_pts; KPS <80 (10-70) 0, 80 1.0, 90-100 2.0; age >=60 0, <60 0.5; extracranial mets present 0, absent 0.5; brain mets >3 0, 2-3 0.5, 1 1.0; groups 0-1.0 / 1.5-2.0 / 2.5-3.0 / 3.5-4.0; max 4.0 (Sperduto 2019 Table 4; median survival from abstract/KM 3, 7, 11, 17 months)",
  "max_score": 4.0,
  "score": 4.0,
  "brain_metastasis_count": 1,
  "extracranial_metastases": false,
  "gpa_group": "3.5-4.0",
  "kps": 100,
  "median_survival_months": 17
}

Client errors (HTTP 400)

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

HTTP Code When
400 invalid_karnofsky kps must be 10, 20, 30, 40, 50, 60, 70, 80, 90, or 100 (Karnofsky 1949). Grade 0 (dead) is not scored. Returned before settlement; you are not charged.
400 invalid_age age must be an integer from 18 to 120 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_brain_metastasis_count brain_metastasis_count must be an integer from 1 to 50 (Sperduto 2019 number of brain metastases). 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

  • Brain metastasis velocity — Compute Farris 2017 brain metastasis velocity as new_brain_metastases / years_since_first_srs and report the published low, intermediate, or high group plus that group's median overall survival after initial distant brain failure.
  • THRIVE — Compute the Flint 2010 THRIVE (Totaled Health Risks in Vascular Events) score from trichotomized age, trichotomized NIHSS, and the chronic disease scale (hypertension, diabetes mellitus, atrial fibrillation).
  • Karnofsky — Return the Karnofsky 1949 Performance Status 10-100 from a caller-assigned integer, with a stable label.

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.