MAGENT

Emergency · LIVE

EHMRG 7-day ED mortality score

EHMRG

Compute the Lee 2012 Emergency Heart Failure Mortality Risk Grade 7-day emergency-department integer score from age, EMS transport, initial systolic BP, heart rate, oxygen saturation, creatinine, potassium, troponin above ULN, active cancer, and home metolazone.

LIVE $0.005 USDC GET /api/calc/ehmrg

Markdown: /docs/ehmrg.md · Canonical: https://magentlab.com/docs/ehmrg

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

What it computes

Compute the Lee 2012 Emergency Heart Failure Mortality Risk Grade 7-day emergency-department integer score from age, EMS transport, initial systolic BP, heart rate, oxygen saturation, creatinine, potassium, troponin above ULN, active cancer, and home metolazone.

When to use

When an agent has caller-supplied ED presentation values and needs the published Lee 2012 Table 3 7-day ED model total and derivation risk_group 1/2/3/4/5a/5b, not EHMRG30-ST, not ADHERE CART, and not a discharge or admission order.

When not to use

  • Not a medical device. magent does not examine the patient and does not measure vitals or laboratories.
  • Not a discharge or admission order. This is the Lee 2012 7-day ED integer score only.
  • This is not EHMRG30-ST and not ADHERE CART.
  • Dialysis-dependent patients are excluded (Lee 2012 Methods and Table 3 footnote). dialysis_dependent must be false to score.
  • Unpublished potassium gaps 3.91-3.99 mmol/L pin with the <=3.9 band (+5). Gaps 4.51-4.59 mmol/L pin with the >=4.6 band (+30). magent does not invent extra named potassium classes.
  • The caller assigns EMS transport, troponin above ULN, active cancer, home metolazone, and dialysis status. magent does not interpret assays or medication lists.

Formula

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)

Citation

Title
Prediction of heart failure mortality in emergent care: a cohort study
Authors
Lee DS, Stitt A, Austin PC, Stukel TA, Schull MJ, Chong A, Newton GE, Lee JS, Tu JV
Source
Ann Intern Med. 2012;156(11):767-775
DOI
10.7326/0003-4819-156-11-201206050-00003

Worked example

Age 70, no EMS, SBP 160, HR 80, SpO2 92, creatinine 1.0 (group 1)

Given: active_cancer=falseage=70creatinine_mg_dl=1.0dialysis_dependent=falseems_transport=falseheart_rate_bpm=80metolazone=falsepotassium_mmol_l=4.2spo2_percent=92systolic_mm_hg=160troponin_gt_uln=false

  1. Age 70 → +140; EMS false → 0; SBP 160 (at cap) → -160; HR 80 (at floor) → +80
  2. SpO2 92 (at cap) → -184; creatinine 1.0 → +20; potassium 4.2 → 0
  3. Troponin, cancer, and metolazone false → 0; adjustment +12
  4. ehmrg_score = 140 - 160 + 80 - 184 + 20 + 12 = -92; risk_group 1

Age 85, EMS, SBP 120, HR 110, SpO2 90, creatinine 1.8, troponin above ULN (group 5b)

Given: active_cancer=falseage=85creatinine_mg_dl=1.8dialysis_dependent=falseems_transport=trueheart_rate_bpm=110metolazone=falsepotassium_mmol_l=4.2spo2_percent=90systolic_mm_hg=120troponin_gt_uln=true

  1. Age 85 → +170; EMS true → +60; SBP 120 → -120; HR 110 → +110; SpO2 90 → -180
  2. Creatinine 1.8 → +36; potassium 4.2 → 0; troponin above ULN → +60; adjustment +12
  3. ehmrg_score = 170 + 60 - 120 + 110 - 180 + 36 + 60 + 12 = 148; risk_group 5b

Also searched as

  • EHMRG
  • Emergency Heart Failure Mortality Risk Grade
  • Lee 2012 EHMRG
  • 7-day ED heart failure mortality
  • EHMRG integer score
  • heart failure emergency department score

Try

Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.

/api/calc/ehmrg?age=70&ems_transport=false&systolic_mm_hg=160&heart_rate_bpm=80&spo2_percent=92&creatinine_mg_dl=1.0&potassium_mmol_l=4.2&troponin_gt_uln=false&active_cancer=false&metolazone=false&dialysis_dependent=false

