MAGENT

Electrolytes / glucose · LIVE

Bang diabetes screening score

Bang diabetes screening

Sum the Bang 2009 Table 2 development screening score for undiagnosed diabetes and return high_risk when the total is ≥5.

LIVE $0.005 USDC GET /api/calc/ada_diabetes

Markdown: /docs/ada-diabetes.md · Canonical: https://magentlab.com/docs/ada-diabetes

Not a medical device. Not a diagnosis, dose, or listing recommendation.

What it computes

Sum the Bang 2009 Table 2 development screening score for undiagnosed diabetes and return high_risk when the total is ≥5.

When to use

When an agent needs the published Bang 2009 Table 2 point total (BMI-only, no waist) and must not invent a diabetes diagnosis or a prediabetes cutpoint of 4.

When not to use

  • Not a medical device. magent does not diagnose diabetes or assay glucose.
  • Bang 2009 Table 2 development scores only. Not Appendix ARIC/CHS coefficients. Not the ADA questionnaires the paper compared.
  • high_risk is score ≥5 from that paper (chosen cutpoint for undiagnosed diabetes). A prediabetes cutpoint of 4 is not implemented.
  • Obesity is from caller-supplied BMI only. This tool does not take waist circumference.
  • Physically active scores −1; the total may be −1. BMI is caller-supplied kg/m^2; magent does not compute BMI from height and weight.

Formula

score = age + sex + family_history_diabetes + hypertension + obesity + physically_active; age <40 -> 0, 40-49 -> 1, 50-59 -> 2, >=60 -> 3; female 0, male 1; family history yes 1; hypertension yes 1; BMI >=40 -> 3, 30 <= BMI < 40 -> 2, 25 <= BMI < 30 -> 1, else 0; physically_active yes -> -1; high_risk iff score>=5; Bang 2009 Table 2 development scores

Citation

Title
Development and validation of a patient self-assessment score for diabetes risk
Authors
Bang H, Edwards AM, Bomback AS, Ballantyne CM, Brillon D, Callahan MA, Teutsch SM, Mushlin AI, Kern LM
Source
Ann Intern Med. 2009;151(11):775-783
DOI
10.7326/0003-4819-151-11-200912010-00005

Worked example

Age 40, female, BMI 22, active (score 0)

Given: age=40bmi_kg_m2=22family_history_diabetes=falsehypertension=falsephysically_active=truesex=female

  1. Age 40 → 1; female → 0; BMI 22 <25 → 0; no family history → 0; no hypertension → 0; physically active → −1
  2. Score = 1 + (−1) = 0; high_risk false (cutpoint ≥5). Not a diagnosis.

Cutoff ≥5 (age ≥60, male, family history)

Given: age=60bmi_kg_m2=22family_history_diabetes=truehypertension=falsephysically_active=falsesex=male

  1. Age 60 → 3; male → 1; family history → 1; other items 0
  2. Score = 5; high_risk true (cutpoint ≥5). Not a diagnosis.

Also searched as

  • Bang diabetes screening score
  • Bang 2009 diabetes score
  • patient self-assessment diabetes score
  • undiagnosed diabetes screening score
  • Bang Annals diabetes score
  • ADA diabetes screening score

Try

Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.

/api/calc/ada_diabetes?age=40&sex=female&bmi_kg_m2=22&family_history_diabetes=false&hypertension=false&physically_active=true

Full URL: https://api.magentlab.com/api/calc/ada_diabetes?age=40&sex=female&bmi_kg_m2=22&family_history_diabetes=false&hypertension=false&physically_active=true

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/ada_diabetes?age=40&sex=female&bmi_kg_m2=22&family_history_diabetes=false&hypertension=false&physically_active=true"

Parameters

