Infection / VTE · LIVE
4PEPS pretest probability (Roy 2021)
4PEPS
Sum the Roy 2021 Table 3 4-level clinical pretest probability (4PEPS) items and return score and cpp (very_low, low, moderate, or high).
Markdown: /docs/4peps.md · Canonical: https://magentlab.com/docs/4peps
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
Sum the Roy 2021 Table 3 4-level clinical pretest probability (4PEPS) items and return score and cpp (very_low, low, moderate, or high).
When to use
When an agent already has the published Table 3 findings assigned and needs the 4PEPS total and clinical probability band, not an imaging or D-dimer order.
When not to use
- Not a medical device and not an imaging or D-dimer order. magent does not examine the patient or decide “PE most likely”.
- Age 65–80 and >80 were not independently associated in Table 3; ages ≥65 score 0 for the age item. Heart rate 80–100 was not independently associated; this tool does not add tachycardia points.
- Immobility is the Table 3 footnote: surgery, lower limb plaster cast, or bedridden more than 3 days for an acute medical condition within the last 4 weeks, as assigned by the caller.
- Clinical probability cutoffs are Table 3: very_low <0, low 0–5, moderate 6–12, high ≥13. Score may be negative. max_score is 22 when age ≥65 and all positive items fire.
Formula
4PEPS = age (<50 -2, 50-64 -1, ≥65 0) + chronic_respiratory_disease (-1) + heart_rate_bpm (<80 -1) + chest_pain_and_acute_dyspnea (1) + male (2) + hormonal_estrogenic_treatment (2) + personal_history_vte (2) + syncope (2) + immobility_4w (2) + spo2_percent (<95 3) + calf_pain_or_unilateral_edema (3) + pe_most_likely (5); Roy 2021 Table 3; cpp very_low <0, low 0-5, moderate 6-12, high ≥13; max 22 (age ≥65 plus all positive items; score may be negative)
Citation
- Authors
- Roy PM, Friou E, Germeau B, et al.
- Source
- JAMA Cardiol. 2021;6(6):669-677
Worked example
Age 40 female, no other Table 3 items
Given:
age=40calf_pain_or_unilateral_edema=falsechest_pain_and_acute_dyspnea=falsechronic_respiratory_disease=falseheart_rate_bpm=90hormonal_estrogenic_treatment=falseimmobility_4w=falsepe_most_likely=falsepersonal_history_vte=falsesex=femalespo2_percent=98syncope=false
- age 40 <50 → −2; heart_rate_bpm 90 is not <80 → 0; spo2_percent 98 is not <95 → 0; female → 0; all flags false
- Score = −2 (max 22); cpp = very_low
Age ≥65, male, SpO2 <95, calf finding, PE most likely
Given:
age=65calf_pain_or_unilateral_edema=truechest_pain_and_acute_dyspnea=falsechronic_respiratory_disease=falseheart_rate_bpm=90hormonal_estrogenic_treatment=falseimmobility_4w=falsepe_most_likely=truepersonal_history_vte=falsesex=malespo2_percent=90syncope=false
- age ≥65 → 0; male → +2; spo2_percent 90 <95 → +3; calf_pain_or_unilateral_edema → +3; pe_most_likely → +5
- Score = 13 (max 22); cpp = high
Also searched as
- 4PEPS
- 4-level PE pretest probability
- Roy 4PEPS
- four-level clinical pretest probability
- 4PEPS pulmonary embolism
- clinical pretest probability PE
- 4-level CPP PE
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/4peps?age=40&sex=female&heart_rate_bpm=90&spo2_percent=98&chronic_respiratory_disease=false&chest_pain_and_acute_dyspnea=false&hormonal_estrogenic_treatment=false&personal_history_vte=false&syncope=false&immobility_4w=false&calf_pain_or_unilateral_edema=false&pe_most_likely=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/4peps?age=40&sex=female&heart_rate_bpm=90&spo2_percent=98&chronic_respiratory_disease=false&chest_pain_and_acute_dyspnea=false&hormonal_estrogenic_treatment=false&personal_history_vte=false&syncope=false&immobility_4w=false&calf_pain_or_unilateral_edema=false&pe_most_likely=false"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
age |
integer | required | Age in years (integer 18-120). Roy 2021 Table 3: <50 scores −2; 50-64 scores −1; ≥65 scores 0 (65-80 and >80 were not independently associated). |
chronic_respiratory_disease |
boolean | required | Chronic respiratory disease (Roy 2021 Table 3). true scores −1. Assigned by the caller. magent does not examine the patient. |
heart_rate_bpm |
integer | required | Heart rate in beats per minute (integer 30-220). Table 3: <80 scores −1. 80-100 was not independently associated; this tool does not add tachycardia points. |
chest_pain_and_acute_dyspnea |
boolean | required | Both chest pain and acute dyspnea present as assigned by the caller (Roy 2021 Table 3). true scores +1. magent does not examine the patient. |
sex |
string | required · female, male | female or male (Roy 2021 Table 3). Male scores +2. Female scores 0. Assigned by the caller. |
hormonal_estrogenic_treatment |
boolean | required | Hormonal estrogenic treatment as assigned by the caller (Roy 2021 Table 3). true scores +2. |
personal_history_vte |
boolean | required | Personal history of VTE as assigned by the caller (Roy 2021 Table 3). true scores +2. |
syncope |
boolean | required | Syncope as assigned by the caller (Roy 2021 Table 3). true scores +2. magent does not examine the patient. |
immobility_4w |
boolean | required | Immobility within 4 weeks (Roy 2021 Table 3 footnote a): surgery, lower limb plaster cast, or bedridden more than 3 days for an acute medical condition. true scores +2. Assigned by the caller. magent does not examine the patient. |
spo2_percent |
number | required | Oxygen saturation percent (50-100). Roy 2021 Table 3: <95 scores +3; 95 and above score 0. |
calf_pain_or_unilateral_edema |
boolean | required | Calf pain and/or unilateral lower-limb edema as assigned by the caller (Roy 2021 Table 3). true scores +3. magent does not examine the patient. |
pe_most_likely |
boolean | required | PE is the most likely diagnosis as assigned by the caller (Roy 2021 Table 3). true scores +5. magent does not examine the patient or decide PE most likely. |
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": [
{
"age": "40",
"calf_pain_or_unilateral_edema": "false",
"chest_pain_and_acute_dyspnea": "false",
"chronic_respiratory_disease": "false",
"heart_rate_bpm": "90",
"hormonal_estrogenic_treatment": "false",
"immobility_4w": "false",
"pe_most_likely": "false",
"personal_history_vte": "false",
"sex": "female",
"spo2_percent": "98",
"syncope": "false"
},
{
"age": "40",
"calf_pain_or_unilateral_edema": "false",
"chest_pain_and_acute_dyspnea": "false",
"chronic_respiratory_disease": "false",
"heart_rate_bpm": "90",
"hormonal_estrogenic_treatment": "false",
"immobility_4w": "false",
"pe_most_likely": "false",
"personal_history_vte": "false",
"sex": "female",
"spo2_percent": "98",
"syncope": "false"
}
]
}
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/4peps",
"items": [
{
"components": [
{
"value": 40,
"factor": "age",
"points": -2,
"present": true
},
{
"factor": "chronic_respiratory_disease",
"points": 0,
"present": false
},
{
"value": 90,
"factor": "heart_rate_bpm",
"points": 0,
"present": false
},
{
"factor": "chest_pain_and_acute_dyspnea",
"points": 0,
"present": false
},
{
"value": "female",
"factor": "sex",
"points": 0,
"present": false
},
{
"factor": "hormonal_estrogenic_treatment",
"points": 0,
"present": false
},
{
"factor": "personal_history_vte",
"points": 0,
"present": false
},
{
"factor": "syncope",
"points": 0,
"present": false
},
{
"factor": "immobility_4w",
"points": 0,
"present": false
},
{
"value": 98.0,
"factor": "spo2_percent",
"points": 0,
"present": false
},
{
"factor": "calf_pain_or_unilateral_edema",
"points": 0,
"present": false
},
{
"factor": "pe_most_likely",
"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": "Roy PM, Friou E, Germeau B, et al.",
"doi": "10.1001/jamacardio.2021.0064",
"id": "roy-2021",
"pmid": "33656522",
"source": "JAMA Cardiol. 2021;6(6):669-677",
"title": "Derivation and Validation of a 4-Level Clinical Pretest Probability Score for Suspected Pulmonary Embolism to Safely Decrease Imaging Testing"
},
"formula": "4peps",
"formula_expression": "4PEPS = age (<50 -2, 50-64 -1, ≥65 0) + chronic_respiratory_disease (-1) + heart_rate_bpm (<80 -1) + chest_pain_and_acute_dyspnea (1) + male (2) + hormonal_estrogenic_treatment (2) + personal_history_vte (2) + syncope (2) + immobility_4w (2) + spo2_percent (<95 3) + calf_pain_or_unilateral_edema (3) + pe_most_likely (5); Roy 2021 Table 3; cpp very_low <0, low 0-5, moderate 6-12, high ≥13; max 22 (age ≥65 plus all positive items; score may be negative)",
"max_score": 22,
"score": -2,
"cpp": "very_low"
},
{
"components": [
{
"value": 40,
"factor": "age",
"points": -2,
"present": true
},
{
"factor": "chronic_respiratory_disease",
"points": 0,
"present": false
},
{
"value": 90,
"factor": "heart_rate_bpm",
"points": 0,
"present": false
},
{
"factor": "chest_pain_and_acute_dyspnea",
"points": 0,
"present": false
},
{
"value": "female",
"factor": "sex",
"points": 0,
"present": false
},
{
"factor": "hormonal_estrogenic_treatment",
"points": 0,
"present": false
},
{
"factor": "personal_history_vte",
"points": 0,
"present": false
},
{
"factor": "syncope",
"points": 0,
"present": false
},
{
"factor": "immobility_4w",
"points": 0,
"present": false
},
{
"value": 98.0,
"factor": "spo2_percent",
"points": 0,
"present": false
},
{
"factor": "calf_pain_or_unilateral_edema",
"points": 0,
"present": false
},
{
"factor": "pe_most_likely",
"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": "Roy PM, Friou E, Germeau B, et al.",
"doi": "10.1001/jamacardio.2021.0064",
"id": "roy-2021",
"pmid": "33656522",
"source": "JAMA Cardiol. 2021;6(6):669-677",
"title": "Derivation and Validation of a 4-Level Clinical Pretest Probability Score for Suspected Pulmonary Embolism to Safely Decrease Imaging Testing"
},
"formula": "4peps",
"formula_expression": "4PEPS = age (<50 -2, 50-64 -1, ≥65 0) + chronic_respiratory_disease (-1) + heart_rate_bpm (<80 -1) + chest_pain_and_acute_dyspnea (1) + male (2) + hormonal_estrogenic_treatment (2) + personal_history_vte (2) + syncope (2) + immobility_4w (2) + spo2_percent (<95 3) + calf_pain_or_unilateral_edema (3) + pe_most_likely (5); Roy 2021 Table 3; cpp very_low <0, low 0-5, moderate 6-12, high ≥13; max 22 (age ≥65 plus all positive items; score may be negative)",
"max_score": 22,
"score": -2,
"cpp": "very_low"
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | 4peps |
formula_expression |
string | Exact expression used |
score |
integer | 4PEPS points. May be negative. Theoretical maximum 22 when age ≥65 and all positive items fire. |
max_score |
integer | Always 22 (age ≥65 plus all positive Table 3 items; score may be negative) |
cpp |
string | Roy 2021 Table 3 clinical probability: very_low when score <0, low when 0-5, moderate when 6-12, high when ≥13. Not a diagnosis. |
components |
array | Per-item points |
citation |
object | Roy 2021 JAMA Cardiology citation |
disclaimer |
string | Not-a-device notice |
Example JSON
Machine form of the same example. Frozen fixture. Not a live lookup.
{
"components": [
{
"value": 40,
"factor": "age",
"points": -2,
"present": true
},
{
"factor": "chronic_respiratory_disease",
"points": 0,
"present": false
},
{
"value": 90,
"factor": "heart_rate_bpm",
"points": 0,
"present": false
},
{
"factor": "chest_pain_and_acute_dyspnea",
"points": 0,
"present": false
},
{
"value": "female",
"factor": "sex",
"points": 0,
"present": false
},
{
"factor": "hormonal_estrogenic_treatment",
"points": 0,
"present": false
},
{
"factor": "personal_history_vte",
"points": 0,
"present": false
},
{
"factor": "syncope",
"points": 0,
"present": false
},
{
"factor": "immobility_4w",
"points": 0,
"present": false
},
{
"value": 98.0,
"factor": "spo2_percent",
"points": 0,
"present": false
},
{
"factor": "calf_pain_or_unilateral_edema",
"points": 0,
"present": false
},
{
"factor": "pe_most_likely",
"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": "Roy PM, Friou E, Germeau B, et al.",
"doi": "10.1001/jamacardio.2021.0064",
"id": "roy-2021",
"pmid": "33656522",
"source": "JAMA Cardiol. 2021;6(6):669-677",
"title": "Derivation and Validation of a 4-Level Clinical Pretest Probability Score for Suspected Pulmonary Embolism to Safely Decrease Imaging Testing"
},
"formula": "4peps",
"formula_expression": "4PEPS = age (<50 -2, 50-64 -1, ≥65 0) + chronic_respiratory_disease (-1) + heart_rate_bpm (<80 -1) + chest_pain_and_acute_dyspnea (1) + male (2) + hormonal_estrogenic_treatment (2) + personal_history_vte (2) + syncope (2) + immobility_4w (2) + spo2_percent (<95 3) + calf_pain_or_unilateral_edema (3) + pe_most_likely (5); Roy 2021 Table 3; cpp very_low <0, low 0-5, moderate 6-12, high ≥13; max 22 (age ≥65 plus all positive items; score may be negative)",
"max_score": 22,
"score": -2,
"cpp": "very_low"
}
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_sex |
sex must be female or male Returned before settlement; you are not charged. |
| 400 | invalid_heart_rate |
heart_rate_bpm must be an integer from 30 to 220 Returned before settlement; you are not charged. |
| 400 | invalid_spo2 |
spo2_percent must be a number from 50 to 100. 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
- PERC rule — Apply the Kline 2004 eight-factor pulmonary embolism rule-out criteria and return whether all eight are met (PERC-negative).
- YEARS algorithm — Apply the van der Hulle 2017 YEARS algorithm: count three caller-assigned items and return whether PE is excluded at the published D-dimer threshold.
- Wells PE — Compute the Wells pulmonary-embolism probability score and return three-tier and two-tier bands.
- Revised Geneva score — Compute the Le Gal 2006 revised Geneva score for suspected pulmonary embolism in the emergency department from age, heart rate, and six caller-assigned findings.
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.