# Mayo 1997 SPN malignancy probability

Mayo SPN

Status: LIVE
Price: $0.005 USDC
`GET /api/calc/mayo_spn`
HTML: https://magentlab.com/docs/mayo-spn
Markdown: https://magentlab.com/docs/mayo-spn.md

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

## What it computes

Compute the Swensen 1997 Mayo Clinic logistic probability of malignancy for a radiologically indeterminate solitary pulmonary nodule from age, smoking, remote extrathoracic cancer, diameter, spiculation, and upper-lobe location.

## When to use

When an agent already has the six Swensen 1997 predictors as assigned by the caller and needs the published logistic probability. magent does not read the film. Not a diagnosis, biopsy order, or medical device.

## When not to use

- Not a medical device, not a diagnosis, and not a biopsy order.
- Swensen 1997 Mayo Clinic model only. Not the VA Gould 2007 model and not Brock.
- magent does not read the film. Spiculation and upper-lobe location are caller-assigned.
- Diameter is clamped to the 4-30 mm derivation range. Cancer diagnosed within 5 years of the nodule was excluded from derivation.
- Age 18-120 is an implementation clamp; Swensen 1997 is an adult derivation. No malignancy-percent bands are published in this model.

## Formula

```
P = e^x / (1 + e^x); x = -6.8272 + 0.0391*age + 0.7917*smoke + 1.3388*cancer + 0.1274*diameter_mm + 1.0407*spiculation + 0.7838*upper_lobe; smoke 1 = current or former, 0 = never; cancer 1 = extrathoracic cancer diagnosed ≥5 years before the nodule; spiculation 1/0; upper_lobe 1/0 (Swensen 1997)
```

## Citation