Full URL: https://api.magentlab.com/api/calc/ehmrg?age=70&ems_transport=false&systolic_mm_hg=160&heart_rate_bpm=80&spo2_percent=92&creatinine_mg_dl=1.0&potassium_mmol_l=4.2&troponin_gt_uln=false&active_cancer=false&metolazone=false&dialysis_dependent=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/ehmrg?age=70&ems_transport=false&systolic_mm_hg=160&heart_rate_bpm=80&spo2_percent=92&creatinine_mg_dl=1.0&potassium_mmol_l=4.2&troponin_gt_uln=false&active_cancer=false&metolazone=false&dialysis_dependent=false"

Parameters

Name Type Required Description
age integer required Age in years (integer 18-120). Lee 2012 Table 3 adds +2 per year. magent does not assign age.
ems_transport boolean required Transported by EMS as assigned by the caller (true or false). Lee 2012 Table 3: +60 if true.
systolic_mm_hg integer required 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.
heart_rate_bpm integer required 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.
spo2_percent number required 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.
creatinine_mg_dl number optional Serum creatinine in mg/dL (0.1-20). Provide this or creatinine_umol_l, not both. Lee 2012 Table 3 adds +20 per mg/dL. magent does not measure creatinine.
creatinine_umol_l number optional Serum creatinine in µmol/L (9-1768). Converted as mg/dL = µmol/L / 88.42. Provide this or creatinine_mg_dl, not both.
potassium_mmol_l number required Serum potassium in mmol/L (1.5-8.0). Lee 2012 Table 3: 4.0-4.5 inclusive → 0; >=4.6 → +30; <=3.9 → +5. Unpublished 3.91-3.99 pin with <=3.9; 4.51-4.59 pin with >=4.6. magent does not measure potassium.
troponin_gt_uln boolean required Troponin above the local upper limit of normal as assigned by the caller (true or false). Lee 2012 Table 3: +60 if true.
active_cancer boolean required Active cancer as assigned by the caller (true or false). Lee 2012 Table 3: +45 if true.
metolazone boolean required Metolazone at home as assigned by the caller (true or false). Lee 2012 Table 3: +60 if true.
dialysis_dependent boolean required Dialysis dependence as assigned by the caller (true or false). Lee 2012 excludes dialysis-dependent patients; true returns HTTP 400. magent does not determine dialysis status.

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.

POST /api/calc/ehmrg Max 25 unit_amount + extra_item_amount * (n - 1) extra $0.002 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 (fixture)

{
  "items": [
    {
      "active_cancer": "false",
      "age": "70",
      "creatinine_mg_dl": "1.0",
      "dialysis_dependent": "false",
      "ems_transport": "false",
      "heart_rate_bpm": "80",
      "metolazone": "false",
      "potassium_mmol_l": "4.2",
      "spo2_percent": "92",
      "systolic_mm_hg": "160",
      "troponin_gt_uln": "false"
    },
    {
      "active_cancer": "false",
      "age": "70",
      "creatinine_mg_dl": "1.0",
      "dialysis_dependent": "false",
      "ems_transport": "false",
      "heart_rate_bpm": "80",
      "metolazone": "false",
      "potassium_mmol_l": "4.2",
      "spo2_percent": "92",
      "systolic_mm_hg": "160",
      "troponin_gt_uln": "false"
    }
  ]
}

