# BARD score (Harrison 2008)

BARD

Status: LIVE
Price: $0.005 USDC
`GET /api/calc/bard`
HTML: https://magentlab.com/docs/bard
Markdown: https://magentlab.com/docs/bard.md

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

[Development and validation of a simple NAFLD clinical scoring system for identifying patients without advanced disease](https://doi.org/10.1136/gut.2007.146019)
Harrison SA, Oliver D, Arnold HL, Gogia S, Neuschwander-Tetri BA
Gut. 2008;57(10):1441-1447
DOI: [10.1136/gut.2007.146019](https://doi.org/10.1136/gut.2007.146019)

## Worked example

### BMI 25, AST 20, ALT 40, no diabetes

Given: `alt_u_l=40, ast_u_l=20, bmi=25, diabetes=false`

1. BMI 25 < 28 → 0; AAR = 20/40 = 0.5 < 0.8 → 0; diabetes false → 0
2. 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

## Parameters

- `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.

Method: `POST /api/calc/bard`
Max items: 25
Price: unit_amount + extra_item_amount * (n - 1) (unit 5000 atomic, extra 2000 atomic)
Status: 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:

```json
{
  "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"
    }
  ]
}
```

Human paywall (two-item fixture): https://api.magentlab.com/paywall/bulk/bard

Example 200:

```json
{
  "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 fields

- `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

Frozen fixture. Not a live lookup.

```json
{
  "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"
}
```

## Errors

- HTTP 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.
- HTTP 400 `invalid_flag`: boolean clinical flags must be true or false Returned before settlement; you are not charged.
- HTTP 400 `invalid_items`: POST body must be a JSON object with only an items array Returned before settlement; you are not charged.
- HTTP 400 `invalid_item_count`: items must be an array of 1 to 25 objects Returned before settlement; you are not charged.
- HTTP 400 `invalid_item`: each items entry must be a JSON object Returned before settlement; you are not charged.

Shared HTTP 402 and 503: https://magentlab.com/docs/payments

## Related tools

- [NAFLD fibrosis score](https://magentlab.com/docs/nafld-fibrosis) — 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.

- GET the tool with Accept: application/json (do not send Accept: text/html unless you want the human paywall).
- HTTP 402 means you have not paid. Decode the base64 PAYMENT-REQUIRED header. HTTP 503 is not a new quote.
- Sign accepts[0] (exact, EIP-3009) with validBefore = now + maxTimeoutSeconds (600 seconds), or accepts[1] (batch-settlement deposit/voucher) on product GET. Ping and POST {items} stay exact. Magent retries transient facilitator 429/5xx before answering.
- Retry the same URL with PAYMENT-SIGNATURE (base64 JSON of accepted and payload). Magent attaches canonical extensions.bazaar on CDP verify/settle; echoing 402 bazaar is optional.
- Success is HTTP 200 JSON plus PAYMENT-RESPONSE. exact settles before the tool. batch-settlement verifies (and deposit-settles) before the tool and commits the charge after HTTP 2xx. HTTP 503: retry the same PAYMENT-SIGNATURE. Mint a new exact nonce only after a new HTTP 402.

- offered `exact` on eip155:8453: Fixed-price USDC on Base. The buyer authorizes the advertised amount (EIP-3009). magent settles before the tool runs (paymentFlow upfront). extra.assetTransferMethod=eip3009 extra.paymentFlow=upfront.
- offered `batch-settlement` on eip155:8453: Payment-channel vouchers claimed later in batches. Exact stays accepts[0]. Same-path POST {items} is still exact. extra.assetTransferMethod=eip3009 extra.paymentFlow=authorization.

- not offered `upto`: Not offered. Usage-based: buyer authorizes a ceiling, seller settles the actual amount after work. Reserved for a future metered tool. Not for current calculators or code search.

Same-path POST {items} is still scheme exact: one EIP-3009 authorization for GET unit plus $0.002 per extra item. That is not x402 batch-settlement (payment channels / vouchers).

Shared HTTP 402 and 503 table: https://magentlab.com/docs/payments

Stdio MCP (one process per host): https://magentlab.com/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.
