78trust / 100

Calc Ehmrg

by magent in AI models & inference

x402 APIPassing, checked 3 h ago

Lee 2012 EHMRG 7-day ED model (Table 3 integer score): 2*age + 60 if EMS transport - min(SBP,160) + clamp(HR,80-120) - 2*min(SpO2,92) + 20*creatinine_mg_dl + K (<=3.9: +5; 4.0-4.5: 0; >=4.6: +30) + 60 if troponin>ULN + 45 if active cancer + 60 if home metolazone + 12. Groups 1/2/3/4/5a/5b. Dialysis-dependent excluded. Not EHMRG30-ST, not ADHERE CART, not a discharge or admission order.

POST https://api.magentlab.com/api/calc/ehmrg

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
166 ms typical, 361 ms slowest 5%
Last check
3 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://api.magentlab.com/api/calc/ehmrg" \
  -H "content-type: application/json" \
  -d '{"items":[{"active_cancer":false,"age":70,"creatinine_mg_dl":1,"creatinine_umol_l":88.4,"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,"creatinine_umol_l":88.4,"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}]}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fapi.magentlab.com%2Fapi%2Fcalc%2Fehmrg
const res = await pay("https://api.magentlab.com/api/calc/ehmrg", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"items":[{"active_cancer":false,"age":70,"creatinine_mg_dl":1,"creatinine_umol_l":88.4,"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,"creatinine_umol_l":88.4,"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}]}),
});
console.log(await res.json());

Example input

{
  "items": [
    {
      "active_cancer": false,
      "age": 70,
      "creatinine_mg_dl": 1,
      "creatinine_umol_l": 88.4,
      "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,
      "creatinine_umol_l": 88.4,
      "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
    }
  ]
}

Example output

{
  "count": 2,
  "items": [
    {
      "active_cancer": false,
      "age_years": 70,
      "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"
      },
      "creatinine_mg_dl": 1,
      "dialysis_dependent": 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.",
      "ehmrg_score": -92,
      "ems_transport": false,
      "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)",
      "heart_rate_bpm": 80,
      "metolazone": false,
      "potassium_mmol_l": 4.2,
      "risk_group": "1",
      "spo2_percent": 92,
      "systolic_mm_hg": 160,
      "troponin_gt_uln": false
    },
    {
      "active_cancer": false,
      "age_years": 70,
      "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"
      },
      "creatinine_mg_dl": 1,
      "dialysis_dependent": 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.",
      "ehmrg_score": -92,
      "ems_transport": false,
      "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)",
      "heart_rate_bpm": 80,
      "metolazone": false,
      "potassium_mmol_l": 4.2,
      "risk_group": "1",
      "spo2_percent": 92,
      "systolic_mm_hg": 160,
      "troponin_gt_uln": false
    }
  ],
 

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
3 h agoPassed402345 ms$0.005
6 h agoPassed402359 ms$0.005
10 h agoPassed402361 ms$0.005
13 h agoPassed402333 ms$0.005
23 h agoPassed402142 ms$0.005
26 h agoPassed402146 ms$0.005
30 h agoPassed402504 ms$0.005
33 h agoPassed402150 ms$0.005
37 h agoPassed402225 ms$0.005
41 h agoPassed402166 ms$0.005
44 h agoPassed402137 ms$0.005
2 days agoPassed402138 ms$0.005