Neurology · LIVE
ABCD2 calculator x402 API for agents
ABCD2 score
Compute the ABCD2 score as age, blood pressure, caller-assigned clinical features, symptom duration, and diabetes.
Markdown: /docs/abcd2.md · Canonical: https://magentlab.com/docs/abcd2
Not a medical device. Not a diagnosis or dosing recommendation.
What it computes
Compute the ABCD2 score as age, blood pressure, caller-assigned clinical features, symptom duration, and diabetes.
When to use
Returns the published Johnston 2007 ABCD2 total.
When not to use
- Not a diagnosis or admit protocol. Magent does not diagnose TIA.
- This is ABCD2 (Johnston 2007), not ABCD (Rothwell 2005 only) and not ABCD3-I.
- clinical_features is a caller-assigned enum (none, speech_without_weakness, or unilateral_weakness). Magent does not examine the patient.
Formula
ABCD2 = age_ge_60 + blood_pressure + clinical_features + duration + diabetes; age >=60 1; SBP >=140 or DBP >=90 1; none 0 / speech_without_weakness 1 / unilateral_weakness 2; duration <10 0, 10-59 1, >=60 2; diabetes 1; bands 0-3 / 4-5 / 6-7; max 7
Citation
- Authors
- Johnston SC, Rothwell PM, Nguyen-Huynh MN, et al.
- Source
- Lancet. 2007;369(9558):283-292
Worked example
Age 55, normal BP, no features, 5 minutes, no diabetes
Given:
age=55clinical_features=nonediabetes=falsediastolic_mm_hg=80duration_min=5systolic_mm_hg=120
- Age 55 (<60) → 0; BP 120/80 → 0; clinical none → 0; duration 5 → 0; diabetes false → 0
- Score = 0; band 0-3
Also searched as
- ABCD2 score
- ABCD2 TIA score
- Johnston ABCD2
- TIA stroke risk score
- ABCD 2
- transient ischaemic attack ABCD2
- very early stroke risk after TIA
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/abcd2?age=55&systolic_mm_hg=120&diastolic_mm_hg=80&clinical_features=none&duration_min=5&diabetes=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/abcd2?age=55&systolic_mm_hg=120&diastolic_mm_hg=80&clinical_features=none&duration_min=5&diabetes=false"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
age |
integer | required | Age in years (18-120). Age ≥60 scores 1; 59 scores 0. |
systolic_mm_hg |
number | required | Cuff systolic blood pressure in mm Hg (50-250). ≥140 scores 1. |
diastolic_mm_hg |
number | required | Cuff diastolic blood pressure in mm Hg (20-160). Must be less than systolic. ≥90 scores 1. |
clinical_features |
string | required | Caller-assigned TIA features. none scores 0; speech_without_weakness scores 1; unilateral_weakness scores 2. Mutually exclusive. magent does not examine the patient. |
duration_min |
integer | required | Symptom duration in minutes (integer 0-1440). Under 10 scores 0; 10-59 scores 1; 60 or more scores 2. |
diabetes |
boolean | required | Diabetes mellitus. true scores 1; false 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": [
{
"age": "55",
"clinical_features": "none",
"diabetes": "false",
"diastolic_mm_hg": "80",
"duration_min": "5",
"systolic_mm_hg": "120"
},
{
"age": "55",
"clinical_features": "none",
"diabetes": "false",
"diastolic_mm_hg": "80",
"duration_min": "5",
"systolic_mm_hg": "120"
}
]
}
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/abcd2",
"items": [
{
"components": [
{
"value": 55,
"factor": "age",
"points": 0,
"present": false
},
{
"factor": "blood_pressure",
"points": 0,
"diastolic_mm_hg": 80.0,
"systolic_mm_hg": 120.0,
"present": false
},
{
"value": "none",
"factor": "clinical_features",
"points": 0,
"present": false
},
{
"value": 5,
"factor": "duration_min",
"points": 0,
"present": false
},
{
"factor": "diabetes",
"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": "Johnston SC, Rothwell PM, Nguyen-Huynh MN, et al.",
"doi": "10.1016/S0140-6736(07)60150-0",
"id": "johnston-2007",
"source": "Lancet. 2007;369(9558):283-292",
"title": "Validation and refinement of scores to predict very early stroke risk after transient ischaemic attack"
},
"formula": "abcd2",
"formula_expression": "ABCD2 = age_ge_60 + blood_pressure + clinical_features + duration + diabetes; age >=60 1; SBP >=140 or DBP >=90 1; none 0 / speech_without_weakness 1 / unilateral_weakness 2; duration <10 0, 10-59 1, >=60 2; diabetes 1; bands 0-3 / 4-5 / 6-7; max 7",
"max_score": 7,
"score": 0,
"abcd2_band": "0-3",
"age_years": 55
},
{
"components": [
{
"value": 55,
"factor": "age",
"points": 0,
"present": false
},
{
"factor": "blood_pressure",
"points": 0,
"diastolic_mm_hg": 80.0,
"systolic_mm_hg": 120.0,
"present": false
},
{
"value": "none",
"factor": "clinical_features",
"points": 0,
"present": false
},
{
"value": 5,
"factor": "duration_min",
"points": 0,
"present": false
},
{
"factor": "diabetes",
"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": "Johnston SC, Rothwell PM, Nguyen-Huynh MN, et al.",
"doi": "10.1016/S0140-6736(07)60150-0",
"id": "johnston-2007",
"source": "Lancet. 2007;369(9558):283-292",
"title": "Validation and refinement of scores to predict very early stroke risk after transient ischaemic attack"
},
"formula": "abcd2",
"formula_expression": "ABCD2 = age_ge_60 + blood_pressure + clinical_features + duration + diabetes; age >=60 1; SBP >=140 or DBP >=90 1; none 0 / speech_without_weakness 1 / unilateral_weakness 2; duration <10 0, 10-59 1, >=60 2; diabetes 1; bands 0-3 / 4-5 / 6-7; max 7",
"max_score": 7,
"score": 0,
"abcd2_band": "0-3",
"age_years": 55
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | abcd2 |
formula_expression |
string | Exact expression used |
score |
integer | Total points 0-7 |
max_score |
integer | Always 7 |
abcd2_band |
string | 0-3, 4-5, or 6-7 (Johnston 2007) |
age_years |
integer | Age used for the ≥60 criterion |
components |
array | Per-factor points |
citation |
object | Johnston 2007 citation |
disclaimer |
string | Not-a-device notice |
Example JSON
Machine form of the same example. Frozen fixture. Not a live lookup.
{
"components": [
{
"value": 55,
"factor": "age",
"points": 0,
"present": false
},
{
"factor": "blood_pressure",
"points": 0,
"diastolic_mm_hg": 80.0,
"systolic_mm_hg": 120.0,
"present": false
},
{
"value": "none",
"factor": "clinical_features",
"points": 0,
"present": false
},
{
"value": 5,
"factor": "duration_min",
"points": 0,
"present": false
},
{
"factor": "diabetes",
"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": "Johnston SC, Rothwell PM, Nguyen-Huynh MN, et al.",
"doi": "10.1016/S0140-6736(07)60150-0",
"id": "johnston-2007",
"source": "Lancet. 2007;369(9558):283-292",
"title": "Validation and refinement of scores to predict very early stroke risk after transient ischaemic attack"
},
"formula": "abcd2",
"formula_expression": "ABCD2 = age_ge_60 + blood_pressure + clinical_features + duration + diabetes; age >=60 1; SBP >=140 or DBP >=90 1; none 0 / speech_without_weakness 1 / unilateral_weakness 2; duration <10 0, 10-59 1, >=60 2; diabetes 1; bands 0-3 / 4-5 / 6-7; max 7",
"max_score": 7,
"score": 0,
"abcd2_band": "0-3",
"age_years": 55
}
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_systolic_bp |
systolic_mm_hg or systolic_bp_mm_hg must be a number from 50 to 250. Returned before settlement; you are not charged. |
| 400 | invalid_diastolic_bp |
diastolic_mm_hg must be a number from 20 to 160. Returned before settlement; you are not charged. |
| 400 | invalid_pulse_pressure |
diastolic_mm_hg must be less than systolic_mm_hg. Returned before settlement; you are not charged. |
| 400 | invalid_abcd2_clinical |
clinical_features must be none, speech_without_weakness, or unilateral_weakness. Returned before settlement; you are not charged. |
| 400 | invalid_duration_min |
duration_min must be an integer from 0 to 1440. 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
- Glasgow Coma Scale — Compute the Glasgow Coma Scale as the sum of caller-assigned eye, verbal, and motor integers. The 1974 or 1976 edition is required.
- CHA2DS2-VASc — Returns the Lip 2010 CHA2DS2-VASc stroke-risk score from discrete clinical flags; cites Lip et al., Chest 2010.
- NIHSS — Sum Brott 1989 NIH stroke scale points from 15 caller-assigned examination integers, including pupillary response and plantar reflex. Weaker-limb motor arm and leg. Does not apply later total-score severity bands.
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.
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.