# ATRIA stroke risk score

ATRIA stroke risk score

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

Not a medical device. Not a diagnosis, dose, or listing recommendation.

## What it computes

Compute the Singer 2013 ATRIA stroke risk score from age, prior stroke, and caller-assigned female, diabetes, heart failure, hypertension, proteinuria, and eGFR <45 or ESRD flags.

## When to use

When an agent needs the published Singer 2013 ATRIA AF stroke-risk arithmetic (not CHA2DS2-VASc and not Fang 2011 ATRIA hemorrhage) and must not invent the point total from prose.

## When not to use

- Not a medical device. magent does not diagnose stroke or atrial fibrillation.
- Not a stroke diagnosis and not an anticoagulation order or treatment recommendation.
- Not CHA2DS2-VASc. This tool is the Singer 2013 ATRIA stroke risk score only.
- Not the Fang 2011 ATRIA hemorrhage (bleed) score. That is a different tool.
- magent does not assay eGFR or urine. Proteinuria and eGFR <45 or ESRD are caller flags.

## Formula

```
ATRIA stroke = age_prior_stroke (Singer 2013 Table 3: <65 0/8, 65-74 3/7, 75-84 5/7, >=85 6/9 without/with prior stroke) + female 1 + diabetes 1 + heart_failure 1 + hypertension 1 + proteinuria 1 + egfr_lt_45_or_esrd 1; max 15 (12 without prior stroke); 0-5 low, 6 moderate, 7-15 high
```

## Citation

