Calc Idf Dar
by magent in Security & trust
Hassanein 2021 IDF-DAR fasting risk table: type 1 scores 1; duration ≥10 scores 1; hypoglycemia 0/1/3.5/5.5/6.5; HbA1c band 0/1/2; treatment 0/0.5/1/1.5/2/2.5/3; SMBG 0/1/2; DKA/HONC 0/1/2/3; MVD 0/2/6.5; eGFR band 0/2/4/6.5; pregnancy 0/3.5/6.5; frailty 0/3.5/6.5; labour 0/2/4; prior negative Ramadan 1; fasting ≥16 h 1. Low 0–3, moderate 3.5–6, high >6. Caller-assigned; not a fasting order or insulin dose.
https://api.magentlab.com/api/calc/idf_dar- Price
- $0.007
- per call in USDC
- Uptime
- 94.1%
- last 30 days
- Response time
- 180 ms
- 779 ms slowest 5%
- Last check
- Failed
- 3 h ago, next any minute now
Reliability
Latest check failed 3 h ago: Timed out
Status and outage history · Atom feed · Watch with other listings
How to call it
POST https://api.magentlab.com/api/calc/idf_dar
Each call costs $0.007 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/idf_dar
content-type: application/json
{
"items": [
{
"acute_complication": "none",
"age": 50,
"duration_ge_10": false,
"fasting_hours_ge_16": false,
"glycaemic_control": "lt_7_5",
"home_support": true,
"hypoglycemia": "none",
"impaired_cognition_or_frail": false,
"mvd": "none",
"physical_labor": "none",
"pregnancy": "not_pregnant",
"previous_ramadan_negative": false,
"renal": "egfr_gt_60",
"smbg": "as_indicated",
"treatment": "other",
"type_1_diabetes": false
},
{
"acute_complication": "none",
"age": 50,
"duration_ge_10": false,
"fasting_hours_ge_16": false,
"glycaemic_control": "lt_7_5",
"home_support": true,
"hypoglycemia": "none",
"impaired_cognition_or_frail": false,
"mvd": "none",
"physical_labor": "none",
"pregnancy": "not_pregnant",
"previous_ramadan_negative": false,
"renal": "egfr_gt_60",
"smbg": "as_indicated",
"treatment": "other",
"type_1_diabetes": false
}
]
}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, 212 lines
{
"count": 2,
"items": [
{
"age_years": 50,
"citation": {
"authors": "Hassanein M, Afandi B, Yakoob Ahmedani M, et al.",
"doi": "10.1016/j.diabres.2021.109185",
"id": "hassanein-2021",
"pmid": "35016991",
"source": "Diabetes Res Clin Pract. 2022;185:109185",
"title": "Diabetes and Ramadan: Practical guidelines 2021"
},
"components": [
{
"factor": "diabetes_type",
"points": 0,
"present": false,
"value": false
},
{
"factor": "duration",
"points": 0,
"present": false,
"value": false
},
{
"factor": "hypoglycemia",
"points": 0,
"present": false,
"value": "none"
},
{
"factor": "glycaemic_control",
"points": 0,
"present": false,
"value": "lt_7_5"
},
{
"factor": "treatment",
"points": 0,
"present": false,
"value": "other"
},
{
"factor": "smbg",
"points": 0,
"present": false,
"value": "as_indicated"
},
{
"factor": "acute_complication",
"points": 0,
"present": false,
"value": "none"
},
{
"factor": "mvd",
"points": 0,
"present": false,
"value": "none"
},
{
"factor": "renal",
"points": 0,
"present": false,
"value": "egfr_gt_60"
},
{
"factor": "pregnancy",
"points": 0,
"present": false,
"value": "not_pregnant"
},
{
"factor": "frailty",
"points": 0,
"present": false,
"value": "none"
},
{
"factor": "physical_labor",
"points": 0,
"present": false,
"value": "none"
},
{
"factor": "previous_ramadan",
"points": 0,
"present": false,
"value": false
},
{
"factor": "fasting_hours",
"points": 0,
"present": false,
"value": 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.",
"formula": "idf_dar",
"formula_expression": "IDF-DAR 2021 = type1 1 / type2 0 + duration>=10 1 + hypoglycemia (unawareness 6.5, recent_severe 5.5, multiple_weekly 3.5, lt_weekly 1, none 0) + hba1c_band (>9% 2, 7.5-9% 1, <7.5% 0) + treatment (multiple_daily_mixed 3, basal_bolus_pump 2.5, once_daily_mixed 2, basal_insulin 1.5, glibenclamide 1, gliclazide_class 0.5, other 0) + smbg (not_conducted 2, suboptimal 1, as_indicated 0) + dka_honc (3mo 3, 6mo 2, 12mo 1, none 0) + mvd (unstable 6.5, stable 2, none 0) + egfr (<30 6.5, 30-45 4, 45-60 2, >60 0) + pregnancy (not_within_targets 6.5, within_targets 3.5, not_pregnant 0) + frailty (impaired_or_frail 6.5, age>70_no_home_support 3.5, none 0) + labor (high 4, moderate 2, none 0) + prior_ramadan_negative 1 + fasting>=16h 1; low 0-3, moderate 3.5-6, high >6; Hassanein 2021 table",
"max_score": 50.5,
"risk": "low",
"score": 0
},
{
"age_years": 50,
"citation": {
"authors": "Hassanein M, Afandi B, Yakoob Ahmedani M, et al.",
"doi": "10.1016/j.diabres.2021.109185",
"id": "hassanein-2021",
"pmid": "35016991",
"source": "Diabetes Res Clin Pract. 2022;185:109185",
"title": "Diabetes and Ramadan: Practical guidelines 2021"
},
"components": [
{
"factor": "diabetes_type",
"points": 0,
"present": false,
"value": false
},
{
"factor": "duration",
"points": 0,
"present": false,
"value": false
},
{
"factor": "hypoglycemia",
"points": 0,
"present": false,
"value": "none"
},
{
"factor": "glycaemic_control",
"points": 0,
"present": false,
"value": "lt_7_5"
},
{
"factor": "treatment",
"points": 0,
"present": false,
"value": "other"
},
{
"factor": "smbg",
"points": 0,
"present": false,
"value": "as_indicated"
},
{
"factor": "acute_complication",
"points": 0,
"present": false,
"value": "none"
},
{
"factor": "mvd",
"points": 0,
"present": false,
"value": "none"
},
{
"factor": "renal",
"points": 0,
"present": false,
"value": "egfr_gt_60"
},
{
"factor": "pregnancy",
"points": 0,
"present": false,
"value": "not_pregnant"
},
{
"factor": "frailty",
"points": 0,
"present": false,
"value": "none"
},
{
"factor": "physical_labor",
"points": 0,
"present": false,
"value": "none"
},
{
"factor": "previous_ramadan",
"points": 0,
"present": false,
"value": false
},
{
"factor": "fasting_hours",
"points": 0,
"present": false,
"value": 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.",
"formula": "idf_dar",
"formula_expression": "IDF-DAR 2021 = type1 1 / type2 0 + duration>=10 1 + hypoglycemia (unawareness 6.5, recent_severe 5.5, multiple_weekly 3.5, lt_weekly 1, none 0) + hba1c_band (>9% 2, 7.5-9% 1, <7.5% 0) + treatment (multiple_daily_mixed 3, basal_bolus_pump 2.5, once_daily_mixed 2, basal_insulin 1.5, glibenclamide 1, gliclazide_class 0.5, other 0) + smbg (not_conducted 2, suboptimal 1, as_indicated 0) + dka_honc (3mo 3, 6mo 2, 12mo 1, none 0) + mvd (unstable 6.5, stable 2, none 0) + egfr (<30 6.5, 30-45 4, 45-60 2, >60 0) + pregnancy (not_within_targets 6.5, within_targets 3.5, not_pregnant 0) + frailty (impaired_or_frail 6.5, age>70_no_home_support 3.5, none 0) + labor (high 4, moderate 2, none 0) + prior_ramadan_negative 1 + fasting>=16h 1; low 0-3, moderate 3.5-6, high >6; Hassanein 2021 table",
"max_score": 50.5,
"risk": "low",
"score": 0
}
],
"path": "/api/calc/idf_dar"
}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.007.
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/idf_dar' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"acute_complication":"none","age":50,"duration_ge_10":false,"fasting_hours_ge_16":false,"glycaemic_control":"lt_7_5","home_support":true,"hypoglycemia":"none","impaired_cognition_or_frail":false,"mvd":"none","physical_labor":"none","pregnancy":"not_pregnant","previous_ramadan_negative":false,"renal":"egfr_gt_60","smbg":"as_indicated","treatment":"other","type_1_diabetes":false},{"acute_complication":"none","age":50,"duration_ge_10":false,"fasting_hours_ge_16":false,"glycaemic_control":"lt_7_5","home_support":true,"hypoglycemia":"none","impaired_cognition_or_frail":false,"mvd":"none","physical_labor":"none","pregnancy":"not_pregnant","previous_ramadan_negative":false,"renal":"egfr_gt_60","smbg":"as_indicated","treatment":"other","type_1_diabetes":false}]}'
# 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/idf_dar' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"acute_complication":"none","age":50,"duration_ge_10":false,"fasting_hours_ge_16":false,"glycaemic_control":"lt_7_5","home_support":true,"hypoglycemia":"none","impaired_cognition_or_frail":false,"mvd":"none","physical_labor":"none","pregnancy":"not_pregnant","previous_ramadan_negative":false,"renal":"egfr_gt_60","smbg":"as_indicated","treatment":"other","type_1_diabetes":false},{"acute_complication":"none","age":50,"duration_ge_10":false,"fasting_hours_ge_16":false,"glycaemic_control":"lt_7_5","home_support":true,"hypoglycemia":"none","impaired_cognition_or_frail":false,"mvd":"none","physical_labor":"none","pregnancy":"not_pregnant","previous_ramadan_negative":false,"renal":"egfr_gt_60","smbg":"as_indicated","treatment":"other","type_1_diabetes":false}]}' \
| 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.007 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.007" });
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.007 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fapi.magentlab.com%2Fapi%2Fcalc%2Fidf_dar&method=POST
const res = await pay("https://api.magentlab.com/api/calc/idf_dar", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"items": [
{
"acute_complication": "none",
"age": 50,
"duration_ge_10": false,
"fasting_hours_ge_16": false,
"glycaemic_control": "lt_7_5",
"home_support": true,
"hypoglycemia": "none",
"impaired_cognition_or_frail": false,
"mvd": "none",
"physical_labor": "none",
"pregnancy": "not_pregnant",
"previous_ramadan_negative": false,
"renal": "egfr_gt_60",
"smbg": "as_indicated",
"treatment": "other",
"type_1_diabetes": false
},
{
"acute_complication": "none",
"age": 50,
"duration_ge_10": false,
"fasting_hours_ge_16": false,
"glycaemic_control": "lt_7_5",
"home_support": true,
"hypoglycemia": "none",
"impaired_cognition_or_frail": false,
"mvd": "none",
"physical_labor": "none",
"pregnancy": "not_pregnant",
"previous_ramadan_negative": false,
"renal": "egfr_gt_60",
"smbg": "as_indicated",
"treatment": "other",
"type_1_diabetes": false
}
]
}),
});
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.007 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.007"})
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/idf_dar",
json={
"items": [
{
"acute_complication": "none",
"age": 50,
"duration_ge_10": False,
"fasting_hours_ge_16": False,
"glycaemic_control": "lt_7_5",
"home_support": True,
"hypoglycemia": "none",
"impaired_cognition_or_frail": False,
"mvd": "none",
"physical_labor": "none",
"pregnancy": "not_pregnant",
"previous_ramadan_negative": False,
"renal": "egfr_gt_60",
"smbg": "as_indicated",
"treatment": "other",
"type_1_diabetes": False,
},
{
"acute_complication": "none",
"age": 50,
"duration_ge_10": False,
"fasting_hours_ge_16": False,
"glycaemic_control": "lt_7_5",
"home_support": True,
"hypoglycemia": "none",
"impaired_cognition_or_frail": False,
"mvd": "none",
"physical_labor": "none",
"pregnancy": "not_pregnant",
"previous_ramadan_negative": False,
"renal": "egfr_gt_60",
"smbg": "as_indicated",
"treatment": "other",
"type_1_diabetes": False,
},
],
},
)
print(res.status_code, res.text)Security scan
1 finding
- Charges more than its listed price in payment
Listed at $0.005, charges $0.007
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 3 h ago | Timed out | - | - | - |
| 8 h ago | Timed out | - | - | - |
| 13 h ago | Passed | 402 | 169 ms | $0.007 |
| 18 h ago | Passed | 402 | 147 ms | $0.007 |
| 22 h ago | Passed | 402 | 161 ms | $0.007 |
Show 10 older checks
| 27 h ago | Passed | 402 | 176 ms | $0.007 |
| 32 h ago | Passed | 402 | 167 ms | $0.007 |
| 36 h ago | Passed | 402 | 180 ms | $0.007 |
| 40 h ago | Passed | 402 | 176 ms | $0.007 |
| 44 h ago | Passed | 402 | 298 ms | $0.007 |
| 2 days ago | Passed | 402 | 158 ms | $0.007 |
| 2 days ago | Passed | 402 | 1.1 s | $0.007 |
| 2 days ago | Passed | 402 | 186 ms | $0.007 |
| 3 days ago | Passed | 402 | 145 ms | $0.007 |
| 3 days ago | Passed | 402 | 207 ms | $0.007 |
History
| 11 Oct 2026 | Price changed from $0.005 to $0.007 |