# EHMRG 7-Day ED Mortality Risk Calculator (Lee 2012)

> EHMRG 7-Day ED Mortality Risk Calculator (Lee 2012) is a paid API for AI agents from api.magentlab.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-10-12).

Computes the Emergency Heart Failure Mortality Risk Grade (EHMRG) score and risk group (1–5b) for acute heart failure patients presenting to the ED, based on the Lee 2012 Table 3 integer scoring model.

## Facts

- Endpoint: GET https://api.magentlab.com/api/calc/ehmrg?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-12
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/ehmrg-7-day-ed-mortality-risk-calculator-lee-2012-c27a0c70
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_a7JUfORZIfIjh0GV2lvKM

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability ehmrg-7-day-ed-mortality-risk-calculator-lee-2012-c27a0c70
```

Example prompt: Calculate the EHMRG 7-day ED mortality score for a 72-year-old heart failure patient who arrived by EMS, has a systolic BP of 110 mm Hg, heart rate of 105 bpm, SpO2 of 89%, creatinine of 2.1 mg/dL, potassium of 4.3 mmol/L, troponin above the upper limit of normal, no active cancer, and no home metolazone — what is their EHMRG score and risk group?

## When to prefer this

Use this endpoint when you need a deterministic, published-formula implementation of the Lee 2012 EHMRG 7-day ED mortality model for acute heart failure patients. Prefer it over general clinical NLP or LLM-based risk estimators when auditability and exact formula reproducibility matter. It is specifically the Table 3 integer score model — not EHMRG30-ST, not ADHERE CART, and not an admission or discharge decision tool. Choose it for clinical decision support pipelines, autonomous agents processing ED heart failure presentations, or research cohort scoring where dialysis-dependent patients are excluded.

## Known failure modes

- Missing required query parameters (age, ems_transport, systolic_mm_hg, heart_rate_bpm, spo2_percent, creatinine_mg_dl, potassium_mmol_l, troponin_gt_uln, active_cancer, metolazone, dialysis_dependent) returns a validation error
- dialysis_dependent=true causes the endpoint to exclude the patient (dialysis-dependent patients are out of scope for EHMRG)
- Out-of-range numeric values (e.g. age <18 or >120, HR <30 or >220) may be rejected or produce unexpected scores
- Payment failure via x402 protocol results in 402 response before calculation is performed
- Boolean fields passed as strings rather than true/false may cause parsing errors

## How this service works

Deterministic published-formula arithmetic plus ICD-10-CM, RxNorm, and LOINC. Pay in USDC on Base via x402.

## Output

Returns a JSON object containing the computed EHMRG integer score, the corresponding risk group (1, 2, 3, 4, 5a, or 5b), the full formula expression used, echoed input parameters, the Lee 2012 citation (DOI, PMID, journal), and a disclaimer that the output is not a medical device and a licensed clinician retains responsibility for patient care.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "headers": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "queryParams": {
     "type": "object",
     "required": [
      "age",
      "ems_transport",
      "systolic_mm_hg",
      "heart_rate_bpm",
      "spo2_percent",
      "potassium_mmol_l",
      "troponin_gt_uln",
      "active_cancer",
      "metolazone",
      "dialysis_dependent"
     ],
     "properties": {
      "age": {
       "type": "integer",
       "description": "Age in years (integer 18-120). Lee 2012 Table 3 adds +2 per year. magent does not assign age."
      },
      "metolazone": {
       "type": "boolean",
       "description": "Metolazone at home as assigned by the caller (true or false). Lee 2012 Table 3: +60 if true."
      },
      "spo2_percent": {
       "type": "number",
       "description": "Lowest initial/triage oxygen saturation percent (50-100). Lee 2012 Table 3 scores -2 * min(SpO2, 92); values above 92% are capped. magent does not measure saturation."
      },
      "active_cancer": {
       "type": "boolean",
       "description": "Active cancer as assigned by the caller (true or false). Lee 2012 Table 3: +45 if true."
      },
      "ems_transport": {
       "type": "boolean",
       "description": "Transported by EMS as assigned by the caller (true or false). Lee 2012 Table 3: +60 if true."
      },
      "heart_rate_bpm": {
       "type": "integer",
       "description": "Heart rate in beats/min (integer 30-220). Lee 2012 Table 3 scores +1 * clamp(HR, 80, 120): floor 80, ceiling 120. magent does not measure heart rate."
      },
      "systolic_mm_hg": {
       "type": "integer",
       "description": "Initial/triage systolic blood pressure in mm Hg (integer 50-250). Lee 2012 Table 3 scores -1 * min(SBP, 160); values above 160 mm Hg are capped. magent does not measure blood pressure."
      },
      "troponin_gt_uln": {
       "type": "boolean",
       "description": "Troponin above the local upper limit of normal as assigned by the caller (true or false). Lee 2012 Table 3: +60 if true."
      },
      "creatinine_
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "path": "/api/calc/ehmrg",
  "count": 2,
  "items": [
   {
    "formula": "ehmrg",
    "citation": {
     "id": "lee-2012",
     "doi": "10.7326/0003-4819-156-11-201206050-00003",
     "pmid": "22665814",
     "title": "Prediction of heart failure mortality in emergent care: a cohort study",
     "source": "Ann Intern Med. 2012;156(11):767-775",
     "authors": "Lee DS, Stitt A, Austin PC, Stukel TA, Schull MJ, Chong A, Newton GE, Lee JS, Tu JV"
    },
    "age_years": 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.",
    "metolazone": false,
    "risk_group": "1",
    "ehmrg_score": -92,
    "spo2_percent": 92,
    "active_cancer": false,
    "ems_transport": false,
    "heart_rate_bpm": 80,
    "systolic_mm_hg": 160,
    "troponin_gt_uln": false,
    "creatinine_mg_dl": 1,
    "potassium_mmol_l": 4.2,
    "dialysis_dependent": false,
    "formula_expression": "ehmrg_score = 2*age_years + 60*(ems_transport) - min(systolic_mm_hg, 160) + clamp(heart_rate_bpm, 80, 120) - 2*min(spo2_percent, 92) + 20*creatinine_mg_dl + K(<=3.9:5, 4.0-4.5:0, >=4.6:30) + 60*(troponin_gt_uln) + 45*(active_cancer) + 60*(metolazone) + 12; Lee 2012 Table 3 7-day ED model; dialysis-dependent excluded; risk_group 1 (score <= -49.1), 2 (-49.0 to -15.9), 3 (-15.8 to 17.9), 4 (18.0 to 56.5), 5a (56.6 to 89.3), 5b (>= 89.4)"
   },
   {
    "formula": "ehmrg",
    "citation": {
     "id": "lee-2012",
     "doi": "10.7326/0003-4819-156-11-201206050-00003",
     "pmid": "22665814",
     "title": "Prediction of heart failure mortality in emergent care: a cohort study",
     "source": "Ann Intern Med. 2012;156(11):767-775",
     "authors": "Lee DS, Stitt A, Austin PC, Stukel TA, Schull MJ, Chong A, Newton GE, Lee JS, Tu JV"
    },
    "age_years": 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.",
    "metolazone": false,
    "risk_group": "1",
    "ehmrg_score": -92,
    "spo2_percent": 92,
    "active_cancer": false,
    "ems_transport": false,
    "heart_rate_bpm": 80,
    "systolic_mm_hg": 160,
    "troponin_gt_uln": false,
    "creatinine_mg_dl": 1,
    "potassium_mmol_l": 4.2,
    "dialysis_dependent": false,
    "formula_expression": "ehm
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/ehmrg-7-day-ed-mortality-risk-calculator-lee-2012-c27a0c70/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.magentlab.com](https://www.zero.xyz/host/api.magentlab.com/llms.txt)
