# Wells PE

Status: LIVE
Price: $0.005 USDC
`GET /api/calc/wells_pe`
HTML: https://magentlab.com/docs/wells-pe
Markdown: https://magentlab.com/docs/wells-pe.md

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

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
Wells PS, Anderson DR, Rodger M, et al.
Ann Intern Med. 2001;135(2):98-107
DOI: [10.7326/0003-4819-135-2-200107170-00010](https://doi.org/10.7326/0003-4819-135-2-200107170-00010)

## Worked example

### signs_dvt + pe_number_one

Given: `hemoptysis=false, hr_gt_100=false, immobilization_or_surgery=false, malignancy=false, pe_number_one=true, previous_dvt_pe=false, signs_dvt=true`

1. signs_dvt → 3; pe_number_one → 3
2. Score = 6.0 → three-tier moderate, two-tier likely (>4)


## Parameters

- `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. Price is n times the GET unit. Invalid items return HTTP 400 before settlement.

Method: `POST /api/calc/wells_pe`
Max items: 25
Price: unit_amount * n (unit 5000 atomic)
Status: PREVIEW

- 1 to 25 items. Each item uses the same keys as the GET query parameters.
- 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. HTML paywall is GET only.

Example request:

```json
{
  "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"
    }
  ]
}
```

Example 200:

```json
{
  "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 coded-ontology 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 coded-ontology 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 fields

- `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

Frozen fixture. Not a live lookup.

```json
{
  "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 coded-ontology 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"
}
```

## Errors

- 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.
- HTTP 402 `payment_required`: Missing or invalid PAYMENT-SIGNATURE; decode the PAYMENT-REQUIRED header
- HTTP 409 `payment_in_progress`: The same authorization nonce is already being settled; retry shortly
- HTTP 429 `rate_limited`: Too many requests from this client
- HTTP 503 `settlement_uncertain`: Settlement is unconfirmed; retry with the same PAYMENT-SIGNATURE
- HTTP 503 `facilitator_unavailable`: Payment facilitator unavailable
- HTTP 503 `facilitator_misconfigured`: Payment facilitator is not configured
- HTTP 503 `facilitator_unauthorized`: Payment facilitator rejected credentials
- HTTP 503 `ledger_unavailable`: Payment ledger unavailable
- HTTP 503 `payment_unavailable`: Payment processing unavailable

## Related tools

- [Wells DVT](https://magentlab.com/docs/wells-dvt) — Compute the Wells deep-vein thrombosis probability score and return three-tier and two-tier bands.
- [CURB-65](https://magentlab.com/docs/curb65) — Compute the CURB-65 community-acquired pneumonia severity score from age and discrete flags.

## Also searched as

- Wells PE two-tier cutoff
- Wells pulmonary embolism
- PE likely unlikely
- Wells PE score

## Payment

Required query parameters must be present and valid. 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.

## Guarantees

- Invalid query parameters return HTTP 400 before settlement. You are not charged.
- Settlement finishes before the tool executes. Uncertain settlement fails closed (HTTP 503).
- Execution is timeout-bounded and concurrency-capped.
- Calculator inputs are not persisted. Request logs store path without query.
