# Leiden undifferentiated arthritis prediction rule

Leiden UA rule

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

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

## What it computes

Sum the van der Helm-van Mil 2007 simplified Leiden prediction score for recent-onset undifferentiated arthritis and return the paper’s ≤6 / 6–8 / ≥8 decision band.

## When to use

When an agent already has age, sex, caller-assigned joint-distribution flags, 100-mm morning-stiffness VAS, tender and swollen joint counts, CRP in mg/L, and RF/anti-CCP flags and needs the published Leiden UA score, not an RA diagnosis.

## When not to use

- Not a medical device and not a diagnosis of rheumatoid arthritis or a treatment order.
- magent does not examine joints or assay serologies. Age, sex, distribution flags, 100-mm VAS, joint counts, CRP, RF, and anti-CCP are caller-assigned.
- Morning stiffness is the published 100-mm VAS severity, not duration in minutes.
- If upper_and_lower_extremities is true, the 1-point upper_extremities row is ignored (1.5 only). Small-joint and symmetric rows may stack with that extremity row.
- The total is rounded to the nearest number ending in .0 or .5 (paper Table 3). Bands are the paper decision cutoffs: ≤6 low, >6 and <8 indeterminate, ≥8 high. max_score 14. Not a classification of RA.

## Formula

```
Leiden UA score (van der Helm-van Mil 2007 Figure 1 / Table 2) = age_years*0.02 + female 1 + small_joints_hands_feet 0.5 + symmetric 0.5 + (upper_and_lower_extremities 1.5 else upper_extremities 1) + morning_stiffness_vas_mm (0–25 → 0; 26–90 → 1; >90 → 2) + tender_joint_count (<4 → 0; 4–10 → 0.5; ≥11 → 1) + swollen_joint_count (<4 → 0; 4–10 → 0.5; ≥11 → 1) + crp_mg_l (0–4 → 0; 5–50 → 0.5; ≥51 → 1.5) + rheumatoid_factor_positive 1 + anti_ccp_positive 2; round to nearest 0.0 or 0.5; ≤6 low, >6 and <8 indeterminate, ≥8 high; max 14; not a diagnosis of RA
```

## Citation

