# HEART score

HEART score

## Also searched as

- HEART score
- HEART chest pain score
- History ECG Age Risk Troponin
- Six HEART score
- emergency room HEART score
- chest pain HEART
- HEART score Six 2008

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

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

## What it computes

Compute the HEART score as age points plus caller-assigned history, ECG, risk factors, and troponin (each 0-2).

## When to use

When an agent needs the published Six 2008 HEART total and must not invent history, ECG, risk-factor, or troponin points from a tracing or assay.

## When not to use

- Not a diagnosis or discharge protocol.
- history, ecg, risk_factors, and troponin are caller-assigned integers 0-2. magent does not interpret the history, count risk factors, or read an ECG.
- This is the HEART score (Six 2008), not HEART Pathway. Troponin uses Six 2008 bands (≤ULN / 1-2× ULN / >2× ULN).

## Formula

```
HEART = history + ECG + age + risk_factors + troponin; each 0-2; age <45 0, 45-64 1, >=65 2; bands 0-3 / 4-6 / 7-10; max 10
```

## Citation

[Chest pain in the emergency room: value of the HEART score](https://doi.org/10.1007/BF03086144)
Six AJ, Backus BE, Kelder JC
Neth Heart J. 2008;16(6):191-196
DOI: [10.1007/BF03086144](https://doi.org/10.1007/BF03086144)

## Worked example

### Age 40, all components 0

Given: `age=40, ecg=0, history=0, risk_factors=0, troponin=0`

1. Age 40 (<45) → 0; history 0; ECG 0; risk_factors 0; troponin 0
2. Score = 0; band 0-3


## Parameters

- `age` (integer, required): Age in years (18-120). Younger than 45 scores 0; 45-64 scores 1; 65 or older scores 2.
- `history` (integer, required): Caller-assigned history. 0 nonspecific, 1 moderately suspicious, 2 highly suspicious. magent does not interpret the history.
- `ecg` (integer, required): Caller-assigned ECG. 0 normal; 1 repolarization without significant ST depression (including BBB, LVH, digoxin, or known unchanged); 2 significant ST depression or elevation without those confounders. magent does not read an ECG.
- `risk_factors` (integer, required): Caller-assigned risk-factor points. 0 none, 1 = 1-2 risk factors, 2 = ≥3 or atherosclerotic disease. magent does not count diabetes, smoking, or other factors.
- `troponin` (integer, required): Caller-assigned troponin. 0 ≤ULN, 1 = 1-2× ULN, 2 = >2× ULN (Six 2008). magent does not interpret assays.

## 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/heart`
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. Browsers that prefer text/html get the same paywall as GET; Pay retries POST with the same items.

Example request:

```json
{
  "items": [
    {
      "age": "40",
      "ecg": "0",
      "history": "0",
      "risk_factors": "0",
      "troponin": "0"
    },
    {
      "age": "40",
      "ecg": "0",
      "history": "0",
      "risk_factors": "0",
      "troponin": "0"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/heart",
  "items": [
    {
      "components": [
        {
          "value": 0,
          "factor": "history",
          "points": 0,
          "present": false
        },
        {
          "value": 0,
          "factor": "ecg",
          "points": 0,
          "present": false
        },
        {
          "value": 40,
          "factor": "age",
          "points": 0,
          "present": false
        },
        {
          "value": 0,
          "factor": "risk_factors",
          "points": 0,
          "present": false
        },
        {
          "value": 0,
          "factor": "troponin",
          "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": "Six AJ, Backus BE, Kelder JC",
        "doi": "10.1007/BF03086144",
        "id": "six-2008",
        "source": "Neth Heart J. 2008;16(6):191-196",
        "title": "Chest pain in the emergency room: value of the HEART score"
      },
      "formula": "heart",
      "formula_expression": "HEART = history + ECG + age + risk_factors + troponin; each 0-2; age <45 0, 45-64 1, >=65 2; bands 0-3 / 4-6 / 7-10; max 10",
      "max_score": 10,
      "score": 0,
      "age_years": 40,
      "heart_band": "0-3"
    },
    {
      "components": [
        {
          "value": 0,
          "factor": "history",
          "points": 0,
          "present": false
        },
        {
          "value": 0,
          "factor": "ecg",
          "points": 0,
          "present": false
        },
        {
          "value": 40,
          "factor": "age",
          "points": 0,
          "present": false
        },
        {
          "value": 0,
          "factor": "risk_factors",
          "points": 0,
          "present": false
        },
        {
          "value": 0,
          "factor": "troponin",
          "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": "Six AJ, Backus BE, Kelder JC",
        "doi": "10.1007/BF03086144",
        "id": "six-2008",
        "source": "Neth Heart J. 2008;16(6):191-196",
        "title": "Chest pain in the emergency room: value of the HEART score"
      },
      "formula": "heart",
      "formula_expression": "HEART = history + ECG + age + risk_factors + troponin; each 0-2; age <45 0, 45-64 1, >=65 2; bands 0-3 / 4-6 / 7-10; max 10",
      "max_score": 10,
      "score": 0,
      "age_years": 40,
      "heart_band": "0-3"
    }
  ]
}
```

## Response fields

- `formula` (string): heart
- `formula_expression` (string): Exact expression used
- `score` (integer): Total points 0-10
- `max_score` (integer): Always 10
- `heart_band` (string): 0-3, 4-6, or 7-10 (Six 2008)
- `age_years` (integer): Age used for the <45 / 45-64 / ≥65 bands
- `components` (array): Per-factor 0-2 points
- `citation` (object): Six 2008 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": 0,
      "factor": "history",
      "points": 0,
      "present": false
    },
    {
      "value": 0,
      "factor": "ecg",
      "points": 0,
      "present": false
    },
    {
      "value": 40,
      "factor": "age",
      "points": 0,
      "present": false
    },
    {
      "value": 0,
      "factor": "risk_factors",
      "points": 0,
      "present": false
    },
    {
      "value": 0,
      "factor": "troponin",
      "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": "Six AJ, Backus BE, Kelder JC",
    "doi": "10.1007/BF03086144",
    "id": "six-2008",
    "source": "Neth Heart J. 2008;16(6):191-196",
    "title": "Chest pain in the emergency room: value of the HEART score"
  },
  "formula": "heart",
  "formula_expression": "HEART = history + ECG + age + risk_factors + troponin; each 0-2; age <45 0, 45-64 1, >=65 2; bands 0-3 / 4-6 / 7-10; max 10",
  "max_score": 10,
  "score": 0,
  "age_years": 40,
  "heart_band": "0-3"
}
```

## Errors

- HTTP 400 `invalid_age`: age must be an integer from 18 to 120 Returned before settlement; you are not charged.
- HTTP 400 `invalid_heart_component`: history, ecg, risk_factors, and troponin must each be 0, 1, or 2. 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

- [TIMI risk score for STEMI](https://magentlab.com/docs/timi-stemi) — Compute the TIMI risk score for ST-elevation myocardial infarction from published bedside factors at presentation.
- [TIMI UA/NSTEMI](https://magentlab.com/docs/timi-ua-nstemi) — Compute the TIMI risk score for unstable angina / NSTEMI from age and six caller-assigned flags.

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

- 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 EIP-3009 (scheme exact, assetTransferMethod eip3009) with validBefore = now + accepts[0].maxTimeoutSeconds (600 seconds). That window starts when you sign and must cover wallet confirmation plus CDP verify and settle. Magent retries transient facilitator 429/5xx before answering. Do not send upto or batch-settlement payloads; magent does not offer those schemes.
- Retry the same URL with PAYMENT-SIGNATURE (base64 JSON echoing accepted, payload, and extensions when present).
- Success is HTTP 200 JSON plus PAYMENT-RESPONSE. Settlement happens before the tool runs. HTTP 503 settlement_uncertain or settle_failed: retry the same PAYMENT-SIGNATURE. Mint a new 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.

- 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.
- not offered `batch-settlement`: Not offered. Payment-channel vouchers claimed later in batches. Not the same as POST {items} bulk (that is still exact).

Same-path POST {items} is still scheme exact: one EIP-3009 authorization for n times the GET unit. 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

- Invalid query parameters return HTTP 400 before settlement. You are not charged.
- Settlement finishes before the tool executes (paymentFlow upfront). 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.
