# GWTG-HF in-hospital heart failure mortality

GWTG-HF

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

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

## What it computes

Sum Peterson 2010 Figure 2 GWTG-HF integer points from seven admission predictors (age, systolic BP, BUN, sodium, heart rate, COPD, and caller-assigned nonblack race) for in-hospital mortality in hospitalized heart failure.

## When to use

When an agent already has admission age, systolic BP, BUN, sodium, heart rate, COPD history, and caller-assigned black as used in Peterson 2010 and needs the published 0–100 integer total, not a diagnosis, treatment order, or ADHERE tree. magent does not assign race.

## When not to use

- Not a medical device.
- Not a diagnosis of heart failure and not a treatment, ICU, or hospice order.
- black is caller-assigned as used in Peterson 2010 (nonblack race scores 3); magent does not assign race.
- Figure 2 integer points only. Figure 4 predicted in-hospital mortality (0.4% to 9.7%) is by predicted-risk decile without integer-score cutoffs in the primary paper; magent does not invent risk labels or map those deciles onto the total.
- Theoretical component sum can be 101 (heart rate ≥105 scores 8); the total is clamped to the paper's 0–100 range.
- magent does not measure vitals or laboratories. Values are caller-assigned.

## Formula

```
GWTG-HF = age (<=19 0, 20-29 3, 30-39 6, 40-49 8, 50-59 11, 60-69 14, 70-79 17, 80-89 19, 90-99 22, 100-109 25, >=110 28) + sbp_mm_hg (50-59 28, 60-69 26, 70-79 24, 80-89 23, 90-99 21, 100-109 19, 110-119 17, 120-129 15, 130-139 13, 140-149 11, 150-159 9, 160-169 8, 170-179 6, 180-189 4, 190-199 2, >=200 0) + bun_mg_dl (<=9 0, 10-19 2, 20-29 4, 30-39 6, 40-49 8, 50-59 9, 60-69 11, 70-79 13, 80-89 15, 90-99 17, 100-109 19, 110-119 21, 120-129 23, 130-139 25, 140-149 27, >=150 28) + sodium_mmol_l (<=130 4, 131-133 3, 134-136 2, 137-138 1, >=139 0) + heart_rate_bpm (<=79 0, 80-84 1, 85-89 3, 90-94 4, 95-99 5, 100-104 6, >=105 8) + copd 2 + nonblack (black=false) 3; Peterson 2010 Figure 2 integer points; total clamped to 0-100
```

## Citation