[A prediction rule for disease outcome in patients with recent-onset undifferentiated arthritis: how to guide individual treatment decisions](https://doi.org/10.1002/art.22380)
van der Helm-van Mil AH, le Cessie S, van Dongen H, Breedveld FC, Toes RE, Huizinga TW
Arthritis Rheum. 2007;56(2):433-440
DOI: [10.1002/art.22380](https://doi.org/10.1002/art.22380)

## Worked example

### Age 48 female, RF negative: 7.46 rounds to 7.5 indeterminate

Given: `age=48, anti_ccp_positive=false, crp_mg_l=60, morning_stiffness_vas_mm=50, rheumatoid_factor_positive=false, sex=female, small_joints_hands_feet=true, swollen_joint_count=8, symmetric=true, tender_joint_count=8, upper_and_lower_extremities=false, upper_extremities=true`

1. age 48 × 0.02 = 0.96; female 1; small joints 0.5; symmetric 0.5; upper extremities 1; VAS 50 → 1; tender 8 → 0.5; swollen 8 → 0.5; CRP 60 → 1.5; RF 0; anti-CCP 0
2. unrounded 7.46; round to nearest 0.0 or 0.5 → 7.5; leiden_band indeterminate (>6 and <8)


### Same inputs with RF positive: 8.46 rounds to 8.5 high

Given: `age=48, anti_ccp_positive=false, crp_mg_l=60, morning_stiffness_vas_mm=50, rheumatoid_factor_positive=true, sex=female, small_joints_hands_feet=true, swollen_joint_count=8, symmetric=true, tender_joint_count=8, upper_and_lower_extremities=false, upper_extremities=true`

1. prior unrounded 7.46 + RF 1 = 8.46
2. round to nearest 0.0 or 0.5 → 8.5; leiden_band high (≥8)


### Score 6.0 is low

Given: `age=50, anti_ccp_positive=false, crp_mg_l=0, morning_stiffness_vas_mm=50, rheumatoid_factor_positive=false, sex=female, small_joints_hands_feet=true, swollen_joint_count=8, symmetric=true, tender_joint_count=8, upper_and_lower_extremities=false, upper_extremities=true`

1. age 50 × 0.02 = 1; female 1; small 0.5; symmetric 0.5; upper 1; VAS 50 → 1; tender 8 → 0.5; swollen 8 → 0.5; CRP 0; RF 0; anti-CCP 0
2. score = 6.0 (≤6); leiden_band low


## Also searched as

- Leiden prediction rule
- Leiden UA rule
- undifferentiated arthritis score
- van der Helm-van Mil 2007
- early arthritis prediction rule
- Leiden RA prediction score

## Parameters

- `age` (integer, required): Age in years as an integer from 18 to 120 (van der Helm-van Mil 2007). Scores age_years × 0.02. magent does not assign age.
- `sex` (string, required): Caller-assigned sex (van der Helm-van Mil 2007). female scores 1; male scores 0. magent does not assign sex.
- `small_joints_hands_feet` (boolean, required): Involvement of small joints of the hands or feet (van der Helm-van Mil 2007). true scores 0.5 and may stack with symmetric and the extremity row. magent does not examine joints.
- `symmetric` (boolean, required): Symmetric joint involvement (van der Helm-van Mil 2007). true scores 0.5 and may stack with small-joint and extremity rows. magent does not examine joints.
- `upper_extremities` (boolean, required): Involvement of upper extremities only (van der Helm-van Mil 2007). true scores 1 unless upper_and_lower_extremities is true, in which case this row is ignored. Mutually exclusive with the 1.5 upper-and-lower row. magent does not examine joints.
- `upper_and_lower_extremities` (boolean, required): Involvement of upper and lower extremities (van der Helm-van Mil 2007). true scores 1.5 and ignores upper_extremities. magent does not examine joints.
- `morning_stiffness_vas_mm` (number, required): Morning-stiffness severity on a 100-mm VAS (van der Helm-van Mil 2007), not duration in minutes. Number 0–100. 0–25 scores 0; 26–90 scores 1; >90 scores 2. magent does not take a history.
- `tender_joint_count` (integer, required): Caller-assigned tender joint count (van der Helm-van Mil 2007). Integer 0–68. <4 scores 0; 4–10 scores 0.5; ≥11 scores 1. magent does not examine joints.
- `swollen_joint_count` (integer, required): Caller-assigned swollen joint count (van der Helm-van Mil 2007). Integer 0–66. <4 scores 0; 4–10 scores 0.5; ≥11 scores 1. magent does not examine joints.
- `crp_mg_l` (number, required): Caller-assigned C-reactive protein in mg/L (van der Helm-van Mil 2007). Number 0–500. 0–4 scores 0; 5–50 scores 0.5; ≥51 scores 1.5. magent does not assay CRP.
- `rheumatoid_factor_positive` (boolean, required): Caller-assigned rheumatoid factor positivity (van der Helm-van Mil 2007). true scores 1. magent does not assay serologies.
- `anti_ccp_positive` (boolean, required): Caller-assigned anti-CCP (ACPA) positivity (van der Helm-van Mil 2007). true scores 2. magent does not assay serologies.

## 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/leiden_arthritis`
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": "48",
      "anti_ccp_positive": "false",
      "crp_mg_l": "60",
      "morning_stiffness_vas_mm": "50",
      "rheumatoid_factor_positive": "false",
      "sex": "female",
      "small_joints_hands_feet": "true",
      "swollen_joint_count": "8",
      "symmetric": "true",
      "tender_joint_count": "8",
      "upper_and_lower_extremities": "false",
      "upper_extremities": "true"
    },
    {
      "age": "48",
      "anti_ccp_positive": "false",
      "crp_mg_l": "60",
      "morning_stiffness_vas_mm": "50",
      "rheumatoid_factor_positive": "false",
      "sex": "female",
      "small_joints_hands_feet": "true",
      "swollen_joint_count": "8",
      "symmetric": "true",
      "tender_joint_count": "8",
      "upper_and_lower_extremities": "false",
      "upper_extremities": "true"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/leiden_arthritis",
  "items": [
    {
      "components": [
        {
          "value": 48,
          "factor": "age",
          "points": 0.96,
          "present": true
        },
        {
          "value": "female",
          "factor": "female",
          "points": 1,
          "present": true
        },
        {
          "factor": "small_joints_hands_feet",
          "points": 0.5,
          "present": true
        },
        {
          "factor": "symmetric",
          "points": 0.5,
          "present": true
        },
        {
          "factor": "upper_and_lower_extremities",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "upper_extremities",
          "points": 1.0,
          "present": true
        },
        {
          "value": 50.0,
          "factor": "morning_stiffness_vas_mm",
          "points": 1,
          "present": true
        },
        {
          "value": 8,
          "factor": "tender_joint_count",
          "points": 0.5,
          "present": true
        },
        {
          "value": 8,
          "factor": "swollen_joint_count",
          "points": 0.5,
          "present": true
        },
        {
          "value": 60.0,
          "factor": "crp_mg_l",
          "points": 1.5,
          "present": true
        },
        {
          "factor": "rheumatoid_factor_positive",
          "points": 0,
          "present": false
        },
        {
          "factor": "anti_ccp_positive",
          "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": "van der Helm-van Mil AH, le Cessie S, van Dongen H, Breedveld FC, Toes RE, Huizinga TW",
        "doi": "10.1002/art.22380",
        "id": "van-der-helm-van-mil-2007",
        "pmid": "17265478",
        "source": "Arthritis Rheum. 2007;56(2):433-440",
        "title": "A prediction rule for disease outcome in patients with recent-onset undifferentiated arthritis: how to guide individual treatment decisions"
      },
      "formula": "leiden_arthritis",
      "formula_expression": "Leiden UA score (van der Helm-van Mil 2007 Figure 1 / Table 2) = age_years*0.02 + female 1 + small_joints_hands_feet 0.5 + symmetric 0.5 + (upper_and_lower_extremities 1.5 else upper_extremities 1) + morning_stiffness_vas_mm (0–25 → 0; 26–90 → 1; >90 → 2) + tender_joint_count (<4 → 0; 4–10 → 0.5; ≥11 → 1) + swollen_joint_count (<4 → 0; 4–10 → 0.5; ≥11 → 1) + crp_mg_l (0–4 → 0; 5–50 → 0.5; ≥51 → 1.5) + rheumatoid_factor_positive 1 + anti_ccp_positive 2; round to nearest 0.0 or 0.5; ≤6 low, >6 and <8 indeterminate, ≥8 high; max 14; not a diagnosis of RA",
      "max_score": 14,
      "score": 7.5,
      "leiden_band": "indeterminate"
    },
    {
      "components": [
        {
          "value": 48,
          "factor": "age",
          "points": 0.96,
          "present": true
        },
        {
          "value": "female",
          "factor": "female",
          "points": 1,
          "present": true
        },
        {
          "factor": "small_joints_hands_feet",
          "points": 0.5,
          "present": true
        },
        {
          "factor": "symmetric",
          "points": 0.5,
          "present": true
        },
        {
          "factor": "upper_and_lower_extremities",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "upper_extremities",
          "points": 1.0,
          "present": true
        },
        {
          "value": 50.0,
          "factor": "morning_stiffness_vas_mm",
          "points": 1,
          "present": true
        },
        {
          "value": 8,
          "factor": "tender_joint_count",
          "points": 0.5,
          "present": true
        },
        {
          "value": 8,
          "factor": "swollen_joint_count",
          "points": 0.5,
          "present": true
        },
        {
          "value": 60.0,
          "factor": "crp_mg_l",
          "points": 1.5,
          "present": true
        },
        {
          "factor": "rheumatoid_factor_positive",
          "points": 0,
          "present": false
        },
        {
          "factor": "anti_ccp_positive",
          "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": "van der Helm-van Mil AH, le Cessie S, van Dongen H, Breedveld FC, Toes RE, Huizinga TW",
        "doi": "10.1002/art.22380",
        "id": "van-der-helm-van-mil-2007",
        "pmid": "17265478",
        "source": "Arthritis Rheum. 2007;56(2):433-440",
        "title": "A prediction rule for disease outcome in patients with recent-onset undifferentiated arthritis: how to guide individual treatment decisions"
      },
      "formula": "leiden_arthritis",
      "formula_expression": "Leiden UA score (van der Helm-van Mil 2007 Figure 1 / Table 2) = age_years*0.02 + female 1 + small_joints_hands_feet 0.5 + symmetric 0.5 + (upper_and_lower_extremities 1.5 else upper_extremities 1) + morning_stiffness_vas_mm (0–25 → 0; 26–90 → 1; >90 → 2) + tender_joint_count (<4 → 0; 4–10 → 0.5; ≥11 → 1) + swollen_joint_count (<4 → 0; 4–10 → 0.5; ≥11 → 1) + crp_mg_l (0–4 → 0; 5–50 → 0.5; ≥51 → 1.5) + rheumatoid_factor_positive 1 + anti_ccp_positive 2; round to nearest 0.0 or 0.5; ≤6 low, >6 and <8 indeterminate, ≥8 high; max 14; not a diagnosis of RA",
      "max_score": 14,
      "score": 7.5,
      "leiden_band": "indeterminate"
    }
  ]
}
```

## Response fields

- `formula` (string): leiden_arthritis
- `formula_expression` (string): Exact expression used
- `score` (number): van der Helm-van Mil 2007 simplified prediction score rounded to the nearest 0.0 or 0.5 (Table 3 grouping). Half-points allowed.
- `max_score` (integer): 14
- `leiden_band` (string): Paper decision cutoffs on the rounded score: low (≤6), indeterminate (>6 and <8), or high (≥8). Not a diagnosis of RA.
- `components` (array): Per-factor points before rounding
- `citation` (object): van der Helm-van Mil et al. Arthritis Rheum 2007 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": 48,
      "factor": "age",
      "points": 0.96,
      "present": true
    },
    {
      "value": "female",
      "factor": "female",
      "points": 1,
      "present": true
    },
    {
      "factor": "small_joints_hands_feet",
      "points": 0.5,
      "present": true
    },
    {
      "factor": "symmetric",
      "points": 0.5,
      "present": true
    },
    {
      "factor": "upper_and_lower_extremities",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "upper_extremities",
      "points": 1.0,
      "present": true
    },
    {
      "value": 50.0,
      "factor": "morning_stiffness_vas_mm",
      "points": 1,
      "present": true
    },
    {
      "value": 8,
      "factor": "tender_joint_count",
      "points": 0.5,
      "present": true
    },
    {
      "value": 8,
      "factor": "swollen_joint_count",
      "points": 0.5,
      "present": true
    },
    {
      "value": 60.0,
      "factor": "crp_mg_l",
      "points": 1.5,
      "present": true
    },
    {
      "factor": "rheumatoid_factor_positive",
      "points": 0,
      "present": false
    },
    {
      "factor": "anti_ccp_positive",
      "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": "van der Helm-van Mil AH, le Cessie S, van Dongen H, Breedveld FC, Toes RE, Huizinga TW",
    "doi": "10.1002/art.22380",
    "id": "van-der-helm-van-mil-2007",
    "pmid": "17265478",
    "source": "Arthritis Rheum. 2007;56(2):433-440",
    "title": "A prediction rule for disease outcome in patients with recent-onset undifferentiated arthritis: how to guide individual treatment decisions"
  },
  "formula": "leiden_arthritis",
  "formula_expression": "Leiden UA score (van der Helm-van Mil 2007 Figure 1 / Table 2) = age_years*0.02 + female 1 + small_joints_hands_feet 0.5 + symmetric 0.5 + (upper_and_lower_extremities 1.5 else upper_extremities 1) + morning_stiffness_vas_mm (0–25 → 0; 26–90 → 1; >90 → 2) + tender_joint_count (<4 → 0; 4–10 → 0.5; ≥11 → 1) + swollen_joint_count (<4 → 0; 4–10 → 0.5; ≥11 → 1) + crp_mg_l (0–4 → 0; 5–50 → 0.5; ≥51 → 1.5) + rheumatoid_factor_positive 1 + anti_ccp_positive 2; round to nearest 0.0 or 0.5; ≤6 low, >6 and <8 indeterminate, ≥8 high; max 14; not a diagnosis of RA",
  "max_score": 14,
  "score": 7.5,
  "leiden_band": "indeterminate"
}
```

## Errors

- HTTP 400 `invalid_age`: age must be an integer from 18 to 120 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_leiden`: morning_stiffness_vas_mm must be 0–100; tender_joint_count an integer 0–68; swollen_joint_count an integer 0–66; crp_mg_l a number 0–500 (van der Helm-van Mil 2007 Leiden UA rule). 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

- [ACR/EULAR gout](https://magentlab.com/docs/acr-eular-gout) — Apply the 2015 ACR/EULAR gout classification criteria (Neogi Table 2): require the entry episode, classify immediately if MSU crystals are present, otherwise return the Step 3 score (max 23) and whether score ≥8 classifies gout. Not a gout diagnosis.
- [SDAI](https://magentlab.com/docs/sdai) — Sum caller-assigned 28-joint swollen and tender counts, 0–10 cm patient and evaluator globals, and CRP in mg/dL, and return the Aletaha 2005 SDAI with the newly proposed activity state.
- [ACR/EULAR PMR](https://magentlab.com/docs/acr-eular-pmr) — Apply the 2012 EULAR/ACR polymyalgia rheumatica classification criteria (Dasgupta Table 4): require age ≥50, bilateral shoulder aching, and abnormal CRP and/or ESR, then return the clinical score with or without optional ultrasound and whether the published cut point classifies PMR. Not a PMR diagnosis.

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