Name Type Required Description
age integer required Age in years (20-120). Bang 2009 Table 2: <40 scores 0; 40-49 scores 1; 50-59 scores 2; ≥60 scores 3. Age 40 and 49 score 1; 50 and 59 score 2; 60 scores 3.
sex string required · female, male female or male. Bang 2009 Table 2: female scores 0; male scores 1.
bmi_kg_m2 number required Body-mass index in kg/m^2 (10-80). Caller-supplied; magent does not compute BMI from height and weight. Bang 2009 Table 2 obesity from BMI only (no waist): ≥40 extremely obese scores 3; 30 ≤ BMI < 40 obese scores 2; 25 ≤ BMI < 30 overweight scores 1; else 0. 25.0 scores 1; 30.0 scores 2; 40.0 scores 3.
family_history_diabetes boolean required Family history of diabetes (Bang 2009 Table 2). true scores 1; false scores 0.
hypertension boolean required History of hypertension (Bang 2009 Table 2). true scores 1; false scores 0. magent does not read a medication list or measure blood pressure.
physically_active boolean required Physically active (Bang 2009 Table 2). true scores −1; false scores 0. The total may be −1.

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.

POST /api/calc/ada_diabetes Max 25 unit_amount + extra_item_amount * (n - 1) extra $0.002 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 (fixture)

{
  "items": [
    {
      "age": "40",
      "bmi_kg_m2": "22",
      "family_history_diabetes": "false",
      "hypertension": "false",
      "physically_active": "true",
      "sex": "female"
    },
    {
      "age": "40",
      "bmi_kg_m2": "22",
      "family_history_diabetes": "false",
      "hypertension": "false",
      "physically_active": "true",
      "sex": "female"
    }
  ]
}

Open bulk paywall →

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/ada_diabetes",
  "items": [
    {
      "components": [
        {
          "value": 40,
          "factor": "age",
          "points": 1,
          "present": true
        },
        {
          "value": "female",
          "factor": "sex",
          "points": 0,
          "present": false
        },
        {
          "factor": "family_history_diabetes",
          "points": 0,
          "present": false
        },
        {
          "factor": "hypertension",
          "points": 0,
          "present": false
        },
        {
          "value": 22.0,
          "factor": "bmi",
          "points": 0,
          "present": true
        },
        {
          "factor": "physically_active",
          "points": -1,
          "present": true
        }
      ],
      "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": "Bang H, Edwards AM, Bomback AS, Ballantyne CM, Brillon D, Callahan MA, Teutsch SM, Mushlin AI, Kern LM",
        "doi": "10.7326/0003-4819-151-11-200912010-00005",
        "id": "bang-2009",
        "pmid": "19949143",
        "source": "Ann Intern Med. 2009;151(11):775-783",
        "title": "Development and validation of a patient self-assessment score for diabetes risk"
      },
      "formula": "ada_diabetes",
      "formula_expression": "score = age + sex + family_history_diabetes + hypertension + obesity + physically_active; age <40 -> 0, 40-49 -> 1, 50-59 -> 2, >=60 -> 3; female 0, male 1; family history yes 1; hypertension yes 1; BMI >=40 -> 3, 30 <= BMI < 40 -> 2, 25 <= BMI < 30 -> 1, else 0; physically_active yes -> -1; high_risk iff score>=5; Bang 2009 Table 2 development scores",
      "age_years": 40,
      "max_score": 9,
      "score": 0,
      "sex": "female",
      "bmi_kg_m2": 22.0,
      "high_risk": false
    },
    {
      "components": [
        {
          "value": 40,
          "factor": "age",
          "points": 1,
          "present": true
        },
        {
          "value": "female",
          "factor": "sex",
          "points": 0,
          "present": false
        },
        {
          "factor": "family_history_diabetes",
          "points": 0,
          "present": false
        },
        {
          "factor": "hypertension",
          "points": 0,
          "present": false
        },
        {
          "value": 22.0,
          "factor": "bmi",
          "points": 0,
          "present": true
        },
        {
          "factor": "physically_active",
          "points": -1,
          "present": true
        }
      ],
      "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": "Bang H, Edwards AM, Bomback AS, Ballantyne CM, Brillon D, Callahan MA, Teutsch SM, Mushlin AI, Kern LM",
        "doi": "10.7326/0003-4819-151-11-200912010-00005",
        "id": "bang-2009",
        "pmid": "19949143",
        "source": "Ann Intern Med. 2009;151(11):775-783",
        "title": "Development and validation of a patient self-assessment score for diabetes risk"
      },
      "formula": "ada_diabetes",
      "formula_expression": "score = age + sex + family_history_diabetes + hypertension + obesity + physically_active; age <40 -> 0, 40-49 -> 1, 50-59 -> 2, >=60 -> 3; female 0, male 1; family history yes 1; hypertension yes 1; BMI >=40 -> 3, 30 <= BMI < 40 -> 2, 25 <= BMI < 30 -> 1, else 0; physically_active yes -> -1; high_risk iff score>=5; Bang 2009 Table 2 development scores",
      "age_years": 40,
      "max_score": 9,
      "score": 0,
      "sex": "female",
      "bmi_kg_m2": 22.0,
      "high_risk": false
    }
  ]
}

