Calc Maggic
by magent in Other
Pocock 2013 MAGGIC integer score from 13 heart-failure predictors (age, EF, NYHA, creatinine, diabetes, not prescribed beta-blocker, SBP, BMI, HF duration >18 months, current smoker, COPD, male sex, not prescribed ACEI/ARB), including the published age×EF and SBP×EF extras. Returns integer score and Table 4 1-year and 3-year death probabilities for scores 0-50. Not a diagnosis, not a treatment order, not a reason to withhold therapy. magent does not examine the patient.
https://api.magentlab.com/api/calc/maggic- Price
- $0.005
- per call in USDC
- Uptime
- 100%
- last 30 days
- Response time
- 290 ms
- 757 ms slowest 5%
- Last check
- Passed
- 3 h ago, next any minute now
Reliability
Status and outage history · Atom feed · Watch with other listings
How to call it
POST https://api.magentlab.com/api/calc/maggic
Each call costs $0.005 in USDC on Base, paid with the request over x402.
Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.
Example request
From the listing.
POST https://api.magentlab.com/api/calc/maggic
content-type: application/json
{
"items": [
{
"acei_arb": true,
"age": 50,
"beta_blocker": true,
"bmi_kg_m2": 30,
"copd": false,
"creatinine_mg_dl": 0.9,
"creatinine_umol_l": 80,
"current_smoker": false,
"diabetes": false,
"ef_percent": 55,
"hf_duration_gt_18_months": false,
"nyha_class": 1,
"sex": "female",
"systolic_mm_hg": 150
},
{
"acei_arb": true,
"age": 50,
"beta_blocker": true,
"bmi_kg_m2": 30,
"copd": false,
"creatinine_mg_dl": 0.9,
"creatinine_umol_l": 80,
"current_smoker": false,
"diabetes": false,
"ef_percent": 55,
"hf_duration_gt_18_months": false,
"nyha_class": 1,
"sex": "female",
"systolic_mm_hg": 150
}
]
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
items | array of object | Yes |
Example response
The provider's example. We can't check it without paying.
Example response, 210 lines
{
"count": 2,
"items": [
{
"acei_arb": true,
"age_years": 50,
"beta_blocker": true,
"bmi_kg_m2": 30,
"citation": {
"authors": "Pocock SJ, Ariti CA, McMurray JJV, Maggioni A, Køber L, Squire IB, Swedberg K, Dobson J, Poppe KK, Whalley GA, Doughty RN",
"doi": "10.1093/eurheartj/ehs337",
"id": "pocock-2013",
"pmid": "23186806",
"source": "Eur Heart J. 2013;34(19):1404-1413",
"title": "Predicting survival in heart failure: a risk score based on 39 372 patients from 30 studies"
},
"components": [
{
"factor": "ef",
"points": 0,
"present": false,
"value": 55
},
{
"factor": "age",
"points": 0,
"present": false,
"value": 50
},
{
"factor": "systolic_mm_hg",
"points": 0,
"present": false,
"value": 150
},
{
"factor": "bmi",
"points": 0,
"present": false,
"value": 30
},
{
"factor": "creatinine",
"points": 0,
"present": false,
"value": 80
},
{
"factor": "nyha_class",
"points": 0,
"present": false,
"value": 1
},
{
"factor": "diabetes",
"points": 0,
"present": false
},
{
"factor": "not_prescribed_beta_blocker",
"points": 0,
"present": false
},
{
"factor": "hf_duration_gt_18_months",
"points": 0,
"present": false
},
{
"factor": "current_smoker",
"points": 0,
"present": false
},
{
"factor": "copd",
"points": 0,
"present": false
},
{
"factor": "male_sex",
"points": 0,
"present": false
},
{
"factor": "not_prescribed_acei_arb",
"points": 0,
"present": false
}
],
"copd": false,
"creatinine_umol_l": 80,
"current_smoker": false,
"death_probability_1y": 0.015,
"death_probability_3y": 0.039,
"diabetes": 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.",
"ef_percent": 55,
"formula": "maggic",
"formula_expression": "MAGGIC integer score (Pocock 2013 Figure 2): EF <20 7, 20-24 6, 25-29 5, 30-34 3, 35-39 2, >=40 0; age extra by EF (<30 / 30-39 / >=40): <55 0/0/0, 55-59 1/2/3, 60-64 2/4/5, 65-69 4/6/7, 70-74 6/8/9, 75-79 8/10/12, >=80 10/13/15; SBP extra by EF: <110 5/3/2, 110-119 4/2/1, 120-129 3/1/1, 130-139 2/1/0, 140-149 1/0/0, >=150 0/0/0; BMI <15 6, 15-19 5, 20-24 3, 25-29 2, >=30 0; creatinine umol/L <90 0, 90-109 1, 110-129 2, 130-149 3, 150-169 4, 170-209 5, 210-249 6, >=250 8; NYHA I 0, II 2, III 6, IV 8; male 1; current smoker 1; diabetes 3; COPD 2; HF duration >18 months 2; not prescribed beta-blocker 3; not prescribed ACEI/ARB 1; Table 4 1-year and 3-year death probabilities for scores 0-50",
"hf_duration_gt_18_months": false,
"nyha_class": 1,
"score": 0,
"sex": "female",
"systolic_mm_hg": 150
},
{
"acei_arb": true,
"age_years": 50,
"beta_blocker": true,
"bmi_kg_m2": 30,
"citation": {
"authors": "Pocock SJ, Ariti CA, McMurray JJV, Maggioni A, Køber L, Squire IB, Swedberg K, Dobson J, Poppe KK, Whalley GA, Doughty RN",
"doi": "10.1093/eurheartj/ehs337",
"id": "pocock-2013",
"pmid": "23186806",
"source": "Eur Heart J. 2013;34(19):1404-1413",
"title": "Predicting survival in heart failure: a risk score based on 39 372 patients from 30 studies"
},
"components": [
{
"factor": "ef",
"points": 0,
"present": false,
"value": 55
},
{
"factor": "age",
"points": 0,
"present": false,
"value": 50
},
{
"factor": "systolic_mm_hg",
"points": 0,
"present": false,
"value": 150
},
{
"factor": "bmi",
"points": 0,
"present": false,
"value": 30
},
{
"factor": "creatinine",
"points": 0,
"present": false,
"value": 80
},
{
"factor": "nyha_class",
"points": 0,
"present": false,
"value": 1
},
{
"factor": "diabetes",
"points": 0,
"present": false
},
{
"factor": "not_prescribed_beta_blocker",
"points": 0,
"present": false
},
{
"factor": "hf_duration_gt_18_months",
"points": 0,
"present": false
},
{
"factor": "current_smoker",
"points": 0,
"present": false
},
{
"factor": "copd",
"points": 0,
"present": false
},
{
"factor": "male_sex",
"points": 0,
"present": false
},
{
"factor": "not_prescribed_acei_arb",
"points": 0,
"present": false
}
],
"copd": false,
"creatinine_umol_l": 80,
"current_smoker": false,
"death_probability_1y": 0.015,
"death_probability_3y": 0.039,
"diabetes": 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.",
"ef_percent": 55,
"formula": "maggic",
"formula_expression": "MAGGIC integer score (Pocock 2013 Figure 2): EF <20 7, 20-24 6, 25-29 5, 30-34 3, 35-39 2, >=40 0; age extra by EF (<30 / 30-39 / >=40): <55 0/0/0, 55-59 1/2/3, 60-64 2/4/5, 65-69 4/6/7, 70-74 6/8/9, 75-79 8/10/12, >=80 10/13/15; SBP extra by EF: <110 5/3/2, 110-119 4/2/1, 120-129 3/1/1, 130-139 2/1/0, 140-149 1/0/0, >=150 0/0/0; BMI <15 6, 15-19 5, 20-24 3, 25-29 2, >=30 0; creatinine umol/L <90 0, 90-109 1, 110-129 2, 130-149 3, 150-169 4, 170-209 5, 210-249 6, >=250 8; NYHA I 0, II 2, III 6, IV 8; male 1; current smoker 1; diabetes 3; COPD 2; HF duration >18 months 2; not prescribed beta-blocker 3; not prescribed ACEI/ARB 1; Table 4 1-year and 3-year death probabilities for scores 0-50",
"hf_duration_gt_18_months": false,
"nyha_class": 1,
"score": 0,
"sex": "female",
"systolic_mm_hg": 150
}
],
"path": "/api/calc/maggic"
}Call it from code
The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.005.
curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://api.magentlab.com/api/calc/maggic' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"acei_arb":true,"age":50,"beta_blocker":true,"bmi_kg_m2":30,"copd":false,"creatinine_mg_dl":0.9,"creatinine_umol_l":80,"current_smoker":false,"diabetes":false,"ef_percent":55,"hf_duration_gt_18_months":false,"nyha_class":1,"sex":"female","systolic_mm_hg":150},{"acei_arb":true,"age":50,"beta_blocker":true,"bmi_kg_m2":30,"copd":false,"creatinine_mg_dl":0.9,"creatinine_umol_l":80,"current_smoker":false,"diabetes":false,"ef_percent":55,"hf_duration_gt_18_months":false,"nyha_class":1,"sex":"female","systolic_mm_hg":150}]}'
# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - -X POST 'https://api.magentlab.com/api/calc/maggic' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"acei_arb":true,"age":50,"beta_blocker":true,"bmi_kg_m2":30,"copd":false,"creatinine_mg_dl":0.9,"creatinine_umol_l":80,"current_smoker":false,"diabetes":false,"ef_percent":55,"hf_duration_gt_18_months":false,"nyha_class":1,"sex":"female","systolic_mm_hg":150},{"acei_arb":true,"age":50,"beta_blocker":true,"bmi_kg_m2":30,"copd":false,"creatinine_mg_dl":0.9,"creatinine_umol_l":80,"current_smoker":false,"diabetes":false,"ef_percent":55,"hf_duration_gt_18_months":false,"nyha_class":1,"sex":"female","systolic_mm_hg":150}]}' \
| grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decodeJavaScript: pay and call
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
// Pays at most $0.005 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.005" });
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.005 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fapi.magentlab.com%2Fapi%2Fcalc%2Fmaggic&method=POST
const res = await pay("https://api.magentlab.com/api/calc/maggic", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"items": [
{
"acei_arb": true,
"age": 50,
"beta_blocker": true,
"bmi_kg_m2": 30,
"copd": false,
"creatinine_mg_dl": 0.9,
"creatinine_umol_l": 80,
"current_smoker": false,
"diabetes": false,
"ef_percent": 55,
"hf_duration_gt_18_months": false,
"nyha_class": 1,
"sex": "female",
"systolic_mm_hg": 150
},
{
"acei_arb": true,
"age": 50,
"beta_blocker": true,
"bmi_kg_m2": 30,
"copd": false,
"creatinine_mg_dl": 0.9,
"creatinine_umol_l": 80,
"current_smoker": false,
"diabetes": false,
"ef_percent": 55,
"hf_duration_gt_18_months": false,
"nyha_class": 1,
"sex": "female",
"systolic_mm_hg": 150
}
]
}),
});
console.log(res.status, await res.text());Python: pay and call
# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client
# Pays at most $0.005 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.005"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))
with x402_requests(client) as session:
res = session.post(
"https://api.magentlab.com/api/calc/maggic",
json={
"items": [
{
"acei_arb": True,
"age": 50,
"beta_blocker": True,
"bmi_kg_m2": 30,
"copd": False,
"creatinine_mg_dl": 0.9,
"creatinine_umol_l": 80,
"current_smoker": False,
"diabetes": False,
"ef_percent": 55,
"hf_duration_gt_18_months": False,
"nyha_class": 1,
"sex": "female",
"systolic_mm_hg": 150,
},
{
"acei_arb": True,
"age": 50,
"beta_blocker": True,
"bmi_kg_m2": 30,
"copd": False,
"creatinine_mg_dl": 0.9,
"creatinine_umol_l": 80,
"current_smoker": False,
"diabetes": False,
"ef_percent": 55,
"hf_duration_gt_18_months": False,
"nyha_class": 1,
"sex": "female",
"systolic_mm_hg": 150,
},
],
},
)
print(res.status_code, res.text)Security scan
No findings
We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 3 h ago | Passed | 402 | 366 ms | $0.005 |
| 8 h ago | Passed | 402 | 303 ms | $0.005 |
| 12 h ago | Passed | 402 | 174 ms | $0.005 |
| 17 h ago | Passed | 402 | 351 ms | $0.005 |
| 21 h ago | Passed | 402 | 323 ms | $0.005 |
Show 10 older checks
| 25 h ago | Passed | 402 | 1.7 s | $0.005 |
| 29 h ago | Passed | 402 | 172 ms | $0.005 |
| 34 h ago | Passed | 402 | 221 ms | $0.005 |
| 38 h ago | Passed | 402 | 170 ms | $0.005 |
| 42 h ago | Passed | 402 | 148 ms | $0.005 |
| 46 h ago | Passed | 402 | 411 ms | $0.005 |
| 2 days ago | Passed | 402 | 315 ms | $0.005 |
| 2 days ago | Passed | 402 | 757 ms | $0.005 |
| 2 days ago | Passed | 402 | 161 ms | $0.005 |
| 3 days ago | Passed | 402 | 154 ms | $0.005 |