Liver · LIVE
BARD score (Harrison 2008)
BARD
Sum the Harrison 2008 BARD score (BMI ≥28, AST/ALT ≥0.8, diabetes) and return low (0–1) or high (2–4).
Markdown: /docs/bard.md · Canonical: https://magentlab.com/docs/bard
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
Sum the Harrison 2008 BARD score (BMI ≥28, AST/ALT ≥0.8, diabetes) and return low (0–1) or high (2–4).
When to use
When an agent has caller-supplied BMI, AST, ALT, and a diabetes flag for a patient already recognized as NAFLD and needs the published BARD total, not a NASH diagnosis, biopsy stage, FIB-4, APRI, or NAFLD fibrosis score.
When not to use
- Not a medical device and not a NASH diagnosis. magent does not interpret a biopsy.
- BMI is caller-supplied. magent does not compute BMI from height and weight in this tool.
- Harrison 2008 BARD only: BMI ≥28 (1), AST/ALT ≥0.8 (2), diabetes mellitus (1). Max 4. risk_group is the paper's 2–4 vs 0–1 split (low 0–1, high 2–4), not F0–F4 stages.
- A score of 2–4 was associated with OR 17 for advanced fibrosis and NPV 96% in Harrison 2008. NPV is not a biopsy result.
- Not the NAFLD fibrosis score, not FIB-4, and not APRI.
Formula
BARD = 1 if BMI >= 28 + 2 if AST/ALT >= 0.8 + 1 if diabetes; Harrison 2008; max 4; risk_group low 0-1, high 2-4. Not a biopsy. Not F0-F4.
Citation
- Authors
- Harrison SA, Oliver D, Arnold HL, Gogia S, Neuschwander-Tetri BA
- Source
- Gut. 2008;57(10):1441-1447
Worked example
BMI 25, AST 20, ALT 40, no diabetes
Given:
alt_u_l=40ast_u_l=20bmi=25diabetes=false
- BMI 25 < 28 → 0; AAR = 20/40 = 0.5 < 0.8 → 0; diabetes false → 0
- Score = 0 (max 4); risk_group = low
Also searched as
- BARD score
- Harrison BARD
- NAFLD BARD
- BMI AST ALT diabetes score
- BARD fibrosis
- Harrison 2008 BARD
- AST ALT ratio BARD
- NAFLD advanced fibrosis BARD
Try
Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.
/api/calc/bard?bmi=25&ast_u_l=20&alt_u_l=40&diabetes=false
Full URL: https://api.magentlab.com/api/calc/bard?bmi=25&ast_u_l=20&alt_u_l=40&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/bard?bmi=25&ast_u_l=20&alt_u_l=40&diabetes=false"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bmi |
number | required | Body-mass index in kg/m^2 (10-80). >=28 scores 1 (Harrison 2008). 27.9 scores 0. Caller-supplied; magent does not compute BMI from height and weight. |
ast_u_l |
number | required | Aspartate aminotransferase in U/L (1-10000). Used with ALT for the AAR. |
alt_u_l |
number | required | Alanine aminotransferase in U/L (1-10000). AST/ALT >= 0.8 scores 2 (Harrison 2008). 0.799 scores 0. ALT must be >0. |
diabetes |
boolean | required | Diabetes mellitus as assigned by the caller (Harrison 2008). true scores 1. magent does not diagnose diabetes. |
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": [
{
"alt_u_l": "40",
"ast_u_l": "20",
"bmi": "25",
"diabetes": "false"
},
{
"alt_u_l": "40",
"ast_u_l": "20",
"bmi": "25",
"diabetes": "false"
}
]
}
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/bard",
"items": [
{
"components": [
{
"value": 25.0,
"factor": "bmi_ge_28",
"points": 0,
"present": false
},
{
"value": 0.5,
"factor": "ast_alt_ratio_ge_0_8",
"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": "Harrison SA, Oliver D, Arnold HL, Gogia S, Neuschwander-Tetri BA",
"doi": "10.1136/gut.2007.146019",
"id": "harrison-2008",
"pmid": "18390575",
"source": "Gut. 2008;57(10):1441-1447",
"title": "Development and validation of a simple NAFLD clinical scoring system for identifying patients without advanced disease"
},
"formula": "bard",
"formula_expression": "BARD = 1 if BMI >= 28 + 2 if AST/ALT >= 0.8 + 1 if diabetes; Harrison 2008; max 4; risk_group low 0-1, high 2-4. Not a biopsy. Not F0-F4.",
"max_score": 4,
"score": 0,
"ast_u_l": 20.0,
"bmi": 25.0,
"alt_u_l": 40.0,
"ast_alt_ratio": 0.5,
"diabetes": false,
"risk_group": "low"
},
{
"components": [
{
"value": 25.0,
"factor": "bmi_ge_28",
"points": 0,
"present": false
},
{
"value": 0.5,
"factor": "ast_alt_ratio_ge_0_8",
"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": "Harrison SA, Oliver D, Arnold HL, Gogia S, Neuschwander-Tetri BA",
"doi": "10.1136/gut.2007.146019",
"id": "harrison-2008",
"pmid": "18390575",
"source": "Gut. 2008;57(10):1441-1447",
"title": "Development and validation of a simple NAFLD clinical scoring system for identifying patients without advanced disease"
},
"formula": "bard",
"formula_expression": "BARD = 1 if BMI >= 28 + 2 if AST/ALT >= 0.8 + 1 if diabetes; Harrison 2008; max 4; risk_group low 0-1, high 2-4. Not a biopsy. Not F0-F4.",
"max_score": 4,
"score": 0,
"ast_u_l": 20.0,
"bmi": 25.0,
"alt_u_l": 40.0,
"ast_alt_ratio": 0.5,
"diabetes": false,
"risk_group": "low"
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | bard |
formula_expression |
string | Exact expression used |
score |
integer | BARD points 0-4 |
max_score |
integer | Always 4 (1+2+1) |
risk_group |
string | low when score is 0-1, high when 2-4 (Harrison 2008 2-4 vs 0-1 split). Not F0-F4. Not a NASH diagnosis. magent does not interpret a biopsy. |
bmi |
number | Caller-supplied BMI in kg/m^2 |
ast_u_l |
number | AST in U/L |
alt_u_l |
number | ALT in U/L |
ast_alt_ratio |
number | AST/ALT ratio (AAR), 4 decimals |
diabetes |
boolean | Caller-assigned diabetes flag used |
components |
array | Per-factor points |
citation |
object | Harrison Gut 2008 citation |
disclaimer |
string | Not-a-device notice |
Example JSON
Machine form of the same example. Frozen fixture. Not a live lookup.
{
"components": [
{
"value": 25.0,
"factor": "bmi_ge_28",
"points": 0,
"present": false
},
{
"value": 0.5,
"factor": "ast_alt_ratio_ge_0_8",
"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": "Harrison SA, Oliver D, Arnold HL, Gogia S, Neuschwander-Tetri BA",
"doi": "10.1136/gut.2007.146019",
"id": "harrison-2008",
"pmid": "18390575",
"source": "Gut. 2008;57(10):1441-1447",
"title": "Development and validation of a simple NAFLD clinical scoring system for identifying patients without advanced disease"
},
"formula": "bard",
"formula_expression": "BARD = 1 if BMI >= 28 + 2 if AST/ALT >= 0.8 + 1 if diabetes; Harrison 2008; max 4; risk_group low 0-1, high 2-4. Not a biopsy. Not F0-F4.",
"max_score": 4,
"score": 0,
"ast_u_l": 20.0,
"bmi": 25.0,
"alt_u_l": 40.0,
"ast_alt_ratio": 0.5,
"diabetes": false,
"risk_group": "low"
}
Client errors (HTTP 400)
Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_bard |
bmi 10-80, ast_u_l 1-10000, and alt_u_l 1-10000 (Harrison 2008; magent clamps). 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
- NAFLD fibrosis score — Compute the Angulo 2007 NAFLD fibrosis score from age, BMI, IFG/diabetes, AST, ALT, platelets, and albumin.
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.