# IDF-DAR 2021 fasting risk score

IDF-DAR

Status: LIVE
Price: $0.005 USDC
`GET /api/calc/idf_dar`
HTML: https://magentlab.com/docs/idf-dar
Markdown: https://magentlab.com/docs/idf-dar.md

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

[Diabetes and Ramadan: Practical guidelines 2021](https://doi.org/10.1016/j.diabres.2021.109185)
Hassanein M, Afandi B, Yakoob Ahmedani M, et al.
Diabetes Res Clin Pract. 2022;185:109185
DOI: [10.1016/j.diabres.2021.109185](https://doi.org/10.1016/j.diabres.2021.109185)

## Worked example

### Well-controlled T2D on diet/metformin-class, no complications

Given: `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`

1. Type 2 → 0; duration <10 → 0; no hypoglycemia → 0; HbA1c <7.5% → 0; other therapy (diet/metformin-class) → 0; remaining elements 0
2. Score = 0; risk = low (0–3). Not a fasting order. Not a diagnosis.


### Same baseline, pregnant within targets

Given: `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=within_targets, previous_ramadan_negative=false, renal=egfr_gt_60, smbg=as_indicated, treatment=other, type_1_diabetes=false`

1. Pregnancy within targets → 3.5; remaining elements 0
2. 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

## Parameters

- `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): 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): 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): 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): 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): 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): Caller-assigned macrovascular disease (Hassanein 2021). none 0; stable 2; unstable 6.5.
- `renal` (string, required): 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): 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): 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.

Method: `POST /api/calc/idf_dar`
Max items: 25
Price: unit_amount + extra_item_amount * (n - 1) (unit 5000 atomic, extra 2000 atomic)
Status: 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:

```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"
    }
  ]
}
```

Human paywall (two-item fixture): https://api.magentlab.com/paywall/bulk/idf-dar

Example 200:

```json
{
  "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 fields

- `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

Frozen fixture. Not a live lookup.

```json
{
  "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"
}
```

## Errors

- HTTP 400 `invalid_flag`: boolean clinical flags must be true or false Returned before settlement; you are not charged.
- HTTP 400 `invalid_age`: age must be an integer from 18 to 120 Returned before settlement; you are not charged.
- HTTP 400 `invalid_items`: POST body must be a JSON object with only an items array Returned before settlement; you are not charged.
- HTTP 400 `invalid_item_count`: items must be an array of 1 to 25 objects Returned before settlement; you are not charged.
- HTTP 400 `invalid_item`: each items entry must be a JSON object Returned before settlement; you are not charged.

Shared HTTP 402 and 503: https://magentlab.com/docs/payments

## Related tools

- [Bang diabetes screening](https://magentlab.com/docs/ada-diabetes) — Sum the Bang 2009 Table 2 development screening score for undiagnosed diabetes and return high_risk when the total is ≥5.
- [FINDRISC](https://magentlab.com/docs/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.

- GET the tool with Accept: application/json (do not send Accept: text/html unless you want the human paywall).
- HTTP 402 means you have not paid. Decode the base64 PAYMENT-REQUIRED header. HTTP 503 is not a new quote.
- Sign accepts[0] (exact, EIP-3009) with validBefore = now + maxTimeoutSeconds (600 seconds), or accepts[1] (batch-settlement deposit/voucher) on product GET. Ping and POST {items} stay exact. Magent retries transient facilitator 429/5xx before answering.
- Retry the same URL with PAYMENT-SIGNATURE (base64 JSON of accepted and payload). Magent attaches canonical extensions.bazaar on CDP verify/settle; echoing 402 bazaar is optional.
- Success is HTTP 200 JSON plus PAYMENT-RESPONSE. exact settles before the tool. batch-settlement verifies (and deposit-settles) before the tool and commits the charge after HTTP 2xx. HTTP 503: retry the same PAYMENT-SIGNATURE. Mint a new exact nonce only after a new HTTP 402.

- offered `exact` on eip155:8453: Fixed-price USDC on Base. The buyer authorizes the advertised amount (EIP-3009). magent settles before the tool runs (paymentFlow upfront). extra.assetTransferMethod=eip3009 extra.paymentFlow=upfront.
- offered `batch-settlement` on eip155:8453: Payment-channel vouchers claimed later in batches. Exact stays accepts[0]. Same-path POST {items} is still exact. extra.assetTransferMethod=eip3009 extra.paymentFlow=authorization.

- not offered `upto`: Not offered. Usage-based: buyer authorizes a ceiling, seller settles the actual amount after work. Reserved for a future metered tool. Not for current calculators or code search.

Same-path POST {items} is still scheme exact: one EIP-3009 authorization for GET unit plus $0.002 per extra item. That is not x402 batch-settlement (payment channels / vouchers).

Shared HTTP 402 and 503 table: https://magentlab.com/docs/payments

Stdio MCP (one process per host): https://magentlab.com/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.