[A new risk scheme to predict ischemic stroke and other thromboembolism in atrial fibrillation: the ATRIA study stroke risk score](https://doi.org/10.1161/JAHA.113.000250)
Singer DE, Chang Y, Borowsky LH, Fang MC, Pomernacki NK, Udaltsova N, Reynolds K, Go AS.
J Am Heart Assoc. 2013;2(3):e000250
DOI: [10.1161/JAHA.113.000250](https://doi.org/10.1161/JAHA.113.000250)

## Worked example

### Age 50, all flags false

Given: `age=50, diabetes=false, egfr_lt_45_or_esrd=false, female=false, heart_failure=false, hypertension=false, prior_stroke=false, proteinuria=false`

1. Age 50 without prior stroke (Table 3 <65) → 0; remaining flags false → 0
2. Score = 0 (max 15); atria_stroke_band low


### Age 85 without other factors is moderate

Given: `age=85, diabetes=false, egfr_lt_45_or_esrd=false, female=false, heart_failure=false, hypertension=false, prior_stroke=false, proteinuria=false`

1. Age ≥85 without prior stroke (Table 3) → 6
2. Score = 6 (max 15); atria_stroke_band moderate


### Age 75 plus female and hypertension is high

Given: `age=75, diabetes=false, egfr_lt_45_or_esrd=false, female=true, heart_failure=false, hypertension=true, prior_stroke=false, proteinuria=false`

1. Age 75-84 without prior stroke → 5; female → 1; hypertension → 1
2. Score = 7 (max 15); atria_stroke_band high


## Also searched as

- ATRIA stroke score
- ATRIA stroke risk score
- Singer 2013 ATRIA
- ATRIA thromboembolism score
- AF ATRIA stroke
- ATRIA study stroke risk

## Parameters

- `age` (integer, required): Age in years (18-120). Singer 2013 Table 3 without prior stroke: <65 scores 0, 65-74 scores 3, 75-84 scores 5, ≥85 scores 6. With prior stroke: <65 scores 8, 65-74 scores 7, 75-84 scores 7, ≥85 scores 9.
- `prior_stroke` (boolean, required): Prior ischemic stroke as assigned by the caller. true or false. Selects the Table 3 age column. Not a stroke diagnosis.
- `female` (boolean, required): Female sex as assigned by the caller. true or false. Scores 1.
- `diabetes` (boolean, required): Diabetes as assigned by the caller. true or false. Scores 1.
- `heart_failure` (boolean, required): Congestive heart failure as assigned by the caller (paper CHF). true or false. Scores 1.
- `hypertension` (boolean, required): Diagnosed hypertension as assigned by the caller. true or false. Scores 1.
- `proteinuria` (boolean, required): Proteinuria as assigned by the caller. true or false. Scores 1. magent does not assay urine.
- `egfr_lt_45_or_esrd` (boolean, required): eGFR <45 or ESRD as assigned by the caller. true or false. Scores 1. magent does not assay eGFR.

## 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/atria_stroke`
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": [
    {
      "age": "50",
      "diabetes": "false",
      "egfr_lt_45_or_esrd": "false",
      "female": "false",
      "heart_failure": "false",
      "hypertension": "false",
      "prior_stroke": "false",
      "proteinuria": "false"
    },
    {
      "age": "50",
      "diabetes": "false",
      "egfr_lt_45_or_esrd": "false",
      "female": "false",
      "heart_failure": "false",
      "hypertension": "false",
      "prior_stroke": "false",
      "proteinuria": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/atria_stroke",
  "items": [
    {
      "components": [
        {
          "value": 50,
          "factor": "age_prior_stroke",
          "points": 0,
          "present": false
        },
        {
          "factor": "female",
          "points": 0,
          "present": false
        },
        {
          "factor": "diabetes",
          "points": 0,
          "present": false
        },
        {
          "factor": "heart_failure",
          "points": 0,
          "present": false
        },
        {
          "factor": "hypertension",
          "points": 0,
          "present": false
        },
        {
          "factor": "proteinuria",
          "points": 0,
          "present": false
        },
        {
          "factor": "egfr_lt_45_or_esrd",
          "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": "Singer DE, Chang Y, Borowsky LH, Fang MC, Pomernacki NK, Udaltsova N, Reynolds K, Go AS.",
        "doi": "10.1161/JAHA.113.000250",
        "id": "singer-2013",
        "pmid": "23782923",
        "source": "J Am Heart Assoc. 2013;2(3):e000250",
        "title": "A new risk scheme to predict ischemic stroke and other thromboembolism in atrial fibrillation: the ATRIA study stroke risk score"
      },
      "formula": "atria_stroke",
      "formula_expression": "ATRIA stroke = age_prior_stroke (Singer 2013 Table 3: <65 0/8, 65-74 3/7, 75-84 5/7, >=85 6/9 without/with prior stroke) + female 1 + diabetes 1 + heart_failure 1 + hypertension 1 + proteinuria 1 + egfr_lt_45_or_esrd 1; max 15 (12 without prior stroke); 0-5 low, 6 moderate, 7-15 high",
      "age_years": 50,
      "max_score": 15,
      "score": 0,
      "atria_stroke_band": "low"
    },
    {
      "components": [
        {
          "value": 50,
          "factor": "age_prior_stroke",
          "points": 0,
          "present": false
        },
        {
          "factor": "female",
          "points": 0,
          "present": false
        },
        {
          "factor": "diabetes",
          "points": 0,
          "present": false
        },
        {
          "factor": "heart_failure",
          "points": 0,
          "present": false
        },
        {
          "factor": "hypertension",
          "points": 0,
          "present": false
        },
        {
          "factor": "proteinuria",
          "points": 0,
          "present": false
        },
        {
          "factor": "egfr_lt_45_or_esrd",
          "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": "Singer DE, Chang Y, Borowsky LH, Fang MC, Pomernacki NK, Udaltsova N, Reynolds K, Go AS.",
        "doi": "10.1161/JAHA.113.000250",
        "id": "singer-2013",
        "pmid": "23782923",
        "source": "J Am Heart Assoc. 2013;2(3):e000250",
        "title": "A new risk scheme to predict ischemic stroke and other thromboembolism in atrial fibrillation: the ATRIA study stroke risk score"
      },
      "formula": "atria_stroke",
      "formula_expression": "ATRIA stroke = age_prior_stroke (Singer 2013 Table 3: <65 0/8, 65-74 3/7, 75-84 5/7, >=85 6/9 without/with prior stroke) + female 1 + diabetes 1 + heart_failure 1 + hypertension 1 + proteinuria 1 + egfr_lt_45_or_esrd 1; max 15 (12 without prior stroke); 0-5 low, 6 moderate, 7-15 high",
      "age_years": 50,
      "max_score": 15,
      "score": 0,
      "atria_stroke_band": "low"
    }
  ]
}
```

## Response fields

- `formula` (string): atria_stroke
- `formula_expression` (string): Exact expression used
- `score` (integer): Total points 0-15
- `max_score` (integer): Always 15
- `atria_stroke_band` (string): Singer 2013 three-category scheme: low when score is 0-5; moderate when 6; high when 7-15. Not a diagnosis.
- `age_years` (integer): Age used for the Table 3 age column
- `components` (array): Per-factor points
- `citation` (object): Singer 2013 J Am Heart Assoc citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": 50,
      "factor": "age_prior_stroke",
      "points": 0,
      "present": false
    },
    {
      "factor": "female",
      "points": 0,
      "present": false
    },
    {
      "factor": "diabetes",
      "points": 0,
      "present": false
    },
    {
      "factor": "heart_failure",
      "points": 0,
      "present": false
    },
    {
      "factor": "hypertension",
      "points": 0,
      "present": false
    },
    {
      "factor": "proteinuria",
      "points": 0,
      "present": false
    },
    {
      "factor": "egfr_lt_45_or_esrd",
      "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": "Singer DE, Chang Y, Borowsky LH, Fang MC, Pomernacki NK, Udaltsova N, Reynolds K, Go AS.",
    "doi": "10.1161/JAHA.113.000250",
    "id": "singer-2013",
    "pmid": "23782923",
    "source": "J Am Heart Assoc. 2013;2(3):e000250",
    "title": "A new risk scheme to predict ischemic stroke and other thromboembolism in atrial fibrillation: the ATRIA study stroke risk score"
  },
  "formula": "atria_stroke",
  "formula_expression": "ATRIA stroke = age_prior_stroke (Singer 2013 Table 3: <65 0/8, 65-74 3/7, 75-84 5/7, >=85 6/9 without/with prior stroke) + female 1 + diabetes 1 + heart_failure 1 + hypertension 1 + proteinuria 1 + egfr_lt_45_or_esrd 1; max 15 (12 without prior stroke); 0-5 low, 6 moderate, 7-15 high",
  "age_years": 50,
  "max_score": 15,
  "score": 0,
  "atria_stroke_band": "low"
}
```

## Errors

- HTTP 400 `invalid_age`: age must be an integer from 18 to 120 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

- [ATRIA hemorrhage score](https://magentlab.com/docs/atria) — Compute the Fang 2011 ATRIA hemorrhage score from caller-assigned anemia, severe renal disease, age, prior hemorrhage, and hypertension flags.

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