# GRACE in-hospital ACS score

GRACE

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

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

## What it computes

Sum the Granger 2003 in-hospital GRACE 1.0 nomogram points from eight admission predictors and return that paper's printed in-hospital mortality readout.

## When to use

When an agent already has age, heart rate, systolic BP, creatinine, Killip class, cardiac arrest, ST-segment deviation, and initial enzyme flags and needs the Granger 2003 in-hospital point total, not a catheterization order.

## When not to use

- Not a medical device.
- Not a cath-lab order, reperfusion protocol, or diagnosis of ACS. magent does not interpret the ECG or assign Killip class.
- Granger 2003 in-hospital GRACE 1.0 integer nomogram only. Not the later continuous GRACE 2.0 model. Not Fox 2006 6-month mortality. Not Eagle 2004 post-discharge.
- Does not apply later ESC NSTE-ACS ≤108 / 109-140 / >140 cutoffs; those bands are not printed in Granger 2003. in_hospital_mortality_percent is the 2003 nomogram readout (≤60 → 0.2%; labeled 70-240 percents at or below the total; ≥250 → 52%).
- Cardiac arrest, ST-segment deviation, and elevated enzymes are caller-assigned flags. magent does not read the chart or the laboratory.

## Formula

```
GRACE = age_points(<30:0, 30-39:8, 40-49:25, 50-59:41, 60-69:58, 70-79:75, 80-89:91, >=90:100) + heart_rate_points(<50:0, 50-69:3, 70-89:9, 90-109:15, 110-149:24, 150-199:38, >=200:46) + sbp_points(<80:58, 80-99:53, 100-119:43, 120-139:34, 140-159:24, 160-199:10, >=200:0) + creatinine_mg_dl_points(0-0.39:1, 0.4-0.79:4, 0.8-1.19:7, 1.2-1.59:10, 1.6-1.99:13, 2.0-3.99:21, >=4:28) + killip(1:0, 2:20, 3:39, 4:59) + 39 if cardiac_arrest + 28 if st_deviation + 14 if elevated_enzymes; Granger 2003 in-hospital GRACE 1.0 nomogram; max 372; in_hospital_mortality_percent is that paper's printed score readout (score<=60 → 0.2; then the labeled 70-240 percents at or below the total; score>=250 → 52); not ESC 108/140 cutoffs, not GRACE 2.0, not Fox 2006 6-month
```

## Citation

