Electrolytes / glucose · LIVE
IDF-DAR 2021 fasting risk score
IDF-DAR
Sum the Hassanein 2021 IDF-DAR fasting risk table and return low (0–3), moderate (3.5–6), or high (>6).
Markdown: /docs/idf-dar.md · Canonical: https://magentlab.com/docs/idf-dar
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
Sum the Hassanein 2021 IDF-DAR fasting risk table and return low (0–3), moderate (3.5–6), or high (>6).
When to use
When an agent needs the published 2021 IDF-DAR point total and must not invent a fasting order, a diabetes diagnosis, or an insulin dose.
When not to use
- Not a medical device. magent does not assay glucose or advise fasting.
- Not a diabetes diagnosis. Not an insulin dose. Risk is a published point total, not a fasting permission.
- Hassanein 2021 practical-guidelines table only. Not the 2016 IDF-DAR qualitative tiers. Not a later 2025 or 2026 update.
- Diabetes type, duration, hypoglycemia history, treatment, complications, HbA1c band, and eGFR band are caller-assigned. magent does not measure labs or examine the patient.
- Bands are low 0–3, moderate 3.5–6, and high >6 as published. Half-points follow the table. Age enters only the >70 / no-home-support frailty band.
Formula
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
Citation
- Authors
- Hassanein M, Afandi B, Yakoob Ahmedani M, et al.
- Source
- Diabetes Res Clin Pract. 2022;185:109185
Worked example
Well-controlled T2D on diet/metformin-class, no complications
Given:
acute_complication=noneage=50duration_ge_10=falsefasting_hours_ge_16=falseglycaemic_control=lt_7_5home_support=truehypoglycemia=noneimpaired_cognition_or_frail=falsemvd=nonephysical_labor=nonepregnancy=not_pregnantprevious_ramadan_negative=falserenal=egfr_gt_60smbg=as_indicatedtreatment=othertype_1_diabetes=false
- Type 2 → 0; duration <10 → 0; no hypoglycemia → 0; HbA1c <7.5% → 0; other therapy (diet/metformin-class) → 0; remaining elements 0
- Score = 0; risk = low (0–3). Not a fasting order. Not a diagnosis.
Same baseline, pregnant within targets
Given:
acute_complication=noneage=50duration_ge_10=falsefasting_hours_ge_16=falseglycaemic_control=lt_7_5home_support=truehypoglycemia=noneimpaired_cognition_or_frail=falsemvd=nonephysical_labor=nonepregnancy=within_targetsprevious_ramadan_negative=falserenal=egfr_gt_60smbg=as_indicatedtreatment=othertype_1_diabetes=false
- Pregnancy within targets → 3.5; remaining elements 0
- Score = 3.5; risk = moderate (3.5–6). Not a fasting order.
Also searched as
- IDF-DAR risk score
- Diabetes and Ramadan fasting risk
- Hassanein 2021 Ramadan risk
- Ramadan fasting risk stratification
- IDF DAR 2021 score
Try
Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.
Full URL: https://api.magentlab.com/api/calc/idf_dar?age=50&type_1_diabetes=false&duration_ge_10=false&hypoglycemia=none&glycaemic_control=lt_7_5&treatment=other&smbg=as_indicated´_complication=none&mvd=none&renal=egfr_gt_60&pregnancy=not_pregnant&impaired_cognition_or_frail=false&home_support=true&physical_labor=none&previous_ramadan_negative=false&fasting_hours_ge_16=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/idf_dar?age=50&type_1_diabetes=false&duration_ge_10=false&hypoglycemia=none&glycaemic_control=lt_7_5&treatment=other&smbg=as_indicated´_complication=none&mvd=none&renal=egfr_gt_60&pregnancy=not_pregnant&impaired_cognition_or_frail=false&home_support=true&physical_labor=none&previous_ramadan_negative=false&fasting_hours_ge_16=false"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
age |
integer | required | Age in years (integer 18-120). Hassanein 2021 frailty band: age >70 with no home support scores 3.5 unless impaired_cognition_or_frail is true (6.5). Age 70 does not enter that band. magent does not read a chart. |
type_1_diabetes |
boolean | required | Caller-assigned diabetes type (Hassanein 2021). true is type 1 and scores 1; false is type 2 and scores 0. magent does not diagnose diabetes. |
duration_ge_10 |
boolean | required | Caller-assigned diabetes duration ≥10 years (Hassanein 2021). true scores 1; false (<10 years) scores 0. |
hypoglycemia |
string | required · none, lt_weekly, multiple_weekly, recent_severe, unawareness | Caller-assigned hypoglycemia history (Hassanein 2021; highest applicable). none 0; lt_weekly (less than once per week) 1; multiple_weekly 3.5; recent_severe 5.5; unawareness 6.5. magent does not assay glucose. |
glycaemic_control |
string | required · lt_7_5, 7_5_to_9, gt_9 | Caller-assigned HbA1c band (Hassanein 2021). lt_7_5 (<7.5%) scores 0; 7_5_to_9 (7.5–9%) scores 1; gt_9 (>9%) scores 2. magent does not assay glucose or HbA1c. |
treatment |
string | required · other, gliclazide_class, glibenclamide, basal_insulin, once_daily_mixed, basal_bolus_pump, multiple_daily_mixed | Caller-assigned treatment (Hassanein 2021). other (diet or metformin-class, no SU or insulin) 0; gliclazide_class (gliclazide/MR, glimepiride, or repaglinide) 0.5; glibenclamide 1; basal_insulin 1.5; once_daily_mixed 2; basal_bolus_pump 2.5; multiple_daily_mixed 3. Not an insulin dose. |
smbg |
string | required · as_indicated, suboptimal, not_conducted | Caller-assigned self-monitoring of blood glucose (Hassanein 2021). as_indicated 0; suboptimal 1; not_conducted 2. magent does not assay glucose. |
acute_complication |
string | required · none, last_12_months, last_6_months, last_3_months | Caller-assigned DKA or HONC recency (Hassanein 2021). none 0; last_12_months 1; last_6_months 2; last_3_months 3. |
mvd |
string | required · none, stable, unstable | Caller-assigned macrovascular disease (Hassanein 2021). none 0; stable 2; unstable 6.5. |
renal |
string | required · egfr_gt_60, egfr_45_to_60, egfr_30_to_45, egfr_lt_30 | Caller-assigned eGFR band in mL/min (Hassanein 2021). egfr_gt_60 (>60) 0; egfr_45_to_60 (45–60) 2; egfr_30_to_45 (30–45) 4; egfr_lt_30 (<30) 6.5. magent does not compute eGFR. |
pregnancy |
string | required · not_pregnant, within_targets, not_within_targets | Caller-assigned pregnancy band (Hassanein 2021). not_pregnant 0; within_targets 3.5; not_within_targets 6.5. magent does not advise fasting. |
impaired_cognition_or_frail |
boolean | required | Caller-assigned impaired cognitive function or frailty (Hassanein 2021). true scores 6.5 and supersedes the age>70 / no-home-support band. |
home_support |
boolean | required | Caller-assigned home support (Hassanein 2021). When age >70 and this is false and impaired_cognition_or_frail is false, frailty scores 3.5. true or false. |
physical_labor |
string | required · none, moderate, high | Caller-assigned physical labour (Hassanein 2021). none 0; moderate 2; high 4. |
previous_ramadan_negative |
boolean | required | Caller-assigned overall negative previous Ramadan experience (Hassanein 2021). true scores 1; false scores 0. |
fasting_hours_ge_16 |
boolean | required | Caller-assigned fasting hours ≥16 (location; Hassanein 2021). true scores 1; false (<16 hours) scores 0. magent does not advise fasting. |
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.
- 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": [
{
"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"
}
]
}
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/idf_dar",
"items": [
{
"components": [
{
"value": false,
"factor": "diabetes_type",
"points": 0,
"present": false
},
{
"value": false,
"factor": "duration",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "hypoglycemia",
"points": 0,
"present": false
},
{
"value": "lt_7_5",
"factor": "glycaemic_control",
"points": 0,
"present": false
},
{
"value": "other",
"factor": "treatment",
"points": 0,
"present": false
},
{
"value": "as_indicated",
"factor": "smbg",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "acute_complication",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "mvd",
"points": 0,
"present": false
},
{
"value": "egfr_gt_60",
"factor": "renal",
"points": 0,
"present": false
},
{
"value": "not_pregnant",
"factor": "pregnancy",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "frailty",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "physical_labor",
"points": 0,
"present": false
},
{
"value": false,
"factor": "previous_ramadan",
"points": 0,
"present": false
},
{
"value": false,
"factor": "fasting_hours",
"points": 0,
"present": 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": "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"
},
"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",
"age_years": 50,
"max_score": 50.5,
"score": 0,
"risk": "low"
},
{
"components": [
{
"value": false,
"factor": "diabetes_type",
"points": 0,
"present": false
},
{
"value": false,
"factor": "duration",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "hypoglycemia",
"points": 0,
"present": false
},
{
"value": "lt_7_5",
"factor": "glycaemic_control",
"points": 0,
"present": false
},
{
"value": "other",
"factor": "treatment",
"points": 0,
"present": false
},
{
"value": "as_indicated",
"factor": "smbg",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "acute_complication",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "mvd",
"points": 0,
"present": false
},
{
"value": "egfr_gt_60",
"factor": "renal",
"points": 0,
"present": false
},
{
"value": "not_pregnant",
"factor": "pregnancy",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "frailty",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "physical_labor",
"points": 0,
"present": false
},
{
"value": false,
"factor": "previous_ramadan",
"points": 0,
"present": false
},
{
"value": false,
"factor": "fasting_hours",
"points": 0,
"present": 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": "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"
},
"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",
"age_years": 50,
"max_score": 50.5,
"score": 0,
"risk": "low"
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | idf_dar |
formula_expression |
string | Exact Hassanein 2021 table expression |
score |
number | IDF-DAR 2021 points; half-points allowed; published range 0 to 50.5 |
max_score |
number | 50.5 (sum of each element's published maximum) |
risk |
string | low when score is 0–3, moderate when 3.5–6, high when >6 (Hassanein 2021). A band, not a fasting order. |
age_years |
integer | Age in years used for the frailty band |
components |
array | Per-element points |
citation |
object | Hassanein 2021 Diabetes Res Clin Pract citation |
disclaimer |
string | Not-a-device notice |
Example JSON
Machine form of the same example. Frozen fixture. Not a live lookup.
{
"components": [
{
"value": false,
"factor": "diabetes_type",
"points": 0,
"present": false
},
{
"value": false,
"factor": "duration",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "hypoglycemia",
"points": 0,
"present": false
},
{
"value": "lt_7_5",
"factor": "glycaemic_control",
"points": 0,
"present": false
},
{
"value": "other",
"factor": "treatment",
"points": 0,
"present": false
},
{
"value": "as_indicated",
"factor": "smbg",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "acute_complication",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "mvd",
"points": 0,
"present": false
},
{
"value": "egfr_gt_60",
"factor": "renal",
"points": 0,
"present": false
},
{
"value": "not_pregnant",
"factor": "pregnancy",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "frailty",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "physical_labor",
"points": 0,
"present": false
},
{
"value": false,
"factor": "previous_ramadan",
"points": 0,
"present": false
},
{
"value": false,
"factor": "fasting_hours",
"points": 0,
"present": 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": "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"
},
"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",
"age_years": 50,
"max_score": 50.5,
"score": 0,
"risk": "low"
}
Client errors (HTTP 400)
Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_flag |
boolean clinical flags must be true or false Returned before settlement; you are not charged. |
| 400 | invalid_age |
age must be an integer from 18 to 120 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
- Bang diabetes screening — Sum the Bang 2009 Table 2 development screening score for undiagnosed diabetes and return high_risk when the total is ≥5.
- FINDRISC — Sum the original Lindström 2003 seven-item Finnish diabetes risk score (FINDRISC, 0–20) and return at_risk when the total is ≥9.
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. HTTP 402 never includes the tool JSON.
- 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.