[A validated risk score for in-hospital mortality in patients with heart failure from the American Heart Association Get With the Guidelines Program](https://doi.org/10.1161/CIRCOUTCOMES.109.854877)
Peterson PN, Rumsfeld JS, Liang L, Albert NM, Hernandez AF, Peterson ED, Fonarow GC, Masoudi FA
Circ Cardiovasc Qual Outcomes. 2010;3(1):25-32
DOI: [10.1161/CIRCOUTCOMES.109.854877](https://doi.org/10.1161/CIRCOUTCOMES.109.854877)

## Worked example

### Mid-elderly HF admission, black=true (score 36)

Given: `age=70, black=true, bun_mg_dl=20, copd=false, heart_rate_bpm=80, sbp_mm_hg=130, sodium_mmol_l=138`

1. Age 70 (70-79) → 17
2. SBP 130 mm Hg (130-139) → 13
3. BUN 20 mg/dL (20-29) → 4
4. Sodium 138 mmol/L → 1
5. Heart rate 80 (80-84) → 1
6. COPD false → 0
7. black true (not nonblack) → 0
8. Score = 17+13+4+1+1+0+0 = 36 (max 100)


## Also searched as

- GWTG-HF
- Get With The Guidelines Heart Failure
- Peterson 2010 heart failure score
- GWTG heart failure in-hospital mortality
- AHA GWTG-HF risk score
- heart failure admission mortality points
- GWTG-HF integer points

## Parameters

- `age` (integer, required): Age in years (integer 18-120). Peterson 2010 Figure 2: ≤19 scores 0; 20-29 scores 3; 30-39 scores 6; 40-49 scores 8; 50-59 scores 11; 60-69 scores 14; 70-79 scores 17; 80-89 scores 19; 90-99 scores 22; 100-109 scores 25; ≥110 scores 28.
- `sbp_mm_hg` (integer, required): Admission systolic blood pressure in mm Hg (integer 50-250). Peterson 2010 Figure 2: 50-59 scores 28, then lower points as SBP rises, to ≥200 scores 0. magent does not measure blood pressure.
- `bun_mg_dl` (integer, required): Admission blood urea nitrogen in mg/dL (integer 1-200). Peterson 2010 Figure 2: ≤9 scores 0; ≥150 scores 28. magent does not assay BUN.
- `sodium_mmol_l` (integer, required): Admission serum sodium in mmol/L (integer 110-160; numerically equal to mEq/L). Peterson 2010 Figure 2: ≤130 scores 4; 131-133 scores 3; 134-136 scores 2; 137-138 scores 1; ≥139 scores 0. magent does not assay sodium.
- `heart_rate_bpm` (integer, required): Admission heart rate in beats per minute (integer 30-220). Peterson 2010 Figure 2: ≤79 scores 0; 80-84 scores 1; 85-89 scores 3; 90-94 scores 4; 95-99 scores 5; 100-104 scores 6; ≥105 scores 8. magent does not measure heart rate.
- `copd` (boolean, required): History of chronic obstructive pulmonary disease as assigned by the caller (Peterson 2010 Figure 2). true scores 2. magent does not diagnose COPD.
- `black` (boolean, required): Caller-assigned black as used in Peterson 2010; magent does not assign race. Nonblack race (false) scores 3. true or false.

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

Method: `POST /api/calc/gwtg_hf`
Max items: 25
Price: unit_amount + extra_item_amount * (n - 1) (unit 5000 atomic, extra 2000 atomic)
Status: 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:

```json
{
  "items": [
    {
      "age": "70",
      "black": "true",
      "bun_mg_dl": "20",
      "copd": "false",
      "heart_rate_bpm": "80",
      "sbp_mm_hg": "130",
      "sodium_mmol_l": "138"
    },
    {
      "age": "70",
      "black": "true",
      "bun_mg_dl": "20",
      "copd": "false",
      "heart_rate_bpm": "80",
      "sbp_mm_hg": "130",
      "sodium_mmol_l": "138"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/gwtg_hf",
  "items": [
    {
      "black": true,
      "components": [
        {
          "value": 70,
          "factor": "age",
          "points": 17,
          "present": true
        },
        {
          "value": 130,
          "factor": "sbp_mm_hg",
          "points": 13,
          "present": true
        },
        {
          "value": 20,
          "factor": "bun_mg_dl",
          "points": 4,
          "present": true
        },
        {
          "value": 138,
          "factor": "sodium_mmol_l",
          "points": 1,
          "present": true
        },
        {
          "value": 80,
          "factor": "heart_rate_bpm",
          "points": 1,
          "present": true
        },
        {
          "factor": "copd",
          "points": 0,
          "present": false
        },
        {
          "value": true,
          "factor": "nonblack",
          "points": 0,
          "present": false
        }
      ],
      "age": 70,
      "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": "Peterson PN, Rumsfeld JS, Liang L, Albert NM, Hernandez AF, Peterson ED, Fonarow GC, Masoudi FA",
        "doi": "10.1161/CIRCOUTCOMES.109.854877",
        "id": "peterson-2010-gwtg-hf",
        "pmid": "20123668",
        "source": "Circ Cardiovasc Qual Outcomes. 2010;3(1):25-32",
        "title": "A validated risk score for in-hospital mortality in patients with heart failure from the American Heart Association Get With the Guidelines Program"
      },
      "formula": "gwtg_hf",
      "formula_expression": "GWTG-HF = age (<=19 0, 20-29 3, 30-39 6, 40-49 8, 50-59 11, 60-69 14, 70-79 17, 80-89 19, 90-99 22, 100-109 25, >=110 28) + sbp_mm_hg (50-59 28, 60-69 26, 70-79 24, 80-89 23, 90-99 21, 100-109 19, 110-119 17, 120-129 15, 130-139 13, 140-149 11, 150-159 9, 160-169 8, 170-179 6, 180-189 4, 190-199 2, >=200 0) + bun_mg_dl (<=9 0, 10-19 2, 20-29 4, 30-39 6, 40-49 8, 50-59 9, 60-69 11, 70-79 13, 80-89 15, 90-99 17, 100-109 19, 110-119 21, 120-129 23, 130-139 25, 140-149 27, >=150 28) + sodium_mmol_l (<=130 4, 131-133 3, 134-136 2, 137-138 1, >=139 0) + heart_rate_bpm (<=79 0, 80-84 1, 85-89 3, 90-94 4, 95-99 5, 100-104 6, >=105 8) + copd 2 + nonblack (black=false) 3; Peterson 2010 Figure 2 integer points; total clamped to 0-100",
      "max_score": 100,
      "score": 36,
      "bun_mg_dl": 20,
      "heart_rate_bpm": 80,
      "sodium_mmol_l": 138,
      "sbp_mm_hg": 130,
      "copd": false
    },
    {
      "black": true,
      "components": [
        {
          "value": 70,
          "factor": "age",
          "points": 17,
          "present": true
        },
        {
          "value": 130,
          "factor": "sbp_mm_hg",
          "points": 13,
          "present": true
        },
        {
          "value": 20,
          "factor": "bun_mg_dl",
          "points": 4,
          "present": true
        },
        {
          "value": 138,
          "factor": "sodium_mmol_l",
          "points": 1,
          "present": true
        },
        {
          "value": 80,
          "factor": "heart_rate_bpm",
          "points": 1,
          "present": true
        },
        {
          "factor": "copd",
          "points": 0,
          "present": false
        },
        {
          "value": true,
          "factor": "nonblack",
          "points": 0,
          "present": false
        }
      ],
      "age": 70,
      "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": "Peterson PN, Rumsfeld JS, Liang L, Albert NM, Hernandez AF, Peterson ED, Fonarow GC, Masoudi FA",
        "doi": "10.1161/CIRCOUTCOMES.109.854877",
        "id": "peterson-2010-gwtg-hf",
        "pmid": "20123668",
        "source": "Circ Cardiovasc Qual Outcomes. 2010;3(1):25-32",
        "title": "A validated risk score for in-hospital mortality in patients with heart failure from the American Heart Association Get With the Guidelines Program"
      },
      "formula": "gwtg_hf",
      "formula_expression": "GWTG-HF = age (<=19 0, 20-29 3, 30-39 6, 40-49 8, 50-59 11, 60-69 14, 70-79 17, 80-89 19, 90-99 22, 100-109 25, >=110 28) + sbp_mm_hg (50-59 28, 60-69 26, 70-79 24, 80-89 23, 90-99 21, 100-109 19, 110-119 17, 120-129 15, 130-139 13, 140-149 11, 150-159 9, 160-169 8, 170-179 6, 180-189 4, 190-199 2, >=200 0) + bun_mg_dl (<=9 0, 10-19 2, 20-29 4, 30-39 6, 40-49 8, 50-59 9, 60-69 11, 70-79 13, 80-89 15, 90-99 17, 100-109 19, 110-119 21, 120-129 23, 130-139 25, 140-149 27, >=150 28) + sodium_mmol_l (<=130 4, 131-133 3, 134-136 2, 137-138 1, >=139 0) + heart_rate_bpm (<=79 0, 80-84 1, 85-89 3, 90-94 4, 95-99 5, 100-104 6, >=105 8) + copd 2 + nonblack (black=false) 3; Peterson 2010 Figure 2 integer points; total clamped to 0-100",
      "max_score": 100,
      "score": 36,
      "bun_mg_dl": 20,
      "heart_rate_bpm": 80,
      "sodium_mmol_l": 138,
      "sbp_mm_hg": 130,
      "copd": false
    }
  ]
}
```

## Response fields

- `formula` (string): gwtg_hf
- `formula_expression` (string): Peterson 2010 Figure 2 integer-point expression
- `score` (integer): Figure 2 integer sum, clamped to the paper's 0-100 range. Component maxima can sum to 101 (heart rate ≥105 scores 8).
- `max_score` (integer): 100 (Peterson 2010 total point range)
- `age` (integer): Age in years used for the age band
- `sbp_mm_hg` (integer): Systolic blood pressure in mm Hg used
- `bun_mg_dl` (integer): BUN in mg/dL used
- `sodium_mmol_l` (integer): Sodium in mmol/L used
- `heart_rate_bpm` (integer): Heart rate in beats per minute used
- `copd` (boolean): Caller-assigned COPD flag used
- `black` (boolean): Caller-assigned black as used in Peterson 2010; magent does not assign race
- `components` (array): Per-predictor Figure 2 points
- `citation` (object): Peterson 2010 Circ Cardiovasc Qual Outcomes citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "black": true,
  "components": [
    {
      "value": 70,
      "factor": "age",
      "points": 17,
      "present": true
    },
    {
      "value": 130,
      "factor": "sbp_mm_hg",
      "points": 13,
      "present": true
    },
    {
      "value": 20,
      "factor": "bun_mg_dl",
      "points": 4,
      "present": true
    },
    {
      "value": 138,
      "factor": "sodium_mmol_l",
      "points": 1,
      "present": true
    },
    {
      "value": 80,
      "factor": "heart_rate_bpm",
      "points": 1,
      "present": true
    },
    {
      "factor": "copd",
      "points": 0,
      "present": false
    },
    {
      "value": true,
      "factor": "nonblack",
      "points": 0,
      "present": false
    }
  ],
  "age": 70,
  "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": "Peterson PN, Rumsfeld JS, Liang L, Albert NM, Hernandez AF, Peterson ED, Fonarow GC, Masoudi FA",
    "doi": "10.1161/CIRCOUTCOMES.109.854877",
    "id": "peterson-2010-gwtg-hf",
    "pmid": "20123668",
    "source": "Circ Cardiovasc Qual Outcomes. 2010;3(1):25-32",
    "title": "A validated risk score for in-hospital mortality in patients with heart failure from the American Heart Association Get With the Guidelines Program"
  },
  "formula": "gwtg_hf",
  "formula_expression": "GWTG-HF = age (<=19 0, 20-29 3, 30-39 6, 40-49 8, 50-59 11, 60-69 14, 70-79 17, 80-89 19, 90-99 22, 100-109 25, >=110 28) + sbp_mm_hg (50-59 28, 60-69 26, 70-79 24, 80-89 23, 90-99 21, 100-109 19, 110-119 17, 120-129 15, 130-139 13, 140-149 11, 150-159 9, 160-169 8, 170-179 6, 180-189 4, 190-199 2, >=200 0) + bun_mg_dl (<=9 0, 10-19 2, 20-29 4, 30-39 6, 40-49 8, 50-59 9, 60-69 11, 70-79 13, 80-89 15, 90-99 17, 100-109 19, 110-119 21, 120-129 23, 130-139 25, 140-149 27, >=150 28) + sodium_mmol_l (<=130 4, 131-133 3, 134-136 2, 137-138 1, >=139 0) + heart_rate_bpm (<=79 0, 80-84 1, 85-89 3, 90-94 4, 95-99 5, 100-104 6, >=105 8) + copd 2 + nonblack (black=false) 3; Peterson 2010 Figure 2 integer points; total clamped to 0-100",
  "max_score": 100,
  "score": 36,
  "bun_mg_dl": 20,
  "heart_rate_bpm": 80,
  "sodium_mmol_l": 138,
  "sbp_mm_hg": 130,
  "copd": false
}
```

## Errors

- HTTP 400 `invalid_gwtg_hf`: GWTG-HF inputs must match Peterson 2010 age, SBP, BUN, sodium, heart rate, COPD, and caller-assigned black. Returned before settlement; you are not charged.
- 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.

Shared HTTP 402 and 503: https://magentlab.com/docs/payments

## Related tools

- [MAGGIC](https://magentlab.com/docs/maggic) — Sum the Pocock 2013 MAGGIC integer chart from thirteen caller-supplied heart-failure predictors and return the published Table 4 1-year and 3-year death probabilities for scores 0-50.
- [SAVE-score](https://magentlab.com/docs/save) — Sum Schmidt 2015 Table 4 SAVE-score cells including the published constant −6 and return class I–V with hospital survival percents.
- [Framingham HF criteria](https://magentlab.com/docs/framingham-hf) — Apply the McKee 1971 Framingham concurrent major and minor criteria and return definite or not_definite from nine major flags, seven minor flags, and the dual weight-loss flag.
- [ADHERE](https://magentlab.com/docs/adhere) — Apply the Fonarow 2005 ADHERE classification and regression tree for in-hospital mortality risk in acutely decompensated heart failure from admission BUN, systolic blood pressure, and serum creatinine.
- [H2FPEF](https://magentlab.com/docs/h2fpef) — Sum the Reddy 2018 H2FPEF points score (six components, max 9) and return score and max_score only.

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

- 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 accepts[0] (exact, EIP-3009) with validBefore = now + maxTimeoutSeconds (600 seconds), or accepts[1] (batch-settlement deposit/voucher) on product GET. Ping and POST {items} stay exact. Magent retries transient facilitator 429/5xx before answering.
- Retry the same URL with PAYMENT-SIGNATURE (base64 JSON of accepted and payload). Magent attaches canonical extensions.bazaar on CDP verify/settle; echoing 402 bazaar is optional.
- Success is HTTP 200 JSON plus PAYMENT-RESPONSE. exact settles before the tool. batch-settlement verifies (and deposit-settles) before the tool and commits the charge after HTTP 2xx. HTTP 503: retry the same PAYMENT-SIGNATURE. Mint a new exact 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.
- offered `batch-settlement` on eip155:8453: Payment-channel vouchers claimed later in batches. Exact stays accepts[0]. Same-path POST {items} is still exact. extra.assetTransferMethod=eip3009 extra.paymentFlow=authorization.

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

Same-path POST {items} is still scheme exact: one EIP-3009 authorization for GET unit plus $0.002 per extra item. 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

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