[Predictors of hospital mortality in the global registry of acute coronary events](https://doi.org/10.1001/archinte.163.19.2345)
Granger CB, Goldberg RJ, Dabbous O, Pieper KS, Eagle KA, Cannon CP, Van De Werf F, Avezum A, Goodman SG, Flather MD, Fox KA; Global Registry of Acute Coronary Events Investigators
Arch Intern Med. 2003;163(19):2345-2353
DOI: [10.1001/archinte.163.19.2345](https://doi.org/10.1001/archinte.163.19.2345)

## Worked example

### Typical NSTE-ACS, Killip I, no arrest, no ST deviation, negative enzymes

Given: `age=65, cardiac_arrest=false, creatinine_mg_dl=1.0, elevated_enzymes=false, heart_rate_bpm=80, killip_class=1, sbp_mm_hg=130, st_deviation=false`

1. age 65 → 58 (60-69 band)
2. heart_rate_bpm 80 → 9 (70-89 band)
3. sbp_mm_hg 130 → 34 (120-139 band)
4. creatinine_mg_dl 1.0 → 7 (0.8-1.19 band)
5. killip_class 1 → 0; cardiac_arrest false → 0; st_deviation false → 0; elevated_enzymes false → 0
6. Score = 108 (max 372); in_hospital_mortality_percent = 0.8 (printed 100 → 0.8%)


### Older ACS with Killip III, ST deviation, and elevated enzymes

Given: `age=80, cardiac_arrest=false, creatinine_mg_dl=2.2, elevated_enzymes=true, heart_rate_bpm=110, killip_class=3, sbp_mm_hg=90, st_deviation=true`

1. age 80 → 91; heart_rate_bpm 110 → 24; sbp_mm_hg 90 → 53; creatinine_mg_dl 2.2 → 21
2. killip_class 3 → 39; cardiac_arrest false → 0; st_deviation true → 28; elevated_enzymes true → 14
3. Score = 270 (max 372); in_hospital_mortality_percent = 52.0 (printed ≥250 → ≥52%)


## Also searched as

- GRACE score
- GRACE in-hospital
- Granger 2003
- ACS in-hospital mortality
- Global Registry of Acute Coronary Events
- GRACE 1.0
- in-hospital GRACE
- Killip GRACE ACS

## Parameters

- `age` (integer, required): Age in years (18-120). Granger 2003 nomogram: <30 scores 0; 30-39 scores 8; 40-49 scores 25; 50-59 scores 41; 60-69 scores 58; 70-79 scores 75; 80-89 scores 91; ≥90 scores 100.
- `heart_rate_bpm` (integer, required): Heart rate in beats/min (20-300). Granger 2003 nomogram: <50 scores 0; 50-69 scores 3; 70-89 scores 9; 90-109 scores 15; 110-149 scores 24; 150-199 scores 38; ≥200 scores 46.
- `sbp_mm_hg` (integer, required): Systolic blood pressure in mm Hg (40-300). Granger 2003 nomogram, inverse: <80 scores 58; 80-99 scores 53; 100-119 scores 43; 120-139 scores 34; 140-159 scores 24; 160-199 scores 10; ≥200 scores 0.
- `creatinine_mg_dl` (number, optional): Initial serum creatinine in mg/dL (0.1-20). Provide this or creatinine_umol_l. If both are sent, creatinine_mg_dl is scored. Granger 2003 nomogram: 0.0-0.39 scores 1; 0.4-0.79 scores 4; 0.8-1.19 scores 7; 1.2-1.59 scores 10; 1.6-1.99 scores 13; 2.0-3.99 scores 21; ≥4.0 scores 28.
- `creatinine_umol_l` (number, optional): Initial serum creatinine in µmol/L (9-1768). Converted as mg/dL = µmol/L / 88.42. Alternate to creatinine_mg_dl. Ignored when creatinine_mg_dl is present.
- `killip_class` (integer, required): Killip class 1-4 as assigned by the caller (1 no heart failure scores 0; 2 rales or elevated venous pressure scores 20; 3 pulmonary edema scores 39; 4 cardiogenic shock scores 59). magent does not examine the patient.
- `cardiac_arrest` (boolean, required): Cardiac arrest at presentation as assigned by the caller (Granger 2003). true scores 39. magent does not read the chart. true or false.
- `st_deviation` (boolean, required): ST-segment deviation on the presenting ECG as assigned by the caller (Granger 2003). true scores 28. magent does not interpret the ECG. true or false.
- `elevated_enzymes` (boolean, required): Elevated initial cardiac enzymes as assigned by the caller (Granger 2003). true scores 14. magent does not read the laboratory. 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/grace`
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": "65",
      "cardiac_arrest": "false",
      "creatinine_mg_dl": "1.0",
      "elevated_enzymes": "false",
      "heart_rate_bpm": "80",
      "killip_class": "1",
      "sbp_mm_hg": "130",
      "st_deviation": "false"
    },
    {
      "age": "65",
      "cardiac_arrest": "false",
      "creatinine_mg_dl": "1.0",
      "elevated_enzymes": "false",
      "heart_rate_bpm": "80",
      "killip_class": "1",
      "sbp_mm_hg": "130",
      "st_deviation": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/grace",
  "items": [
    {
      "components": [
        {
          "value": 65,
          "factor": "age",
          "points": 58,
          "present": true
        },
        {
          "value": 80,
          "factor": "heart_rate_bpm",
          "points": 9,
          "present": true
        },
        {
          "value": 130,
          "factor": "sbp_mm_hg",
          "points": 34,
          "present": true
        },
        {
          "value": 1.0,
          "factor": "creatinine_mg_dl",
          "points": 7,
          "present": true
        },
        {
          "value": 1,
          "factor": "killip_class",
          "points": 0,
          "present": false
        },
        {
          "factor": "cardiac_arrest",
          "points": 0,
          "present": false
        },
        {
          "factor": "st_deviation",
          "points": 0,
          "present": false
        },
        {
          "factor": "elevated_enzymes",
          "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": "Granger CB, Goldberg RJ, Dabbous O, Pieper KS, Eagle KA, Cannon CP, Van De Werf F, Avezum A, Goodman SG, Flather MD, Fox KA; Global Registry of Acute Coronary Events Investigators",
        "doi": "10.1001/archinte.163.19.2345",
        "id": "granger-2003-grace",
        "pmid": "14581255",
        "source": "Arch Intern Med. 2003;163(19):2345-2353",
        "title": "Predictors of hospital mortality in the global registry of acute coronary events"
      },
      "formula": "grace",
      "formula_expression": "GRACE = age_points(<30:0, 30-39:8, 40-49:25, 50-59:41, 60-69:58, 70-79:75, 80-89:91, >=90:100) + heart_rate_points(<50:0, 50-69:3, 70-89:9, 90-109:15, 110-149:24, 150-199:38, >=200:46) + sbp_points(<80:58, 80-99:53, 100-119:43, 120-139:34, 140-159:24, 160-199:10, >=200:0) + creatinine_mg_dl_points(0-0.39:1, 0.4-0.79:4, 0.8-1.19:7, 1.2-1.59:10, 1.6-1.99:13, 2.0-3.99:21, >=4:28) + killip(1:0, 2:20, 3:39, 4:59) + 39 if cardiac_arrest + 28 if st_deviation + 14 if elevated_enzymes; Granger 2003 in-hospital GRACE 1.0 nomogram; max 372; in_hospital_mortality_percent is that paper's printed score readout (score<=60 → 0.2; then the labeled 70-240 percents at or below the total; score>=250 → 52); not ESC 108/140 cutoffs, not GRACE 2.0, not Fox 2006 6-month",
      "max_score": 372,
      "score": 108,
      "age_years": 65,
      "creatinine_mg_dl": 1.0,
      "heart_rate_bpm": 80,
      "sbp_mm_hg": 130,
      "cardiac_arrest": false,
      "elevated_enzymes": false,
      "in_hospital_mortality_percent": 0.8,
      "killip_class": 1,
      "st_deviation": false
    },
    {
      "components": [
        {
          "value": 65,
          "factor": "age",
          "points": 58,
          "present": true
        },
        {
          "value": 80,
          "factor": "heart_rate_bpm",
          "points": 9,
          "present": true
        },
        {
          "value": 130,
          "factor": "sbp_mm_hg",
          "points": 34,
          "present": true
        },
        {
          "value": 1.0,
          "factor": "creatinine_mg_dl",
          "points": 7,
          "present": true
        },
        {
          "value": 1,
          "factor": "killip_class",
          "points": 0,
          "present": false
        },
        {
          "factor": "cardiac_arrest",
          "points": 0,
          "present": false
        },
        {
          "factor": "st_deviation",
          "points": 0,
          "present": false
        },
        {
          "factor": "elevated_enzymes",
          "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": "Granger CB, Goldberg RJ, Dabbous O, Pieper KS, Eagle KA, Cannon CP, Van De Werf F, Avezum A, Goodman SG, Flather MD, Fox KA; Global Registry of Acute Coronary Events Investigators",
        "doi": "10.1001/archinte.163.19.2345",
        "id": "granger-2003-grace",
        "pmid": "14581255",
        "source": "Arch Intern Med. 2003;163(19):2345-2353",
        "title": "Predictors of hospital mortality in the global registry of acute coronary events"
      },
      "formula": "grace",
      "formula_expression": "GRACE = age_points(<30:0, 30-39:8, 40-49:25, 50-59:41, 60-69:58, 70-79:75, 80-89:91, >=90:100) + heart_rate_points(<50:0, 50-69:3, 70-89:9, 90-109:15, 110-149:24, 150-199:38, >=200:46) + sbp_points(<80:58, 80-99:53, 100-119:43, 120-139:34, 140-159:24, 160-199:10, >=200:0) + creatinine_mg_dl_points(0-0.39:1, 0.4-0.79:4, 0.8-1.19:7, 1.2-1.59:10, 1.6-1.99:13, 2.0-3.99:21, >=4:28) + killip(1:0, 2:20, 3:39, 4:59) + 39 if cardiac_arrest + 28 if st_deviation + 14 if elevated_enzymes; Granger 2003 in-hospital GRACE 1.0 nomogram; max 372; in_hospital_mortality_percent is that paper's printed score readout (score<=60 → 0.2; then the labeled 70-240 percents at or below the total; score>=250 → 52); not ESC 108/140 cutoffs, not GRACE 2.0, not Fox 2006 6-month",
      "max_score": 372,
      "score": 108,
      "age_years": 65,
      "creatinine_mg_dl": 1.0,
      "heart_rate_bpm": 80,
      "sbp_mm_hg": 130,
      "cardiac_arrest": false,
      "elevated_enzymes": false,
      "in_hospital_mortality_percent": 0.8,
      "killip_class": 1,
      "st_deviation": false
    }
  ]
}
```

## Response fields

- `formula` (string): grace
- `formula_expression` (string): Exact expression used
- `score` (integer): Total Granger 2003 nomogram points 1-372
- `max_score` (integer): 372 (100+46+58+28+59+39+28+14)
- `in_hospital_mortality_percent` (number): Granger 2003 printed in-hospital mortality percent for this total (≤60 → 0.2; labeled 70-240 ticks at or below the score; ≥250 → 52). Not an ESC 108/140 band and not an individual prognosis.
- `age_years` (integer): Age used
- `heart_rate_bpm` (integer): Heart rate used
- `sbp_mm_hg` (integer): Systolic BP used
- `creatinine_mg_dl` (number): Serum creatinine used in mg/dL (after µmol/L conversion when that unit is sent)
- `killip_class` (integer): Caller-assigned Killip class 1-4 used
- `cardiac_arrest` (boolean): Caller-assigned cardiac arrest at presentation used
- `st_deviation` (boolean): Caller-assigned ST-segment deviation used
- `elevated_enzymes` (boolean): Caller-assigned elevated initial enzymes used
- `components` (array): Per-predictor nomogram points
- `citation` (object): Granger 2003 Arch Intern Med citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": 65,
      "factor": "age",
      "points": 58,
      "present": true
    },
    {
      "value": 80,
      "factor": "heart_rate_bpm",
      "points": 9,
      "present": true
    },
    {
      "value": 130,
      "factor": "sbp_mm_hg",
      "points": 34,
      "present": true
    },
    {
      "value": 1.0,
      "factor": "creatinine_mg_dl",
      "points": 7,
      "present": true
    },
    {
      "value": 1,
      "factor": "killip_class",
      "points": 0,
      "present": false
    },
    {
      "factor": "cardiac_arrest",
      "points": 0,
      "present": false
    },
    {
      "factor": "st_deviation",
      "points": 0,
      "present": false
    },
    {
      "factor": "elevated_enzymes",
      "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": "Granger CB, Goldberg RJ, Dabbous O, Pieper KS, Eagle KA, Cannon CP, Van De Werf F, Avezum A, Goodman SG, Flather MD, Fox KA; Global Registry of Acute Coronary Events Investigators",
    "doi": "10.1001/archinte.163.19.2345",
    "id": "granger-2003-grace",
    "pmid": "14581255",
    "source": "Arch Intern Med. 2003;163(19):2345-2353",
    "title": "Predictors of hospital mortality in the global registry of acute coronary events"
  },
  "formula": "grace",
  "formula_expression": "GRACE = age_points(<30:0, 30-39:8, 40-49:25, 50-59:41, 60-69:58, 70-79:75, 80-89:91, >=90:100) + heart_rate_points(<50:0, 50-69:3, 70-89:9, 90-109:15, 110-149:24, 150-199:38, >=200:46) + sbp_points(<80:58, 80-99:53, 100-119:43, 120-139:34, 140-159:24, 160-199:10, >=200:0) + creatinine_mg_dl_points(0-0.39:1, 0.4-0.79:4, 0.8-1.19:7, 1.2-1.59:10, 1.6-1.99:13, 2.0-3.99:21, >=4:28) + killip(1:0, 2:20, 3:39, 4:59) + 39 if cardiac_arrest + 28 if st_deviation + 14 if elevated_enzymes; Granger 2003 in-hospital GRACE 1.0 nomogram; max 372; in_hospital_mortality_percent is that paper's printed score readout (score<=60 → 0.2; then the labeled 70-240 percents at or below the total; score>=250 → 52); not ESC 108/140 cutoffs, not GRACE 2.0, not Fox 2006 6-month",
  "max_score": 372,
  "score": 108,
  "age_years": 65,
  "creatinine_mg_dl": 1.0,
  "heart_rate_bpm": 80,
  "sbp_mm_hg": 130,
  "cardiac_arrest": false,
  "elevated_enzymes": false,
  "in_hospital_mortality_percent": 0.8,
  "killip_class": 1,
  "st_deviation": false
}
```

## Errors

- HTTP 400 `invalid_grace`: GRACE in-hospital inputs must match Granger 2003 age, heart rate, SBP, creatinine, Killip class, cardiac arrest, ST deviation, and enzyme flags. 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

- [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.
- [HEART score](https://magentlab.com/docs/heart) — Compute the HEART score as age points plus caller-assigned history, ECG, risk factors, and troponin (each 0-2).
- [Killip](https://magentlab.com/docs/killip) — Return the Killip and Kimball 1967 myocardial-infarction heart-failure class 1-4 from a caller-assigned integer, with the published class description and 1967 CCU hospital mortality.
- [ORBI](https://magentlab.com/docs/orbi) — Sum the Auffret 2018 ORBI predictors after STEMI primary PCI and return the integer score (0-36), class I-IV, and derivation-cohort in-hospital cardiogenic-shock percent.

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