Open bulk paywall →

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/ehmrg",
  "items": [
    {
      "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": "Lee DS, Stitt A, Austin PC, Stukel TA, Schull MJ, Chong A, Newton GE, Lee JS, Tu JV",
        "doi": "10.7326/0003-4819-156-11-201206050-00003",
        "id": "lee-2012",
        "pmid": "22665814",
        "source": "Ann Intern Med. 2012;156(11):767-775",
        "title": "Prediction of heart failure mortality in emergent care: a cohort study"
      },
      "formula": "ehmrg",
      "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)",
      "systolic_mm_hg": 160,
      "age_years": 70,
      "creatinine_mg_dl": 1.0,
      "potassium_mmol_l": 4.2,
      "heart_rate_bpm": 80,
      "active_cancer": false,
      "dialysis_dependent": false,
      "ehmrg_score": -92.0,
      "ems_transport": false,
      "metolazone": false,
      "risk_group": "1",
      "spo2_percent": 92.0,
      "troponin_gt_uln": 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": "Lee DS, Stitt A, Austin PC, Stukel TA, Schull MJ, Chong A, Newton GE, Lee JS, Tu JV",
        "doi": "10.7326/0003-4819-156-11-201206050-00003",
        "id": "lee-2012",
        "pmid": "22665814",
        "source": "Ann Intern Med. 2012;156(11):767-775",
        "title": "Prediction of heart failure mortality in emergent care: a cohort study"
      },
      "formula": "ehmrg",
      "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)",
      "systolic_mm_hg": 160,
      "age_years": 70,
      "creatinine_mg_dl": 1.0,
      "potassium_mmol_l": 4.2,
      "heart_rate_bpm": 80,
      "active_cancer": false,
      "dialysis_dependent": false,
      "ehmrg_score": -92.0,
      "ems_transport": false,
      "metolazone": false,
      "risk_group": "1",
      "spo2_percent": 92.0,
      "troponin_gt_uln": false
    }
  ]
}

Response

Field Type Description
formula string ehmrg
formula_expression string Exact expression used
ehmrg_score number Lee 2012 Table 3 7-day ED integer-score sum. Exact arithmetic; may be a float when creatinine is a float.
risk_group string Lee 2012 derivation cutpoints: 1 if score <= -49.1; 2 if -49.0 to -15.9; 3 if -15.8 to 17.9; 4 if 18.0 to 56.5; 5a if 56.6 to 89.3; 5b if >= 89.4
age_years integer Age used, years
ems_transport boolean EMS transport flag used
systolic_mm_hg integer Initial/triage systolic BP used, mm Hg (capped at 160 for scoring)
heart_rate_bpm integer Heart rate used, bpm (scored after clamp 80-120)
spo2_percent number Oxygen saturation used, percent (capped at 92 for scoring)
creatinine_mg_dl number Serum creatinine used in mg/dL (after µmol/L conversion when supplied)
potassium_mmol_l number Serum potassium used, mmol/L
troponin_gt_uln boolean Troponin above ULN flag used
active_cancer boolean Active cancer flag used
metolazone boolean Home metolazone flag used
dialysis_dependent boolean Always false on HTTP 200; true is excluded
citation object Lee 2012 Annals citation
disclaimer string Not-a-device notice

Example JSON

Machine form of the same example. Frozen fixture. Not a live lookup.

{
  "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": "Lee DS, Stitt A, Austin PC, Stukel TA, Schull MJ, Chong A, Newton GE, Lee JS, Tu JV",
    "doi": "10.7326/0003-4819-156-11-201206050-00003",
    "id": "lee-2012",
    "pmid": "22665814",
    "source": "Ann Intern Med. 2012;156(11):767-775",
    "title": "Prediction of heart failure mortality in emergent care: a cohort study"
  },
  "formula": "ehmrg",
  "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)",
  "systolic_mm_hg": 160,
  "age_years": 70,
  "creatinine_mg_dl": 1.0,
  "potassium_mmol_l": 4.2,
  "heart_rate_bpm": 80,
  "active_cancer": false,
  "dialysis_dependent": false,
  "ehmrg_score": -92.0,
  "ems_transport": false,
  "metolazone": false,
  "risk_group": "1",
  "spo2_percent": 92.0,
  "troponin_gt_uln": false
}

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_flag boolean clinical flags must be true or false Returned before settlement; you are not charged.
400 invalid_systolic_bp systolic_mm_hg or systolic_bp_mm_hg must be a number from 50 to 250. 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_creatinine creatinine_mg_dl (0.1-20) or creatinine_umol_l (9-1768) is required Returned before settlement; you are not charged.
400 invalid_potassium potassium_mmol_l must be a number from 1.5 to 8.0. Returned before settlement; you are not charged.
400 invalid_ehmrg_dialysis EHMRG is not for dialysis-dependent patients (Lee 2012). dialysis_dependent must be false to score. 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

  • LACE — Sum van Walraven 2010 Table 3 LACE points from length of stay, acute (emergent) admission, a caller-supplied Charlson integer, and ED visits in the previous 6 months.
  • 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.

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