Infection / VTE · LIVE
Wells PE probability score
Wells PE
Compute the Wells pulmonary-embolism probability score and return three-tier and two-tier bands.
Markdown: /docs/wells-pe.md · Canonical: https://magentlab.com/docs/wells-pe
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
Compute the Wells pulmonary-embolism probability score and return three-tier and two-tier bands.
When to use
When an agent needs the published Wells PE arithmetic and must not invent a probability from prose.
When not to use
- Not a diagnosis. Bands are published cut-points, not a PE rule-out.
- Flags are caller-supplied booleans. magent does not read imaging or D-dimer.
Formula
Wells PE = 3*signs_dvt + 3*pe_number_one + 1.5*hr_gt_100 + 1.5*immobilization_or_surgery + 1.5*previous_dvt_pe + 1*hemoptysis + 1*malignancy
Citation
- Authors
- Wells PS, Anderson DR, Rodger M, et al.
- Source
- Ann Intern Med. 2001;135(2):98-107
Worked example
signs_dvt + pe_number_one
Given:
hemoptysis=falsehr_gt_100=falseimmobilization_or_surgery=falsemalignancy=falsepe_number_one=trueprevious_dvt_pe=falsesigns_dvt=true
- signs_dvt → 3; pe_number_one → 3
- Score = 6.0 → three-tier moderate, two-tier likely (>4)
Also searched as
- Wells PE two-tier cutoff
- Wells pulmonary embolism
- PE likely unlikely
- Wells PE score
Try
Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.
Full URL: https://api.magentlab.com/api/calc/wells_pe?signs_dvt=true&pe_number_one=true&hr_gt_100=false&immobilization_or_surgery=false&previous_dvt_pe=false&hemoptysis=false&malignancy=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/wells_pe?signs_dvt=true&pe_number_one=true&hr_gt_100=false&immobilization_or_surgery=false&previous_dvt_pe=false&hemoptysis=false&malignancy=false"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
signs_dvt |
boolean | required | Clinical signs and symptoms of DVT (3 points). |
pe_number_one |
boolean | required | PE is the number-one diagnosis or equally likely (3 points). |
hr_gt_100 |
boolean | required | Heart rate >100 (1.5 points). |
immobilization_or_surgery |
boolean | required | Immobilization ≥3 days or surgery in previous 4 weeks (1.5 points). |
previous_dvt_pe |
boolean | required | Previous DVT or PE (1.5 points). |
hemoptysis |
boolean | required | Hemoptysis (1 point). |
malignancy |
boolean | required | Malignancy with treatment in last 6 months or palliative (1 point). |
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.
- 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": [
{
"hemoptysis": "false",
"hr_gt_100": "false",
"immobilization_or_surgery": "false",
"malignancy": "false",
"pe_number_one": "true",
"previous_dvt_pe": "false",
"signs_dvt": "true"
},
{
"hemoptysis": "false",
"hr_gt_100": "false",
"immobilization_or_surgery": "false",
"malignancy": "false",
"pe_number_one": "true",
"previous_dvt_pe": "false",
"signs_dvt": "true"
}
]
}
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/wells_pe",
"items": [
{
"components": [
{
"factor": "signs_dvt",
"points": 3.0,
"present": true
},
{
"factor": "pe_number_one",
"points": 3.0,
"present": true
},
{
"factor": "hr_gt_100",
"points": 0.0,
"present": false
},
{
"factor": "immobilization_or_surgery",
"points": 0.0,
"present": false
},
{
"factor": "previous_dvt_pe",
"points": 0.0,
"present": false
},
{
"factor": "hemoptysis",
"points": 0.0,
"present": false
},
{
"factor": "malignancy",
"points": 0.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": "Wells PS, Anderson DR, Rodger M, et al.",
"doi": "10.7326/0003-4819-135-2-200107170-00010",
"id": "wells-pe-2001",
"source": "Ann Intern Med. 2001;135(2):98-107",
"title": "Excluding pulmonary embolism at the bedside without diagnostic imaging: management of patients with suspected pulmonary embolism presenting to the emergency department by using a simple clinical model and d-dimer"
},
"formula": "wells_pe",
"formula_expression": "Wells PE = 3*signs_dvt + 3*pe_number_one + 1.5*hr_gt_100 + 1.5*immobilization_or_surgery + 1.5*previous_dvt_pe + 1*hemoptysis + 1*malignancy",
"max_score": 12.5,
"score": 6.0,
"three_tier": "moderate",
"two_tier": "likely"
},
{
"components": [
{
"factor": "signs_dvt",
"points": 3.0,
"present": true
},
{
"factor": "pe_number_one",
"points": 3.0,
"present": true
},
{
"factor": "hr_gt_100",
"points": 0.0,
"present": false
},
{
"factor": "immobilization_or_surgery",
"points": 0.0,
"present": false
},
{
"factor": "previous_dvt_pe",
"points": 0.0,
"present": false
},
{
"factor": "hemoptysis",
"points": 0.0,
"present": false
},
{
"factor": "malignancy",
"points": 0.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": "Wells PS, Anderson DR, Rodger M, et al.",
"doi": "10.7326/0003-4819-135-2-200107170-00010",
"id": "wells-pe-2001",
"source": "Ann Intern Med. 2001;135(2):98-107",
"title": "Excluding pulmonary embolism at the bedside without diagnostic imaging: management of patients with suspected pulmonary embolism presenting to the emergency department by using a simple clinical model and d-dimer"
},
"formula": "wells_pe",
"formula_expression": "Wells PE = 3*signs_dvt + 3*pe_number_one + 1.5*hr_gt_100 + 1.5*immobilization_or_surgery + 1.5*previous_dvt_pe + 1*hemoptysis + 1*malignancy",
"max_score": 12.5,
"score": 6.0,
"three_tier": "moderate",
"two_tier": "likely"
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | wells_pe |
formula_expression |
string | Exact expression used |
score |
number | Total points (0-12.5, 0.5 steps) |
max_score |
number | Always 12.5 |
three_tier |
string | low (0-1), moderate (2-6), high (≥7). Not a diagnosis. |
two_tier |
string | likely (>4) or unlikely (≤4). Not a diagnosis. |
components |
array | Per-factor points |
citation |
object | Ann Intern Med 2001 citation |
disclaimer |
string | Not-a-device notice |
Example JSON
Machine form of the same example. Frozen fixture. Not a live lookup.
{
"components": [
{
"factor": "signs_dvt",
"points": 3.0,
"present": true
},
{
"factor": "pe_number_one",
"points": 3.0,
"present": true
},
{
"factor": "hr_gt_100",
"points": 0.0,
"present": false
},
{
"factor": "immobilization_or_surgery",
"points": 0.0,
"present": false
},
{
"factor": "previous_dvt_pe",
"points": 0.0,
"present": false
},
{
"factor": "hemoptysis",
"points": 0.0,
"present": false
},
{
"factor": "malignancy",
"points": 0.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": "Wells PS, Anderson DR, Rodger M, et al.",
"doi": "10.7326/0003-4819-135-2-200107170-00010",
"id": "wells-pe-2001",
"source": "Ann Intern Med. 2001;135(2):98-107",
"title": "Excluding pulmonary embolism at the bedside without diagnostic imaging: management of patients with suspected pulmonary embolism presenting to the emergency department by using a simple clinical model and d-dimer"
},
"formula": "wells_pe",
"formula_expression": "Wells PE = 3*signs_dvt + 3*pe_number_one + 1.5*hr_gt_100 + 1.5*immobilization_or_surgery + 1.5*previous_dvt_pe + 1*hemoptysis + 1*malignancy",
"max_score": 12.5,
"score": 6.0,
"three_tier": "moderate",
"two_tier": "likely"
}
Client errors (HTTP 400)
Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.
| HTTP | Code | When |
|---|---|---|
| 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
- Wells DVT — Compute the Wells deep-vein thrombosis probability score and return three-tier and two-tier bands.
- CURB-65 — Compute the CURB-65 community-acquired pneumonia severity score from age and discrete flags.
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.