# Leibovich 2018 histology-specific RCC models

Leibovich 2018 RCC models

Status: LIVE
Price: $0.005 USDC
`GET /api/calc/leibovich_2018`
HTML: https://magentlab.com/docs/leibovich-2018
Markdown: https://magentlab.com/docs/leibovich-2018.md

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

## What it computes

Sum the Leibovich 2018 progression-free score from caller-assigned histology, 2010 T and N, tumor size, nuclear grade, and necrosis, and return the published risk grouping for that histology.

## When to use

When an agent already has surgical histology (clear cell, papillary, or chromophobe), 2010 pathologic T and N, size in cm, nuclear grade, and necrosis and needs the 2018 PFS total and low/intermediate/high group. magent does not stage the tumor or read slides, and must not invent an RCC diagnosis, SSIGN, or the 2003 Leibovich Cancer table.

## When not to use

- Not a medical device. magent does not stage the tumor or read pathology.
- Leibovich 2018 histology-specific models only. Not Frank 2002 SSIGN (1997 TNM, size 5 cm, pT4 0). Not the 2003 Leibovich Cancer table (2002 TNM, T1b 2, T2 3, T3-4 4, necrosis 1, N1/N2).
- ccRCC uses 2010 TNM tokens and additive PFS points. The 2018 paper also published a nine-factor ccRCC PFS conversion (symptoms, sarcomatoid, fat, thrombus, extension) and a separate CSS score; those extra factors are not inputs here.
- Papillary groups use grade plus T as a fat/thrombus proxy. Chromophobe groups use T as a fat proxy plus N; sarcomatoid is not an input. Chromophobe has no CSS model in the paper.
- Size uses unrounded cm; 10.0 cm scores 1 on ccRCC. Magent clamp 0.1-30 cm is not a published range.
- Published groups are cohort strata, not an individualized prediction or a treatment recommendation. Not an RCC diagnosis.

## Formula

```
ccRCC PFS (Leibovich 2018, 2010 TNM): t_stage (t1a/t1b/t2a 0, t2b 2, t3a/t3b/t3c 3, t4 4) + n_stage (nx/n0 0, n1 2) + tumor_size_cm >=10 1 + nuclear_grade (1-2 0, 3 1, 4 3) + necrosis 2; max 12; risk low 0-2, intermediate 3-5, high >=6. papillary PFS groups: low grade 1-2 and t1-t2; intermediate grade 3 and t1-t2; high grade 4 or t3a-t4 (fat or thrombus). chromophobe PFS groups: low t1-t2 and nx/n0; intermediate t3a-t4 and nx/n0 (fat); high n1. Not Frank 2002 SSIGN. Not Leibovich 2003. No chromophobe CSS model.
```

## Citation

