MAGENT

Respiratory · LIVE

Mayo 1997 SPN malignancy probability

Mayo SPN

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.

LIVE $0.005 USDC GET /api/calc/mayo_spn

Markdown: /docs/mayo-spn.md · Canonical: https://magentlab.com/docs/mayo-spn

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

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

Worked example

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

Given: age=50cancer=falsediameter_mm=8smoke=falsespiculation=falseupper_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

Try

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

/api/calc/mayo_spn?age=50&smoke=false&cancer=false&diameter_mm=8&spiculation=false&upper_lobe=false

Full URL: https://api.magentlab.com/api/calc/mayo_spn?age=50&smoke=false&cancer=false&diameter_mm=8&spiculation=false&upper_lobe=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/mayo_spn?age=50&smoke=false&cancer=false&diameter_mm=8&spiculation=false&upper_lobe=false"

Parameters

Name Type Required Description
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.

POST /api/calc/mayo_spn 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",
      "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"
    }
  ]
}

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/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.",
      "age_years": 50,
      "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)",
      "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.",
      "age_years": 50,
      "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)",
      "cancer": false,
      "diameter_mm": 8.0,
      "linear_predictor": -3.853,
      "probability": 0.0208,
      "smoke": false,
      "spiculation": false,
      "upper_lobe": false
    }
  ]
}

Response

Field Type Description
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

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.",
  "age_years": 50,
  "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)",
  "cancer": false,
  "diameter_mm": 8.0,
  "linear_predictor": -3.853,
  "probability": 0.0208,
  "smoke": false,
  "spiculation": false,
  "upper_lobe": false
}

Client errors (HTTP 400)

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

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

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