[The probability of malignancy in solitary pulmonary nodules. Application to small radiologically indeterminate nodules](https://doi.org/10.1001/archinte.1997.00440290031002)
Swensen SJ, Silverstein MD, Ilstrup DM, Schleck CD, Edell ES
Arch Intern Med. 1997;157(8):849-855
DOI: [10.1001/archinte.1997.00440290031002](https://doi.org/10.1001/archinte.1997.00440290031002)

## Worked example

### Age 50, never-smoker, 8 mm, no remote cancer, smooth, not upper lobe

Given: `age=50, cancer=false, diameter_mm=8, smoke=false, spiculation=false, upper_lobe=false`

1. smoke = 0 (never); cancer = 0; spiculation = 0; upper_lobe = 0
2. x = -6.8272 + 0.0391*50 + 0.1274*8 = -3.853
3. P = e^x / (1 + e^x) = 0.0208


## Also searched as

- Mayo SPN
- Mayo Clinic SPN model
- Swensen 1997 nodule
- solitary pulmonary nodule malignancy
- SPN probability of malignancy
- radiologically indeterminate nodule
- Mayo logistic SPN

## Parameters

- `age` (integer, required): Age in years (18-120). Swensen 1997 is an adult derivation; 18 is an implementation clamp.
- `smoke` (boolean, required): Cigarette smoking as coded in Swensen 1997. true = current or former smoker (1); false = never (0). The caller assigns smoking history.
- `cancer` (boolean, required): Extrathoracic cancer diagnosed ≥5 years before the nodule (Swensen 1997). true scores 1; false scores 0. The derivation excluded cancer within 5 years. The caller assigns the history.
- `diameter_mm` (number, required): Largest nodule diameter in millimetres (4-30). Swensen 1997 derivation range. magent does not measure the film.
- `spiculation` (boolean, required): Spiculated edge as assigned by the caller (Swensen 1997). true or false. magent does not read the film.
- `upper_lobe` (boolean, required): Upper-lobe location as assigned by the caller (Swensen 1997). true or false. magent does not read the film.

## 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/mayo_spn`
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": [
    {
      "age": "50",
      "cancer": "false",
      "diameter_mm": "8",
      "smoke": "false",
      "spiculation": "false",
      "upper_lobe": "false"
    },
    {
      "age": "50",
      "cancer": "false",
      "diameter_mm": "8",
      "smoke": "false",
      "spiculation": "false",
      "upper_lobe": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/mayo_spn",
  "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": "Swensen SJ, Silverstein MD, Ilstrup DM, Schleck CD, Edell ES",
        "doi": "10.1001/archinte.1997.00440290031002",
        "id": "swensen-1997",
        "pmid": "9129544",
        "source": "Arch Intern Med. 1997;157(8):849-855",
        "title": "The probability of malignancy in solitary pulmonary nodules. Application to small radiologically indeterminate nodules"
      },
      "formula": "mayo_spn",
      "formula_expression": "P = e^x / (1 + e^x); x = -6.8272 + 0.0391*age + 0.7917*smoke + 1.3388*cancer + 0.1274*diameter_mm + 1.0407*spiculation + 0.7838*upper_lobe; smoke 1 = current or former, 0 = never; cancer 1 = extrathoracic cancer diagnosed ≥5 years before the nodule; spiculation 1/0; upper_lobe 1/0 (Swensen 1997)",
      "age_years": 50,
      "cancer": false,
      "diameter_mm": 8.0,
      "linear_predictor": -3.853,
      "probability": 0.0208,
      "smoke": false,
      "spiculation": false,
      "upper_lobe": 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": "Swensen SJ, Silverstein MD, Ilstrup DM, Schleck CD, Edell ES",
        "doi": "10.1001/archinte.1997.00440290031002",
        "id": "swensen-1997",
        "pmid": "9129544",
        "source": "Arch Intern Med. 1997;157(8):849-855",
        "title": "The probability of malignancy in solitary pulmonary nodules. Application to small radiologically indeterminate nodules"
      },
      "formula": "mayo_spn",
      "formula_expression": "P = e^x / (1 + e^x); x = -6.8272 + 0.0391*age + 0.7917*smoke + 1.3388*cancer + 0.1274*diameter_mm + 1.0407*spiculation + 0.7838*upper_lobe; smoke 1 = current or former, 0 = never; cancer 1 = extrathoracic cancer diagnosed ≥5 years before the nodule; spiculation 1/0; upper_lobe 1/0 (Swensen 1997)",
      "age_years": 50,
      "cancer": false,
      "diameter_mm": 8.0,
      "linear_predictor": -3.853,
      "probability": 0.0208,
      "smoke": false,
      "spiculation": false,
      "upper_lobe": false
    }
  ]
}
```

## Response fields

- `formula` (string): mayo_spn
- `formula_expression` (string): Swensen 1997 logistic expression
- `age_years` (integer): Age in years used
- `smoke` (boolean): true if current or former smoker; false if never
- `cancer` (boolean): true if extrathoracic cancer diagnosed ≥5 years before the nodule
- `diameter_mm` (number): Largest nodule diameter in millimetres
- `spiculation` (boolean): Caller-assigned spiculated edge
- `upper_lobe` (boolean): Caller-assigned upper-lobe location
- `linear_predictor` (number): Swensen 1997 logit x, 4 decimals
- `probability` (number): P = e^x / (1 + e^x) on 0-1, 4 decimals. Not a malignancy-percent band, diagnosis, or biopsy order.
- `citation` (object): Swensen 1997 Arch Intern Med citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "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": "Swensen SJ, Silverstein MD, Ilstrup DM, Schleck CD, Edell ES",
    "doi": "10.1001/archinte.1997.00440290031002",
    "id": "swensen-1997",
    "pmid": "9129544",
    "source": "Arch Intern Med. 1997;157(8):849-855",
    "title": "The probability of malignancy in solitary pulmonary nodules. Application to small radiologically indeterminate nodules"
  },
  "formula": "mayo_spn",
  "formula_expression": "P = e^x / (1 + e^x); x = -6.8272 + 0.0391*age + 0.7917*smoke + 1.3388*cancer + 0.1274*diameter_mm + 1.0407*spiculation + 0.7838*upper_lobe; smoke 1 = current or former, 0 = never; cancer 1 = extrathoracic cancer diagnosed ≥5 years before the nodule; spiculation 1/0; upper_lobe 1/0 (Swensen 1997)",
  "age_years": 50,
  "cancer": false,
  "diameter_mm": 8.0,
  "linear_predictor": -3.853,
  "probability": 0.0208,
  "smoke": false,
  "spiculation": false,
  "upper_lobe": false
}
```

## Errors

- HTTP 400 `invalid_age`: age must be an integer from 18 to 120 Returned before settlement; you are not charged.
- HTTP 400 `invalid_mayo_spn`: each Mayo 1997 SPN item must be a published value for that field. Returned before settlement; you are not charged.
- HTTP 400 `invalid_nodule_mm`: diameter_mm must be a number from 4 to 30 (Swensen 1997 derivation). 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

- [LENT](https://magentlab.com/docs/lent) — Sum the Clive 2014 Table 3 LENT score (pleural fluid LDH, ECOG, serum NLR, tumour type) and return low (0-1), moderate (2-4), or high (5-7).

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