[Predicting Oncologic Outcomes in Renal Cell Carcinoma After Surgery](https://doi.org/10.1016/j.eururo.2018.01.005)
Leibovich BC, Lohse CM, Cheville JC, Zaid HB, Boorjian SA, Frank I, Thompson RH, Parker WP
Eur Urol. 2018;73(5):772-780
DOI: [10.1016/j.eururo.2018.01.005](https://doi.org/10.1016/j.eururo.2018.01.005)

## Worked example

### Lowest-risk ccRCC pT1a N0 size <10 cm grade 2 no necrosis

Given: `histology=clear_cell, n_stage=n0, necrosis=false, nuclear_grade=2, t_stage=t1a, tumor_size_cm=3`

1. clear_cell; t1a → 0; n0 → 0
2. size 3 cm <10 → 0; nuclear_grade 2 → 0; necrosis false → 0
3. Score = 0 (max 12); risk = low


### Highest-weight ccRCC pT4 N1 size ≥10 cm grade 4 necrosis

Given: `histology=clear_cell, n_stage=n1, necrosis=true, nuclear_grade=4, t_stage=t4, tumor_size_cm=12`

1. clear_cell; t4 → 4; n1 → 2; size 12 cm ≥10 → 1; nuclear_grade 4 → 3; necrosis true → 2
2. Score = 12 (max 12); risk = high


## Also searched as

- Leibovich 2018
- 2018 Leibovich model
- ccRCC progression score
- papillary RCC risk group
- chromophobe RCC risk group
- histology-specific RCC score
- 2010 TNM RCC score
- Leibovich PFS groups

## Parameters

- `histology` (string, required): Surgical histology as assigned by the caller (Leibovich 2018). clear_cell, papillary, or chromophobe. Not collecting-duct or unclassified. magent does not read slides.
- `t_stage` (string, required): 2010 pathologic T as assigned by the caller (Leibovich 2018). t1a, t1b, t2a, t2b, t3a, t3b, t3c, or t4. Not 1997/2002 T without a/b substages. magent does not stage the tumor.
- `n_stage` (string, required): 2010 pathologic N as assigned by the caller (Leibovich 2018). nx or n0 scores 0 on ccRCC; n1 scores 2. Not n2 (2002 N). magent does not stage nodes.
- `tumor_size_cm` (number, required): Maximum tumor size in cm as assigned by the caller (Leibovich 2018). Unrounded; 10.0 cm or greater scores 1 on ccRCC. Magent clamp 0.1-30, not a published range. magent does not measure the tumor.
- `nuclear_grade` (integer, required): Nuclear grade 1-4 as assigned by the caller (Leibovich 2018). On ccRCC, 1-2 score 0; 3 scores 1; 4 scores 3. Integer 1-4 only; reject 0, 5, 1.5, and roman I. magent does not read slides.
- `necrosis` (boolean, required): Histologic tumor necrosis as assigned by the caller (Leibovich 2018). true scores 2 on ccRCC. magent does not read slides.

## 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/leibovich_2018`
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": [
    {
      "histology": "clear_cell",
      "n_stage": "n0",
      "necrosis": "false",
      "nuclear_grade": "2",
      "t_stage": "t1a",
      "tumor_size_cm": "3"
    },
    {
      "histology": "clear_cell",
      "n_stage": "n0",
      "necrosis": "false",
      "nuclear_grade": "2",
      "t_stage": "t1a",
      "tumor_size_cm": "3"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/leibovich_2018",
  "items": [
    {
      "components": [
        {
          "value": "t1a",
          "factor": "t_stage",
          "points": 0,
          "present": true
        },
        {
          "value": "n0",
          "factor": "n_stage",
          "points": 0,
          "present": true
        },
        {
          "value": 3.0,
          "factor": "tumor_size_cm",
          "points": 0,
          "present": false
        },
        {
          "value": 2,
          "factor": "nuclear_grade",
          "points": 0,
          "present": true
        },
        {
          "factor": "necrosis",
          "points": 0,
          "present": 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": "Leibovich BC, Lohse CM, Cheville JC, Zaid HB, Boorjian SA, Frank I, Thompson RH, Parker WP",
        "doi": "10.1016/j.eururo.2018.01.005",
        "id": "leibovich-2018",
        "pmid": "29398265",
        "source": "Eur Urol. 2018;73(5):772-780",
        "title": "Predicting Oncologic Outcomes in Renal Cell Carcinoma After Surgery"
      },
      "formula": "leibovich_2018",
      "formula_expression": "ccRCC PFS (Leibovich 2018, 2010 TNM): t_stage (t1a/t1b/t2a 0, t2b 2, t3a/t3b/t3c 3, t4 4) + n_stage (nx/n0 0, n1 2) + tumor_size_cm >=10 1 + nuclear_grade (1-2 0, 3 1, 4 3) + necrosis 2; max 12; risk low 0-2, intermediate 3-5, high >=6. papillary PFS groups: low grade 1-2 and t1-t2; intermediate grade 3 and t1-t2; high grade 4 or t3a-t4 (fat or thrombus). chromophobe PFS groups: low t1-t2 and nx/n0; intermediate t3a-t4 and nx/n0 (fat); high n1. Not Frank 2002 SSIGN. Not Leibovich 2003. No chromophobe CSS model.",
      "max_score": 12,
      "score": 0,
      "risk": "low",
      "t_stage": "t1a",
      "histology": "clear_cell",
      "n_stage": "n0",
      "necrosis": false,
      "nuclear_grade": 2,
      "tumor_size_cm": 3.0
    },
    {
      "components": [
        {
          "value": "t1a",
          "factor": "t_stage",
          "points": 0,
          "present": true
        },
        {
          "value": "n0",
          "factor": "n_stage",
          "points": 0,
          "present": true
        },
        {
          "value": 3.0,
          "factor": "tumor_size_cm",
          "points": 0,
          "present": false
        },
        {
          "value": 2,
          "factor": "nuclear_grade",
          "points": 0,
          "present": true
        },
        {
          "factor": "necrosis",
          "points": 0,
          "present": 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": "Leibovich BC, Lohse CM, Cheville JC, Zaid HB, Boorjian SA, Frank I, Thompson RH, Parker WP",
        "doi": "10.1016/j.eururo.2018.01.005",
        "id": "leibovich-2018",
        "pmid": "29398265",
        "source": "Eur Urol. 2018;73(5):772-780",
        "title": "Predicting Oncologic Outcomes in Renal Cell Carcinoma After Surgery"
      },
      "formula": "leibovich_2018",
      "formula_expression": "ccRCC PFS (Leibovich 2018, 2010 TNM): t_stage (t1a/t1b/t2a 0, t2b 2, t3a/t3b/t3c 3, t4 4) + n_stage (nx/n0 0, n1 2) + tumor_size_cm >=10 1 + nuclear_grade (1-2 0, 3 1, 4 3) + necrosis 2; max 12; risk low 0-2, intermediate 3-5, high >=6. papillary PFS groups: low grade 1-2 and t1-t2; intermediate grade 3 and t1-t2; high grade 4 or t3a-t4 (fat or thrombus). chromophobe PFS groups: low t1-t2 and nx/n0; intermediate t3a-t4 and nx/n0 (fat); high n1. Not Frank 2002 SSIGN. Not Leibovich 2003. No chromophobe CSS model.",
      "max_score": 12,
      "score": 0,
      "risk": "low",
      "t_stage": "t1a",
      "histology": "clear_cell",
      "n_stage": "n0",
      "necrosis": false,
      "nuclear_grade": 2,
      "tumor_size_cm": 3.0
    }
  ]
}
```

## Response fields

- `formula` (string): leibovich_2018
- `formula_expression` (string): Exact expression used
- `histology` (string): Caller-assigned histology used (clear_cell, papillary, or chromophobe)
- `t_stage` (string): Caller-assigned 2010 T used (t1a, t1b, t2a, t2b, t3a, t3b, t3c, or t4)
- `n_stage` (string): Caller-assigned 2010 N used (nx, n0, or n1)
- `tumor_size_cm` (number): Caller-assigned tumor size in cm used (unrounded at the 10 cm boundary)
- `nuclear_grade` (integer): Caller-assigned nuclear grade 1-4 used
- `necrosis` (boolean): Caller-assigned histologic necrosis flag used
- `score` (integer): Leibovich 2018 PFS integer: ccRCC 0-12 additive points; papillary and chromophobe 0-2 group index. Not an RCC diagnosis.
- `max_score` (integer): 12 for clear_cell; 2 for papillary and chromophobe
- `risk` (string): low, intermediate, or high. ccRCC uses 0-2 / 3-5 / >=6 on the 2018 weights. papillary and chromophobe use the 2018 three groups. Historical grouping, not an individualized prediction.
- `components` (array): Per-factor Leibovich 2018 PFS points
- `citation` (object): Leibovich et al. Eur Urol 2018 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": "t1a",
      "factor": "t_stage",
      "points": 0,
      "present": true
    },
    {
      "value": "n0",
      "factor": "n_stage",
      "points": 0,
      "present": true
    },
    {
      "value": 3.0,
      "factor": "tumor_size_cm",
      "points": 0,
      "present": false
    },
    {
      "value": 2,
      "factor": "nuclear_grade",
      "points": 0,
      "present": true
    },
    {
      "factor": "necrosis",
      "points": 0,
      "present": 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": "Leibovich BC, Lohse CM, Cheville JC, Zaid HB, Boorjian SA, Frank I, Thompson RH, Parker WP",
    "doi": "10.1016/j.eururo.2018.01.005",
    "id": "leibovich-2018",
    "pmid": "29398265",
    "source": "Eur Urol. 2018;73(5):772-780",
    "title": "Predicting Oncologic Outcomes in Renal Cell Carcinoma After Surgery"
  },
  "formula": "leibovich_2018",
  "formula_expression": "ccRCC PFS (Leibovich 2018, 2010 TNM): t_stage (t1a/t1b/t2a 0, t2b 2, t3a/t3b/t3c 3, t4 4) + n_stage (nx/n0 0, n1 2) + tumor_size_cm >=10 1 + nuclear_grade (1-2 0, 3 1, 4 3) + necrosis 2; max 12; risk low 0-2, intermediate 3-5, high >=6. papillary PFS groups: low grade 1-2 and t1-t2; intermediate grade 3 and t1-t2; high grade 4 or t3a-t4 (fat or thrombus). chromophobe PFS groups: low t1-t2 and nx/n0; intermediate t3a-t4 and nx/n0 (fat); high n1. Not Frank 2002 SSIGN. Not Leibovich 2003. No chromophobe CSS model.",
  "max_score": 12,
  "score": 0,
  "risk": "low",
  "t_stage": "t1a",
  "histology": "clear_cell",
  "n_stage": "n0",
  "necrosis": false,
  "nuclear_grade": 2,
  "tumor_size_cm": 3.0
}
```

## Errors

- HTTP 400 `invalid_rcc_histology`: histology must be clear_cell, papillary, or chromophobe (Leibovich 2018). Returned before settlement; you are not charged.
- HTTP 400 `invalid_t_stage`: t_stage must be a pathologic T token from the cited paper (Leibovich 2018). Returned before settlement; you are not charged.
- HTTP 400 `invalid_n_stage`: n_stage must be nx, n0, or n1 (Leibovich 2018). Returned before settlement; you are not charged.
- HTTP 400 `invalid_nuclear_grade`: nuclear_grade must be an integer from 1 to 4 (Leibovich 2018). Returned before settlement; you are not charged.
- HTTP 400 `invalid_tumor_size_cm`: tumor_size_cm must be a number from 0.1 to 30 (Leibovich 2018 tumor size cm). 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

- [SSIGN score](https://magentlab.com/docs/ssign) — Sum the Frank 2002 SSIGN score from caller-assigned 1997 TNM, tumor size, nuclear grade, and coagulative necrosis, and return the published cancer-specific survival row.
- [Fuhrman](https://magentlab.com/docs/fuhrman) — Echo the caller-assigned Fuhrman 1982 nuclear grade (1-4) with the published nuclear-feature description. magent does not read slides. Not WHO/ISUP 2016.

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