Electrolytes / glucose · LIVE
CANRISK Canadian diabetes risk score
CANRISK
Sum the Robinson 2011 Table 3 paper-based CANRISK (pCANRISK) integer points and return the published screening thresholds at scores 21, 29, 32, 33, and 43.
Markdown: /docs/canrisk.md · Canonical: https://magentlab.com/docs/canrisk
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
Sum the Robinson 2011 Table 3 paper-based CANRISK (pCANRISK) integer points and return the published screening thresholds at scores 21, 29, 32, 33, and 43.
When to use
When an agent needs the published pCANRISK point total and must not invent a type 2 diabetes diagnosis, eCANRISK logistic betas, FINDRISC, or AUSDRISK.
When not to use
- Not a medical device. magent does not diagnose type 2 diabetes or assay glucose.
- Robinson 2011 Table 3 pCANRISK integer points only. Not eCANRISK logistic betas. Not FINDRISC. Not AUSDRISK.
- Published screening thresholds are score ≥21, ≥29, ≥32 (balanced), ≥33, and ≥43 (Table 5 / Figure 4). They overlap; they are not exclusive risk bins and not a diabetes diagnosis.
- Ethnicity is caller-assigned using the paper's terms (White, Aboriginal, Black, East Asian, South Asian, Latin American, Other). magent does not assign ethnicity. Table 3 assigned no pCANRISK points to Latin American or Other (statistically insignificant); those tokens score 0.
- Family history is the count of first-degree relative categories (mother, father, sibling, child), 2 points each, not second-degree relatives. Macrosomia is a birth ≥4.1 kg and is N/A (0) for male. BMI is caller-supplied kg/m^2. Max 81 female / 86 male. Female waist 80-88 cm scores 4, so a 40-year-old White woman with BMI 22 and waist 80 cm scores 4, not 0.
Formula
pCANRISK = age + sex + bmi + waist + inactivity + no_daily_fruit_veg + high_bp + high_glucose + macrosomia + family_history + ethnicity + education; age <45 -> 0, 45-54 -> 7, 55-64 -> 13, >=65 -> 15; male 6; BMI <25 -> 0, 25-29.9 -> 4, 30-34.9 -> 9, >=35 -> 14; waist men <94 -> 0, 94-102 -> 4, >102 -> 6; women <80 -> 0, 80-88 -> 4, >88 -> 6; inactivity 1; no daily fruit/veg 2; high_bp 4; high_glucose 14; macrosomia women 1 else N/A 0; family_history_count 0-4 first-degree categories * 2; ethnicity white 0 aboriginal 3 black 5 east_asian 10 south_asian 11 latin_american 0 other 0 (caller-assigned; Table 3 assigned no pCANRISK points to Latin American or Other); education less_than_high_school 5 high_school 1 some_college or university 0; max 81 female / 86 male; Robinson 2011 Table 3 pCANRISK not eCANRISK; published cutoffs score>=21 29 32 33 43
Citation
- Authors
- Robinson CA, Agarwal G, Nerenberg K
- Source
- Chronic Dis Inj Can. 2011;32(1):19-31
Worked example
40-year-old White woman, BMI 22, waist 80 cm
Given:
activity_30min=trueage=40bmi_kg_m2=22daily_fruit_veg=trueeducation=universityethnicity=whitefamily_history_count=0high_bp=falsehigh_glucose=falsemacrosomia=falsesex=femalewaist_cm=80
- Age 40 (19-44) → 0; female → 0; BMI 22 <25 → 0; female waist 80 (80-88) → 4
- Daily 30 min activity → 0; daily fruit/vegetables → 0; no high BP → 0; no high glucose → 0; no macrosomia → 0; family count 0 → 0; White → 0; university → 0
- Score = 4 (published max 81 female); all Table 5 cutoffs false. Not a diagnosis.
Paper example: 58-year-old White man, one first-degree relative
Given:
activity_30min=trueage=58bmi_kg_m2=22daily_fruit_veg=trueeducation=universityethnicity=whitefamily_history_count=1high_bp=falsehigh_glucose=falsemacrosomia=falsesex=malewaist_cm=80
- Age 58 (55-64) → 13; male → 6; one first-degree category → 2; remaining items 0
- Score = 21; score_ge_21 true (Table 5 slightly elevated). Not a diagnosis.
Balanced cutoff 32 (age ≥65, high glucose, inactivity, no daily fruit/veg)
Given:
activity_30min=falseage=65bmi_kg_m2=22daily_fruit_veg=falseeducation=universityethnicity=whitefamily_history_count=0high_bp=falsehigh_glucose=truemacrosomia=falsesex=femalewaist_cm=79
- Age 65 → 15; high_glucose → 14; inactivity → 1; no daily fruit/veg → 2; female waist 79 <80 → 0
- Score = 32; score_ge_32 true (Table 5 balanced cutoff). Not a diagnosis.
Also searched as
- CANRISK
- pCANRISK
- Canadian diabetes risk
- Robinson CANRISK
- Canadian Diabetes Risk Assessment Questionnaire
- paper-based CANRISK
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/canrisk?age=40&sex=female&bmi_kg_m2=22&waist_cm=80&activity_30min=true&daily_fruit_veg=true&high_bp=false&high_glucose=false¯osomia=false&family_history_count=0ðnicity=white&education=university
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/canrisk?age=40&sex=female&bmi_kg_m2=22&waist_cm=80&activity_30min=true&daily_fruit_veg=true&high_bp=false&high_glucose=false¯osomia=false&family_history_count=0ðnicity=white&education=university"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
age |
integer | required | Age in years (18-120). Robinson 2011 Table 3 pCANRISK: 19-44 scores 0; magent scores 18-44 as 0. 45-54 scores 7; 55-64 scores 13; 65-78 scores 15; magent scores ≥65 as 15. Age 44 scores 0; 45 and 54 score 7; 55 and 64 score 13; 65 scores 15. |
sex |
string | required · female, male | female or male. Robinson 2011 Table 3: female scores 0; male scores 6. Selects the sex-specific waist bands. Macrosomia is N/A for male (0). |
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. Robinson 2011 Table 3: <25 scores 0; 25-29.9 scores 4; 30-34.9 scores 9; ≥35 scores 14. 25.0 and 29.9 score 4; 30.0 and 34.9 score 9; 35.0 scores 14. |
waist_cm |
number | required | Waist circumference in cm (40-200). Robinson 2011 Table 3 men: <94 scores 0; 94-102 scores 4; >102 scores 6. Women: <80 scores 0; 80-88 scores 4; >88 scores 6. 94 and 102 (men) and 80 and 88 (women) score 4. |
activity_30min |
boolean | required | Usually at least 30 minutes of physical activity daily (Robinson 2011 Table 3). true scores 0; false scores 1. Caller-assigned; magent does not measure activity. |
daily_fruit_veg |
boolean | required | Eats fruit or vegetables every day (Robinson 2011 Table 3). true scores 0; false scores 2. |
high_bp |
boolean | required | History of high blood pressure (Robinson 2011 Table 3). true scores 4; false scores 0. magent does not measure blood pressure. |
high_glucose |
boolean | required | History of high blood glucose (Robinson 2011 Table 3). Caller-assigned; magent does not assay glucose. true scores 14; false scores 0. |
macrosomia |
boolean | required | Gave birth to a baby weighing 4.1 kg or more (Robinson 2011 Table 3 macrosomia, women). true scores 1 for female; false or male (N/A) scores 0. |
family_history_count |
integer | required | Count of first-degree relative categories with diabetes: mother, father, sibling, child (Robinson 2011 Table 3 footnote g). Integer 0-4. Each category scores 2 (0, 2, 4, 6, or 8). Not second-degree relatives. magent does not take named relatives. |
ethnicity |
string | required · white, aboriginal, black, east_asian, south_asian, latin_american, other | Caller-assigned ethnicity using Robinson 2011 Table 3 terms. white scores 0; aboriginal 3; black 5; east_asian 10; south_asian 11. latin_american and other score 0 (Table 3 assigned no pCANRISK points; both were statistically insignificant). magent does not assign ethnicity. |
education |
string | required · less_than_high_school, high_school, some_college, university | Highest education completed (Robinson 2011 Table 3). less_than_high_school scores 5; high_school scores 1; some_college or university scores 0. |
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": [
{
"activity_30min": "true",
"age": "40",
"bmi_kg_m2": "22",
"daily_fruit_veg": "true",
"education": "university",
"ethnicity": "white",
"family_history_count": "0",
"high_bp": "false",
"high_glucose": "false",
"macrosomia": "false",
"sex": "female",
"waist_cm": "80"
},
{
"activity_30min": "true",
"age": "40",
"bmi_kg_m2": "22",
"daily_fruit_veg": "true",
"education": "university",
"ethnicity": "white",
"family_history_count": "0",
"high_bp": "false",
"high_glucose": "false",
"macrosomia": "false",
"sex": "female",
"waist_cm": "80"
}
]
}
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/canrisk",
"items": [
{
"components": [
{
"value": 40,
"factor": "age",
"points": 0,
"present": false
},
{
"value": "female",
"factor": "sex",
"points": 0,
"present": false
},
{
"value": 22.0,
"factor": "bmi",
"points": 0,
"present": false
},
{
"value": 80.0,
"factor": "waist",
"points": 4,
"present": true
},
{
"factor": "inactivity",
"points": 0,
"present": false
},
{
"factor": "no_daily_fruit_veg",
"points": 0,
"present": false
},
{
"factor": "high_bp",
"points": 0,
"present": false
},
{
"factor": "high_glucose",
"points": 0,
"present": false
},
{
"factor": "macrosomia",
"points": 0,
"present": false
},
{
"value": 0,
"factor": "family_history",
"points": 0,
"present": false
},
{
"value": "white",
"factor": "ethnicity",
"points": 0,
"present": false
},
{
"value": "university",
"factor": "education",
"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": "Robinson CA, Agarwal G, Nerenberg K",
"doi": "10.24095/hpcdp.32.1.04",
"id": "robinson-2011-canrisk",
"pmid": "22153173",
"source": "Chronic Dis Inj Can. 2011;32(1):19-31",
"title": "Validating the CANRISK prognostic model for assessing diabetes risk in Canada's multi-ethnic population"
},
"formula": "canrisk",
"formula_expression": "pCANRISK = age + sex + bmi + waist + inactivity + no_daily_fruit_veg + high_bp + high_glucose + macrosomia + family_history + ethnicity + education; age <45 -> 0, 45-54 -> 7, 55-64 -> 13, >=65 -> 15; male 6; BMI <25 -> 0, 25-29.9 -> 4, 30-34.9 -> 9, >=35 -> 14; waist men <94 -> 0, 94-102 -> 4, >102 -> 6; women <80 -> 0, 80-88 -> 4, >88 -> 6; inactivity 1; no daily fruit/veg 2; high_bp 4; high_glucose 14; macrosomia women 1 else N/A 0; family_history_count 0-4 first-degree categories * 2; ethnicity white 0 aboriginal 3 black 5 east_asian 10 south_asian 11 latin_american 0 other 0 (caller-assigned; Table 3 assigned no pCANRISK points to Latin American or Other); education less_than_high_school 5 high_school 1 some_college or university 0; max 81 female / 86 male; Robinson 2011 Table 3 pCANRISK not eCANRISK; published cutoffs score>=21 29 32 33 43",
"max_score": 81,
"score": 4,
"age_years": 40,
"sex": "female",
"bmi_kg_m2": 22.0,
"waist_cm": 80.0,
"education": "university",
"ethnicity": "white",
"family_history_count": 0,
"score_ge_21": false,
"score_ge_29": false,
"score_ge_32": false,
"score_ge_33": false,
"score_ge_43": false
},
{
"components": [
{
"value": 40,
"factor": "age",
"points": 0,
"present": false
},
{
"value": "female",
"factor": "sex",
"points": 0,
"present": false
},
{
"value": 22.0,
"factor": "bmi",
"points": 0,
"present": false
},
{
"value": 80.0,
"factor": "waist",
"points": 4,
"present": true
},
{
"factor": "inactivity",
"points": 0,
"present": false
},
{
"factor": "no_daily_fruit_veg",
"points": 0,
"present": false
},
{
"factor": "high_bp",
"points": 0,
"present": false
},
{
"factor": "high_glucose",
"points": 0,
"present": false
},
{
"factor": "macrosomia",
"points": 0,
"present": false
},
{
"value": 0,
"factor": "family_history",
"points": 0,
"present": false
},
{
"value": "white",
"factor": "ethnicity",
"points": 0,
"present": false
},
{
"value": "university",
"factor": "education",
"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": "Robinson CA, Agarwal G, Nerenberg K",
"doi": "10.24095/hpcdp.32.1.04",
"id": "robinson-2011-canrisk",
"pmid": "22153173",
"source": "Chronic Dis Inj Can. 2011;32(1):19-31",
"title": "Validating the CANRISK prognostic model for assessing diabetes risk in Canada's multi-ethnic population"
},
"formula": "canrisk",
"formula_expression": "pCANRISK = age + sex + bmi + waist + inactivity + no_daily_fruit_veg + high_bp + high_glucose + macrosomia + family_history + ethnicity + education; age <45 -> 0, 45-54 -> 7, 55-64 -> 13, >=65 -> 15; male 6; BMI <25 -> 0, 25-29.9 -> 4, 30-34.9 -> 9, >=35 -> 14; waist men <94 -> 0, 94-102 -> 4, >102 -> 6; women <80 -> 0, 80-88 -> 4, >88 -> 6; inactivity 1; no daily fruit/veg 2; high_bp 4; high_glucose 14; macrosomia women 1 else N/A 0; family_history_count 0-4 first-degree categories * 2; ethnicity white 0 aboriginal 3 black 5 east_asian 10 south_asian 11 latin_american 0 other 0 (caller-assigned; Table 3 assigned no pCANRISK points to Latin American or Other); education less_than_high_school 5 high_school 1 some_college or university 0; max 81 female / 86 male; Robinson 2011 Table 3 pCANRISK not eCANRISK; published cutoffs score>=21 29 32 33 43",
"max_score": 81,
"score": 4,
"age_years": 40,
"sex": "female",
"bmi_kg_m2": 22.0,
"waist_cm": 80.0,
"education": "university",
"ethnicity": "white",
"family_history_count": 0,
"score_ge_21": false,
"score_ge_29": false,
"score_ge_32": false,
"score_ge_33": false,
"score_ge_43": false
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | canrisk |
formula_expression |
string | Exact Robinson 2011 Table 3 pCANRISK expression |
score |
integer | pCANRISK points; published maxima 81 female / 86 male |
max_score |
integer | 81 if female, 86 if male (Robinson 2011 published maxima) |
score_ge_21 |
boolean | true iff score ≥21 (Table 5 / Figure 4 slightly elevated vs FINDRISC). Screening threshold, not an exclusive band and not a diabetes diagnosis. |
score_ge_29 |
boolean | true iff score ≥29 (Table 5 / Figure 4 moderate vs FINDRISC). Screening threshold, not an exclusive band. |
score_ge_32 |
boolean | true iff score ≥32 (Table 5 balanced / optimal cutoff). Screening threshold, not a diabetes diagnosis. |
score_ge_33 |
boolean | true iff score ≥33 (Table 5 / Figure 4 high vs FINDRISC). Screening threshold, not an exclusive band. |
score_ge_43 |
boolean | true iff score ≥43 (Table 5 / Figure 4 very high vs FINDRISC). Screening threshold, not an exclusive band. |
age_years |
integer | Age in years used for the age band |
sex |
string | female or male, used for sex points and waist |
bmi_kg_m2 |
number | Caller-supplied BMI in kg/m^2 used for the BMI band |
waist_cm |
number | Waist circumference in cm used |
ethnicity |
string | white, aboriginal, black, east_asian, south_asian, latin_american, or other |
education |
string | less_than_high_school, high_school, some_college, or university |
family_history_count |
integer | Count of first-degree relative categories (0-4) used |
components |
array | Per-factor points |
citation |
object | Robinson 2011 Chronic Diseases and Injuries in Canada 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": 0,
"present": false
},
{
"value": "female",
"factor": "sex",
"points": 0,
"present": false
},
{
"value": 22.0,
"factor": "bmi",
"points": 0,
"present": false
},
{
"value": 80.0,
"factor": "waist",
"points": 4,
"present": true
},
{
"factor": "inactivity",
"points": 0,
"present": false
},
{
"factor": "no_daily_fruit_veg",
"points": 0,
"present": false
},
{
"factor": "high_bp",
"points": 0,
"present": false
},
{
"factor": "high_glucose",
"points": 0,
"present": false
},
{
"factor": "macrosomia",
"points": 0,
"present": false
},
{
"value": 0,
"factor": "family_history",
"points": 0,
"present": false
},
{
"value": "white",
"factor": "ethnicity",
"points": 0,
"present": false
},
{
"value": "university",
"factor": "education",
"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": "Robinson CA, Agarwal G, Nerenberg K",
"doi": "10.24095/hpcdp.32.1.04",
"id": "robinson-2011-canrisk",
"pmid": "22153173",
"source": "Chronic Dis Inj Can. 2011;32(1):19-31",
"title": "Validating the CANRISK prognostic model for assessing diabetes risk in Canada's multi-ethnic population"
},
"formula": "canrisk",
"formula_expression": "pCANRISK = age + sex + bmi + waist + inactivity + no_daily_fruit_veg + high_bp + high_glucose + macrosomia + family_history + ethnicity + education; age <45 -> 0, 45-54 -> 7, 55-64 -> 13, >=65 -> 15; male 6; BMI <25 -> 0, 25-29.9 -> 4, 30-34.9 -> 9, >=35 -> 14; waist men <94 -> 0, 94-102 -> 4, >102 -> 6; women <80 -> 0, 80-88 -> 4, >88 -> 6; inactivity 1; no daily fruit/veg 2; high_bp 4; high_glucose 14; macrosomia women 1 else N/A 0; family_history_count 0-4 first-degree categories * 2; ethnicity white 0 aboriginal 3 black 5 east_asian 10 south_asian 11 latin_american 0 other 0 (caller-assigned; Table 3 assigned no pCANRISK points to Latin American or Other); education less_than_high_school 5 high_school 1 some_college or university 0; max 81 female / 86 male; Robinson 2011 Table 3 pCANRISK not eCANRISK; published cutoffs score>=21 29 32 33 43",
"max_score": 81,
"score": 4,
"age_years": 40,
"sex": "female",
"bmi_kg_m2": 22.0,
"waist_cm": 80.0,
"education": "university",
"ethnicity": "white",
"family_history_count": 0,
"score_ge_21": false,
"score_ge_29": false,
"score_ge_32": false,
"score_ge_33": false,
"score_ge_43": false
}
Client errors (HTTP 400)
Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_age |
age must be an integer from 18 to 120 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_flag |
boolean clinical flags must be true or false Returned before settlement; you are not charged. |
| 400 | invalid_canrisk |
CANRISK inputs must match Robinson 2011 pCANRISK age, sex, BMI, waist, activity, diet, BP, glucose, macrosomia, family history, ethnicity, and education. 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.
- AUSDRISK — Sum the Chen 2010 AUSDRISK Box 3 questionnaire points (waist model) and return at_risk when the total is ≥12.
- Bang diabetes screening — Sum the Bang 2009 Table 2 development screening score for undiagnosed diabetes and return high_risk when the total is ≥5.
- 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.