Response

Field Type Description
formula string ada_diabetes
formula_expression string Exact Bang 2009 Table 2 development expression
score integer Bang 2009 Table 2 points; published range -1 to 9
max_score integer 9 (sum of positive Table 2 maxima)
high_risk boolean true iff score ≥5 (Bang 2009 chosen cutpoint for undiagnosed diabetes). Not a diabetes diagnosis. A prediabetes cutpoint of 4 is not implemented.
age_years integer Age in years used for the age band
bmi_kg_m2 number Caller-supplied BMI in kg/m^2 used for the obesity band
sex string female or male, used for the sex points
components array Per-factor points
citation object Bang 2009 Annals of Internal Medicine citation
disclaimer string Not-a-device notice

Example JSON

Machine form of the same example. Frozen fixture. Not a live lookup.

{
  "components": [
    {
      "value": 40,
      "factor": "age",
      "points": 1,
      "present": true
    },
    {
      "value": "female",
      "factor": "sex",
      "points": 0,
      "present": false
    },
    {
      "factor": "family_history_diabetes",
      "points": 0,
      "present": false
    },
    {
      "factor": "hypertension",
      "points": 0,
      "present": false
    },
    {
      "value": 22.0,
      "factor": "bmi",
      "points": 0,
      "present": true
    },
    {
      "factor": "physically_active",
      "points": -1,
      "present": true
    }
  ],
  "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": "Bang H, Edwards AM, Bomback AS, Ballantyne CM, Brillon D, Callahan MA, Teutsch SM, Mushlin AI, Kern LM",
    "doi": "10.7326/0003-4819-151-11-200912010-00005",
    "id": "bang-2009",
    "pmid": "19949143",
    "source": "Ann Intern Med. 2009;151(11):775-783",
    "title": "Development and validation of a patient self-assessment score for diabetes risk"
  },
  "formula": "ada_diabetes",
  "formula_expression": "score = age + sex + family_history_diabetes + hypertension + obesity + physically_active; age <40 -> 0, 40-49 -> 1, 50-59 -> 2, >=60 -> 3; female 0, male 1; family history yes 1; hypertension yes 1; BMI >=40 -> 3, 30 <= BMI < 40 -> 2, 25 <= BMI < 30 -> 1, else 0; physically_active yes -> -1; high_risk iff score>=5; Bang 2009 Table 2 development scores",
  "age_years": 40,
  "max_score": 9,
  "score": 0,
  "sex": "female",
  "bmi_kg_m2": 22.0,
  "high_risk": false
}

Client errors (HTTP 400)

Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.

HTTP Code When
400 invalid_ada_diabetes ADA diabetes screening-score inputs must be numeric age 20-120, sex, BMI, and the Bang 2009 family-history, hypertension, and physical-activity flags. Returned before settlement; you are not charged.
400 invalid_sex sex must be female or male Returned before settlement; you are not charged.
400 invalid_bmi_kg_m2 bmi_kg_m2 must be a number from 10 to 80. Returned before settlement; you are not charged.
400 invalid_flag boolean clinical flags must be true or false 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

  • 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.
  • Cambridge diabetes — Compute the Griffin 2000 Cambridge logistic probability of undetected type 2 diabetes from age, sex, BMI, prescribed antihypertensive medication, prescribed steroids, first-degree family history, and smoking.

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.