# REMA score

REMA

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

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

## What it computes

Sum the Álvarez-Twose 2012 REMA points (sex, serum baseline tryptase, pruritus/hives/angioedema, syncope or presyncope) and return whether the total is ≥2 (published clonality and systemic-mastocytosis triage threshold).

## When to use

When an agent needs the published REMA point total from caller-assigned sex, baseline tryptase, cutaneous signs, and syncope or presyncope and must not invent a tryptase assay, a mastocytosis diagnosis, or WHO SM criteria.

## When not to use

- Not a medical device. Not a diagnosis of systemic mastocytosis. Not WHO SM criteria (that is who-sm).
- magent does not assay tryptase. The caller supplies serum baseline tryptase (sBt) in μg/L.
- Only the published REMA threshold (score ≥2) is returned. magent does not invent other cutoffs.
- The caller assigns sex, cutaneous signs, and syncope or presyncope. magent does not take a history.

## Formula

```
REMA = sex (male +1, female −1) + tryptase_ug_l (<15 −1, 15–25 0, >25 +2) + pruritus_hives_angioedema (true −2, false +1) + syncope_or_presyncope (true +3, false 0); range −4 to +7; clonality_likely iff score >= 2 (Álvarez-Twose 2012)
```

## Citation

[Validation of the REMA score for predicting mast cell clonality and systemic mastocytosis in patients with systemic mast cell activation symptoms.](https://doi.org/10.1159/000329856)
Alvarez-Twose I, González-de-Olano D, Sánchez-Muñoz L, Matito A, Jara-Acevedo M, Teodosio C, García-Montero A, Morgado JM, Orfao A, Escribano L
Int Arch Allergy Immunol. 2012;157(3):275-280 (Epub 2011 Oct 28)
DOI: [10.1159/000329856](https://doi.org/10.1159/000329856)

## Worked example

### Male, tryptase 30 μg/L, no cutaneous signs, syncope

Given: `pruritus_hives_angioedema=false, sex=male, syncope_or_presyncope=true, tryptase_ug_l=30`

1. male → +1; tryptase 30 μg/L is >25 → +2; absence of pruritus, hives or angioedema → +1; syncope → +3
2. Score = 7 (max 7); clonality_likely true (Álvarez-Twose 2012 ≥2 threshold)


### Male, tryptase 20 μg/L, no cutaneous signs, no syncope (cutoff)

Given: `pruritus_hives_angioedema=false, sex=male, syncope_or_presyncope=false, tryptase_ug_l=20`

1. male → +1; tryptase 20 μg/L is 15–25 → 0; absence → +1; no syncope → 0
2. Score = 2 (max 7); clonality_likely true (published ≥2 threshold)


## Also searched as

- REMA score
- mast cell clonality score
- Álvarez-Twose REMA
- systemic mastocytosis REMA
- serum baseline tryptase REMA
- mast cell activation REMA
- Red Española de Mastocitosis

## Parameters

- `sex` (string, required): Sex as assigned by the caller (Álvarez-Twose 2012). male scores +1; female scores −1. Always one of these.
- `tryptase_ug_l` (number, required): Serum baseline tryptase (sBt) in μg/L (1-200). <15 scores −1; 15–25 inclusive scores 0; >25 scores +2. Equal to 15 is not <15; equal to 25 is not >25. magent does not assay tryptase.
- `pruritus_hives_angioedema` (boolean, required): Presence of pruritus, hives or angioedema as assigned by the caller (Álvarez-Twose 2012). true scores −2; false (absence) scores +1. Both branches score. magent does not take a history.
- `syncope_or_presyncope` (boolean, required): Syncope or presyncope as assigned by the caller (Álvarez-Twose 2012). true scores +3; 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.

Method: `POST /api/calc/rema`
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": [
    {
      "pruritus_hives_angioedema": "false",
      "sex": "male",
      "syncope_or_presyncope": "true",
      "tryptase_ug_l": "30"
    },
    {
      "pruritus_hives_angioedema": "false",
      "sex": "male",
      "syncope_or_presyncope": "true",
      "tryptase_ug_l": "30"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/rema",
  "items": [
    {
      "components": [
        {
          "value": "male",
          "factor": "sex",
          "points": 1,
          "present": true
        },
        {
          "value": 30.0,
          "factor": "tryptase_ug_l",
          "points": 2,
          "present": true
        },
        {
          "factor": "pruritus_hives_angioedema",
          "points": 1,
          "present": true
        },
        {
          "factor": "syncope_or_presyncope",
          "points": 3,
          "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": "Alvarez-Twose I, González-de-Olano D, Sánchez-Muñoz L, Matito A, Jara-Acevedo M, Teodosio C, García-Montero A, Morgado JM, Orfao A, Escribano L",
        "doi": "10.1159/000329856",
        "id": "alvarez-twose-2012",
        "pmid": "22042301",
        "source": "Int Arch Allergy Immunol. 2012;157(3):275-280 (Epub 2011 Oct 28)",
        "title": "Validation of the REMA score for predicting mast cell clonality and systemic mastocytosis in patients with systemic mast cell activation symptoms."
      },
      "formula": "rema",
      "formula_expression": "REMA = sex (male +1, female −1) + tryptase_ug_l (<15 −1, 15–25 0, >25 +2) + pruritus_hives_angioedema (true −2, false +1) + syncope_or_presyncope (true +3, false 0); range −4 to +7; clonality_likely iff score >= 2 (Álvarez-Twose 2012)",
      "max_score": 7,
      "score": 7,
      "sex": "male",
      "clonality_likely": true,
      "tryptase_ug_l": 30.0
    },
    {
      "components": [
        {
          "value": "male",
          "factor": "sex",
          "points": 1,
          "present": true
        },
        {
          "value": 30.0,
          "factor": "tryptase_ug_l",
          "points": 2,
          "present": true
        },
        {
          "factor": "pruritus_hives_angioedema",
          "points": 1,
          "present": true
        },
        {
          "factor": "syncope_or_presyncope",
          "points": 3,
          "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": "Alvarez-Twose I, González-de-Olano D, Sánchez-Muñoz L, Matito A, Jara-Acevedo M, Teodosio C, García-Montero A, Morgado JM, Orfao A, Escribano L",
        "doi": "10.1159/000329856",
        "id": "alvarez-twose-2012",
        "pmid": "22042301",
        "source": "Int Arch Allergy Immunol. 2012;157(3):275-280 (Epub 2011 Oct 28)",
        "title": "Validation of the REMA score for predicting mast cell clonality and systemic mastocytosis in patients with systemic mast cell activation symptoms."
      },
      "formula": "rema",
      "formula_expression": "REMA = sex (male +1, female −1) + tryptase_ug_l (<15 −1, 15–25 0, >25 +2) + pruritus_hives_angioedema (true −2, false +1) + syncope_or_presyncope (true +3, false 0); range −4 to +7; clonality_likely iff score >= 2 (Álvarez-Twose 2012)",
      "max_score": 7,
      "score": 7,
      "sex": "male",
      "clonality_likely": true,
      "tryptase_ug_l": 30.0
    }
  ]
}
```

## Response fields

- `formula` (string): rema
- `formula_expression` (string): Exact Álvarez-Twose 2012 REMA expression used
- `sex` (string): female or male used
- `tryptase_ug_l` (number): Serum baseline tryptase used in μg/L
- `score` (integer): REMA points −4 to +7
- `max_score` (integer): 7
- `clonality_likely` (boolean): true iff score ≥ 2 (Álvarez-Twose 2012 REMA threshold). Not a diagnosis of SM. Not WHO SM criteria.
- `components` (array): Per-factor points
- `citation` (object): Álvarez-Twose 2012 Int Arch Allergy Immunol citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": "male",
      "factor": "sex",
      "points": 1,
      "present": true
    },
    {
      "value": 30.0,
      "factor": "tryptase_ug_l",
      "points": 2,
      "present": true
    },
    {
      "factor": "pruritus_hives_angioedema",
      "points": 1,
      "present": true
    },
    {
      "factor": "syncope_or_presyncope",
      "points": 3,
      "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": "Alvarez-Twose I, González-de-Olano D, Sánchez-Muñoz L, Matito A, Jara-Acevedo M, Teodosio C, García-Montero A, Morgado JM, Orfao A, Escribano L",
    "doi": "10.1159/000329856",
    "id": "alvarez-twose-2012",
    "pmid": "22042301",
    "source": "Int Arch Allergy Immunol. 2012;157(3):275-280 (Epub 2011 Oct 28)",
    "title": "Validation of the REMA score for predicting mast cell clonality and systemic mastocytosis in patients with systemic mast cell activation symptoms."
  },
  "formula": "rema",
  "formula_expression": "REMA = sex (male +1, female −1) + tryptase_ug_l (<15 −1, 15–25 0, >25 +2) + pruritus_hives_angioedema (true −2, false +1) + syncope_or_presyncope (true +3, false 0); range −4 to +7; clonality_likely iff score >= 2 (Álvarez-Twose 2012)",
  "max_score": 7,
  "score": 7,
  "sex": "male",
  "clonality_likely": true,
  "tryptase_ug_l": 30.0
}
```

## Errors

- HTTP 400 `invalid_rema`: REMA needs sex, tryptase_ug_l, pruritus_hives_angioedema, and syncope_or_presyncope (Álvarez-Twose 2012). Returned before settlement; you are not charged.
- HTTP 400 `invalid_sex`: sex must be female or male Returned before settlement; you are not charged.
- HTTP 400 `invalid_tryptase`: tryptase_ug_l must be a number from 1 to 200 (μg/L). 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

- [WHO 2016 SM criteria](https://magentlab.com/docs/who-sm) — Apply the Valent 2016 / WHO 2016 systemic mastocytosis diagnostic criteria (Table 1) and return whether the published combination of the major criterion plus at least one minor, or at least three minors, is met. Tryptase >20 ng/mL does not count when an unrelated myeloid neoplasm is present.

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