GI · LIVE
Crohn's disease activity index (CDAI)
CDAI
Compute the Best 1976 Crohn's disease activity index from eight caller-assigned variables and return the rounded integer score. Does not return later trial activity bands.
Markdown: /docs/cdai.md · Canonical: https://magentlab.com/docs/cdai
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
Compute the Best 1976 Crohn's disease activity index from eight caller-assigned variables and return the rounded integer score. Does not return later trial activity bands.
When to use
When an agent already has Best 1976 seven-day stool, pain, and well-being sums, extra-intestinal count, antidiarrheal flag, abdominal mass (0/2/5), hematocrit, sex, and caller-assigned weight-percent deviation and needs the weighted index, not a Crohn's diagnosis, Harvey-Bradshaw one-day index, or later trial cutoffs.
When not to use
- Not a medical device and not a Crohn's diagnosis or a treatment order.
- magent does not examine the patient. Seven-day sums, extra-intestinal count, antidiarrheal use, abdominal mass, hematocrit, and weight-percent deviation are caller-assigned.
- Abdominal mass is Best 1976 0 (none), 2 (questionable), or 5 (definite), not 1/3/4. Extra-intestinal count is 0-6; magent does not enumerate the six findings as separate params.
- magent returns the integer index only and does not apply later trial activity bands. Liquid-stool 0-70, hematocrit 10-70, and weight-percent -50 to 80 are magent clamps, not published maxima.
Formula
CDAI = liquid_stool_count_7d*2 + abdominal_pain_sum_7d*5 + wellbeing_sum_7d*7 + extra_intestinal_count*20 + taking_antidiarrheal*30 + abdominal_mass*10 + hematocrit_deficit*6 + weight_percent_deviation; hematocrit_deficit = 47-hematocrit_percent (male) or 42-hematocrit_percent (female); Best 1976; score rounded after the weight term
Citation
- Authors
- Best WR, Becktel JM, Singleton JW, Kern F Jr
- Source
- Gastroenterology. 1976;70(3):439-444
Worked example
Male, clinical zeros, hematocrit 47, weight deviation 0
Given:
abdominal_mass=0abdominal_pain_sum_7d=0extra_intestinal_count=0hematocrit_percent=47liquid_stool_count_7d=0sex=maletaking_antidiarrheal=falseweight_percent_deviation=0wellbeing_sum_7d=0
- liquid stools 0×2 + pain 0×5 + well-being 0×7 + extra-intestinal 0×20 + antidiarrheal 0 + mass 0×10 + (47-47)×6 + 0
- Score = 0. No activity band.
Also searched as
- Crohn's Disease Activity Index
- CDAI
- Best CDAI
- National Cooperative Crohn's Disease Study
- Crohn's activity index
- Best 1976 CDAI
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/cdai?sex=male&liquid_stool_count_7d=0&abdominal_pain_sum_7d=0&wellbeing_sum_7d=0&extra_intestinal_count=0&taking_antidiarrheal=false&abdominal_mass=0&hematocrit_percent=47&weight_percent_deviation=0
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/cdai?sex=male&liquid_stool_count_7d=0&abdominal_pain_sum_7d=0&wellbeing_sum_7d=0&extra_intestinal_count=0&taking_antidiarrheal=false&abdominal_mass=0&hematocrit_percent=47&weight_percent_deviation=0"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
sex |
string | required | male or female. Best 1976 hematocrit standard is 47 (male) or 42 (female). magent does not examine the patient. |
liquid_stool_count_7d |
integer | required | Sum of liquid or very soft stools over 7 days (Best 1976; ×2). Integer 0-70 is a magent clamp, not a published maximum. magent does not count stools. |
abdominal_pain_sum_7d |
integer | required | Sum of daily Best 1976 abdominal-pain ratings over 7 days (integer 0-21; each day 0 none, 1 mild, 2 moderate, 3 severe; ×5). magent does not examine the patient. |
wellbeing_sum_7d |
integer | required | Sum of daily Best 1976 general well-being ratings over 7 days (integer 0-28; each day 0 generally well, 1 slightly below par, 2 poor, 3 very poor, 4 terrible; ×7). magent does not examine the patient. |
extra_intestinal_count |
integer | required | Caller-assigned count 0-6 of Best 1976 extra-intestinal findings (one each: arthritis/arthralgia; iritis/uveitis; erythema nodosum/pyoderma gangrenosum/aphthous ulcer; anal fissure/fistula/abscess; other fistula; fever >37.8 C in the past week; ×20). magent takes the integer count and does not enumerate those names as separate params. |
taking_antidiarrheal |
boolean | required | Taking diphenoxylate/atropine (Lomotil) or opiates for diarrhea as in Best 1976. true or false. true scores 30. magent does not examine the patient. |
abdominal_mass |
integer | required | Caller-assigned Best 1976 abdominal mass (exactly 0 none, 2 questionable, or 5 definite; ×10). Not 1, 3, or 4. magent does not examine the patient. |
hematocrit_percent |
number | required | Hematocrit in percent (10-70). Best 1976 uses a whole-number hematocrit. Deficit is 47 minus this value (male) or 42 minus this value (female), then ×6; may be negative if above the sex standard. magent does not assay hematocrit. |
weight_percent_deviation |
number | required | Caller-assigned Best 1976 weight term 100*(1 - current/standard). May be negative if current is above standard. Magent clamp -50 to 80, not a published range. magent does not look up a standard weight. |
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": [
{
"abdominal_mass": "0",
"abdominal_pain_sum_7d": "0",
"extra_intestinal_count": "0",
"hematocrit_percent": "47",
"liquid_stool_count_7d": "0",
"sex": "male",
"taking_antidiarrheal": "false",
"weight_percent_deviation": "0",
"wellbeing_sum_7d": "0"
},
{
"abdominal_mass": "0",
"abdominal_pain_sum_7d": "0",
"extra_intestinal_count": "0",
"hematocrit_percent": "47",
"liquid_stool_count_7d": "0",
"sex": "male",
"taking_antidiarrheal": "false",
"weight_percent_deviation": "0",
"wellbeing_sum_7d": "0"
}
]
}
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/cdai",
"items": [
{
"components": [
{
"value": 0,
"factor": "liquid_stool_count_7d",
"points": 0,
"present": true
},
{
"value": 0,
"factor": "abdominal_pain_sum_7d",
"points": 0,
"present": true
},
{
"value": 0,
"factor": "wellbeing_sum_7d",
"points": 0,
"present": true
},
{
"value": 0,
"factor": "extra_intestinal_count",
"points": 0,
"present": true
},
{
"factor": "taking_antidiarrheal",
"points": 0,
"present": false
},
{
"value": 0,
"factor": "abdominal_mass",
"points": 0,
"present": true
},
{
"value": 0.0,
"factor": "hematocrit_deficit",
"points": 0.0,
"present": true
},
{
"value": 0.0,
"factor": "weight_percent_deviation",
"points": 0.0,
"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": "Best WR, Becktel JM, Singleton JW, Kern F Jr",
"doi": "10.1016/S0016-5085(76)80163-1",
"id": "best-1976",
"pmid": "1248701",
"source": "Gastroenterology. 1976;70(3):439-444",
"title": "Development of a Crohn's disease activity index. National Cooperative Crohn's Disease Study"
},
"formula": "cdai",
"formula_expression": "CDAI = liquid_stool_count_7d*2 + abdominal_pain_sum_7d*5 + wellbeing_sum_7d*7 + extra_intestinal_count*20 + taking_antidiarrheal*30 + abdominal_mass*10 + hematocrit_deficit*6 + weight_percent_deviation; hematocrit_deficit = 47-hematocrit_percent (male) or 42-hematocrit_percent (female); Best 1976; score rounded after the weight term",
"score": 0,
"hematocrit_percent": 47.0,
"sex": "male",
"abdominal_mass": 0,
"abdominal_pain_sum_7d": 0,
"extra_intestinal_count": 0,
"hematocrit_deficit": 0.0,
"liquid_stool_count_7d": 0,
"taking_antidiarrheal": false,
"weight_percent_deviation": 0.0,
"wellbeing_sum_7d": 0
},
{
"components": [
{
"value": 0,
"factor": "liquid_stool_count_7d",
"points": 0,
"present": true
},
{
"value": 0,
"factor": "abdominal_pain_sum_7d",
"points": 0,
"present": true
},
{
"value": 0,
"factor": "wellbeing_sum_7d",
"points": 0,
"present": true
},
{
"value": 0,
"factor": "extra_intestinal_count",
"points": 0,
"present": true
},
{
"factor": "taking_antidiarrheal",
"points": 0,
"present": false
},
{
"value": 0,
"factor": "abdominal_mass",
"points": 0,
"present": true
},
{
"value": 0.0,
"factor": "hematocrit_deficit",
"points": 0.0,
"present": true
},
{
"value": 0.0,
"factor": "weight_percent_deviation",
"points": 0.0,
"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": "Best WR, Becktel JM, Singleton JW, Kern F Jr",
"doi": "10.1016/S0016-5085(76)80163-1",
"id": "best-1976",
"pmid": "1248701",
"source": "Gastroenterology. 1976;70(3):439-444",
"title": "Development of a Crohn's disease activity index. National Cooperative Crohn's Disease Study"
},
"formula": "cdai",
"formula_expression": "CDAI = liquid_stool_count_7d*2 + abdominal_pain_sum_7d*5 + wellbeing_sum_7d*7 + extra_intestinal_count*20 + taking_antidiarrheal*30 + abdominal_mass*10 + hematocrit_deficit*6 + weight_percent_deviation; hematocrit_deficit = 47-hematocrit_percent (male) or 42-hematocrit_percent (female); Best 1976; score rounded after the weight term",
"score": 0,
"hematocrit_percent": 47.0,
"sex": "male",
"abdominal_mass": 0,
"abdominal_pain_sum_7d": 0,
"extra_intestinal_count": 0,
"hematocrit_deficit": 0.0,
"liquid_stool_count_7d": 0,
"taking_antidiarrheal": false,
"weight_percent_deviation": 0.0,
"wellbeing_sum_7d": 0
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | cdai |
formula_expression |
string | Exact expression used |
score |
integer | Best 1976 CDAI after rounding the sum (needed when the weight term is not an integer). No activity band. |
liquid_stool_count_7d |
integer | 7-day liquid/very-soft stool count used (×2) |
abdominal_pain_sum_7d |
integer | 7-day abdominal-pain rating sum used (×5) |
wellbeing_sum_7d |
integer | 7-day well-being rating sum used (×7) |
extra_intestinal_count |
integer | Caller-assigned extra-intestinal count 0-6 used (×20) |
taking_antidiarrheal |
boolean | Antidiarrheal flag used; 30 points if true |
abdominal_mass |
integer | Caller-assigned abdominal mass 0, 2, or 5 used (×10) |
sex |
string | male or female; selects the hematocrit standard |
hematocrit_percent |
number | Hematocrit percent used |
hematocrit_deficit |
number | 47-hematocrit_percent (male) or 42-hematocrit_percent (female); ×6 |
weight_percent_deviation |
number | Caller-assigned 100*(1 - current/standard) used (×1) |
components |
array | Per-variable weighted points |
citation |
object | Best et al. Gastroenterology 1976 citation |
disclaimer |
string | Not-a-device notice |
Example JSON
Machine form of the same example. Frozen fixture. Not a live lookup.
{
"components": [
{
"value": 0,
"factor": "liquid_stool_count_7d",
"points": 0,
"present": true
},
{
"value": 0,
"factor": "abdominal_pain_sum_7d",
"points": 0,
"present": true
},
{
"value": 0,
"factor": "wellbeing_sum_7d",
"points": 0,
"present": true
},
{
"value": 0,
"factor": "extra_intestinal_count",
"points": 0,
"present": true
},
{
"factor": "taking_antidiarrheal",
"points": 0,
"present": false
},
{
"value": 0,
"factor": "abdominal_mass",
"points": 0,
"present": true
},
{
"value": 0.0,
"factor": "hematocrit_deficit",
"points": 0.0,
"present": true
},
{
"value": 0.0,
"factor": "weight_percent_deviation",
"points": 0.0,
"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": "Best WR, Becktel JM, Singleton JW, Kern F Jr",
"doi": "10.1016/S0016-5085(76)80163-1",
"id": "best-1976",
"pmid": "1248701",
"source": "Gastroenterology. 1976;70(3):439-444",
"title": "Development of a Crohn's disease activity index. National Cooperative Crohn's Disease Study"
},
"formula": "cdai",
"formula_expression": "CDAI = liquid_stool_count_7d*2 + abdominal_pain_sum_7d*5 + wellbeing_sum_7d*7 + extra_intestinal_count*20 + taking_antidiarrheal*30 + abdominal_mass*10 + hematocrit_deficit*6 + weight_percent_deviation; hematocrit_deficit = 47-hematocrit_percent (male) or 42-hematocrit_percent (female); Best 1976; score rounded after the weight term",
"score": 0,
"hematocrit_percent": 47.0,
"sex": "male",
"abdominal_mass": 0,
"abdominal_pain_sum_7d": 0,
"extra_intestinal_count": 0,
"hematocrit_deficit": 0.0,
"liquid_stool_count_7d": 0,
"taking_antidiarrheal": false,
"weight_percent_deviation": 0.0,
"wellbeing_sum_7d": 0
}
Client errors (HTTP 400)
Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_sex |
sex must be female or male Returned before settlement; you are not charged. |
| 400 | invalid_cdai_stools |
liquid_stool_count_7d must be an integer from 0 to 70. Returned before settlement; you are not charged. |
| 400 | invalid_cdai_pain |
abdominal_pain_sum_7d must be an integer from 0 to 21. Returned before settlement; you are not charged. |
| 400 | invalid_cdai_wellbeing |
wellbeing_sum_7d must be an integer from 0 to 28. Returned before settlement; you are not charged. |
| 400 | invalid_cdai_complications |
extra_intestinal_count must be an integer from 0 to 6. 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_cdai_mass |
abdominal_mass must be 0, 2, or 5 (Best 1976). Returned before settlement; you are not charged. |
| 400 | invalid_hematocrit |
hematocrit_percent must be a number from 10 to 70. Returned before settlement; you are not charged. |
| 400 | invalid_cdai_weight |
weight_percent_deviation must be a number from -50 to 80. 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
- HBI — Sum Harvey 1980 simple-index items (previous-day well-being, abdominal pain, liquid stools, abdominal mass, and one point per listed complication) and return the total. Does not return later remission or activity bands.
- Mayo DAI — Sum four caller-assigned Schroeder 1987 ulcerative colitis disease-activity index items (each integer 0-3) and return the total (max 12). Does not return later remission or activity bands.
- PUCAI — Sum six caller-assigned Turner 2007 PUCAI item points and return the published total (max 85) with activity band.
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.