# DIRE score (Belgrade 2006)

DIRE

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

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

## What it computes

Sum Belgrade 2006 DIRE as Diagnosis + Intractability + Risk + Efficacy. Diagnosis, Intractability, and Efficacy are caller-assigned 1-3. Risk is the sum of Psychological, Chemical, Reliability, and Social support (each 1-3, so Risk 4-12). Total 7-21. Return whether the published score >= 14 cut for long-term opioid maintenance suitability is met.

## When to use

When an agent already has Belgrade 2006 1-3 integers for Diagnosis, Intractability, the four Risk subcategories, and Efficacy and needs the published 7-21 total and >=14 suitability cut. magent does not take a pain history, diagnose opioid use disorder, or write an opioid prescription or taper.

## When not to use

- Not a medical device.
- Not an opioid prescription or taper order. magent does not start, stop, or dose opioids.
- Each of Diagnosis, Intractability, Efficacy, and the four Risk subcategories is a caller-assigned integer 1-3. magent does not take a pain history or interview the patient.
- Belgrade 2006 only. Score 14-21 more suitable for long-term opioid maintenance; 7-13 less suitable. Not a diagnosis of opioid use disorder.

## Formula

```
DIRE = diagnosis + intractability + risk + efficacy; diagnosis, intractability, and efficacy each caller-assigned 1-3; risk = psychological + chemical + reliability + social_support (each 1-3, so risk 4-12); total 7-21; Belgrade 2006; score 14-21 more suitable for long-term opioid maintenance, 7-13 less suitable
```

## Citation

[The DIRE score: predicting outcomes of opioid prescribing for chronic pain](https://doi.org/10.1016/j.jpain.2006.03.001)
Belgrade MJ, Schamber CD, Lindgren BR
J Pain. 2006;7(9):671-681
DOI: [10.1016/j.jpain.2006.03.001](https://doi.org/10.1016/j.jpain.2006.03.001)

## Worked example

### All items 1

Given: `chemical=1, diagnosis=1, efficacy=1, intractability=1, psychological=1, reliability=1, social_support=1`

1. diagnosis 1 + intractability 1 + risk 4 (four subcategories at 1) + efficacy 1
2. Score = 7 (max 21); suitable_candidate false (7-13 less suitable)


### All items 3

Given: `chemical=3, diagnosis=3, efficacy=3, intractability=3, psychological=3, reliability=3, social_support=3`

1. diagnosis 3 + intractability 3 + risk 12 (four subcategories at 3) + efficacy 3
2. Score = 21 (max 21); suitable_candidate true (14-21 more suitable). Not an opioid prescription.


## Also searched as

- DIRE score
- DIRE
- Diagnosis Intractability Risk Efficacy
- Belgrade DIRE
- DIRE opioid treatment
- DIRE chronic pain
- Belgrade 2006 DIRE score
- opioid maintenance suitability
- DIRE score for opioid treatment

## Parameters

- `diagnosis` (integer, required): Caller-assigned Belgrade 2006 Diagnosis (integer 1-3): 1 benign chronic condition with minimal objective findings or no definite diagnosis; 2 slowly progressive condition concordant with moderate pain, or fixed deficit; 3 advanced condition concordant with severe pain with objective findings. magent does not take a pain history.
- `intractability` (integer, required): Caller-assigned Belgrade 2006 Intractability (integer 1-3): 1 few therapies tried and the patient is passively involved; 2 most appropriate treatments tried with inadequate response and the patient is reasonably involved; 3 patient fully engaged in appropriate treatments with inadequate response. magent does not take a pain history.
- `psychological` (integer, required): Caller-assigned Belgrade 2006 Risk subcategory Psychological (integer 1-3): 1 serious personality dysfunction or mental illness interfering with care; 2 personality or mental health interferes moderately; 3 good psychological functioning. One of four Risk items (Risk 4-12). magent does not interview the patient.
- `chemical` (integer, required): Caller-assigned Belgrade 2006 Risk subcategory Chemical (integer 1-3): 1 active or recent substance abuse; 2 chemical coper or history of chemical dependence in remission; 3 no chemical-dependence history. One of four Risk items (Risk 4-12). magent does not interview the patient.
- `reliability` (integer, required): Caller-assigned Belgrade 2006 Risk subcategory Reliability (integer 1-3): 1 many missed appointments, lacks insight, or poor observer of laws and rules; 2 generally reliable; 3 highly reliable. One of four Risk items (Risk 4-12). magent does not interview the patient.
- `social_support` (integer, required): Caller-assigned Belgrade 2006 Risk subcategory Social support (integer 1-3): 1 life in chaos, few resources, close relationships dysfunctional; 2 relationships exist but are strained; 3 stable supportive relationships and sufficient resources. One of four Risk items (Risk 4-12). magent does not interview the patient.
- `efficacy` (integer, required): Caller-assigned Belgrade 2006 Efficacy (integer 1-3): 1 poor function or minimal pain relief despite moderate-to-high doses; 2 moderate benefit with moderate function on moderate doses; 3 good function and pain relief on stable low-to-moderate doses. magent does not take a pain history or write an opioid prescription.

## 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/dire`
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": [
    {
      "chemical": "1",
      "diagnosis": "1",
      "efficacy": "1",
      "intractability": "1",
      "psychological": "1",
      "reliability": "1",
      "social_support": "1"
    },
    {
      "chemical": "1",
      "diagnosis": "1",
      "efficacy": "1",
      "intractability": "1",
      "psychological": "1",
      "reliability": "1",
      "social_support": "1"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/dire",
  "items": [
    {
      "reliability": 1,
      "components": [
        {
          "value": 1,
          "factor": "diagnosis",
          "points": 1,
          "present": true
        },
        {
          "value": 1,
          "factor": "intractability",
          "points": 1,
          "present": true
        },
        {
          "value": 1,
          "factor": "psychological",
          "points": 1,
          "present": true
        },
        {
          "value": 1,
          "factor": "chemical",
          "points": 1,
          "present": true
        },
        {
          "value": 1,
          "factor": "reliability",
          "points": 1,
          "present": true
        },
        {
          "value": 1,
          "factor": "social_support",
          "points": 1,
          "present": true
        },
        {
          "value": 1,
          "factor": "efficacy",
          "points": 1,
          "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": "Belgrade MJ, Schamber CD, Lindgren BR",
        "doi": "10.1016/j.jpain.2006.03.001",
        "id": "belgrade-2006",
        "pmid": "16942953",
        "source": "J Pain. 2006;7(9):671-681",
        "title": "The DIRE score: predicting outcomes of opioid prescribing for chronic pain"
      },
      "formula": "dire",
      "formula_expression": "DIRE = diagnosis + intractability + risk + efficacy; diagnosis, intractability, and efficacy each caller-assigned 1-3; risk = psychological + chemical + reliability + social_support (each 1-3, so risk 4-12); total 7-21; Belgrade 2006; score 14-21 more suitable for long-term opioid maintenance, 7-13 less suitable",
      "max_score": 21,
      "score": 7,
      "risk": 4,
      "diagnosis": 1,
      "chemical": 1,
      "efficacy": 1,
      "intractability": 1,
      "psychological": 1,
      "social_support": 1,
      "suitable_candidate": false
    },
    {
      "reliability": 1,
      "components": [
        {
          "value": 1,
          "factor": "diagnosis",
          "points": 1,
          "present": true
        },
        {
          "value": 1,
          "factor": "intractability",
          "points": 1,
          "present": true
        },
        {
          "value": 1,
          "factor": "psychological",
          "points": 1,
          "present": true
        },
        {
          "value": 1,
          "factor": "chemical",
          "points": 1,
          "present": true
        },
        {
          "value": 1,
          "factor": "reliability",
          "points": 1,
          "present": true
        },
        {
          "value": 1,
          "factor": "social_support",
          "points": 1,
          "present": true
        },
        {
          "value": 1,
          "factor": "efficacy",
          "points": 1,
          "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": "Belgrade MJ, Schamber CD, Lindgren BR",
        "doi": "10.1016/j.jpain.2006.03.001",
        "id": "belgrade-2006",
        "pmid": "16942953",
        "source": "J Pain. 2006;7(9):671-681",
        "title": "The DIRE score: predicting outcomes of opioid prescribing for chronic pain"
      },
      "formula": "dire",
      "formula_expression": "DIRE = diagnosis + intractability + risk + efficacy; diagnosis, intractability, and efficacy each caller-assigned 1-3; risk = psychological + chemical + reliability + social_support (each 1-3, so risk 4-12); total 7-21; Belgrade 2006; score 14-21 more suitable for long-term opioid maintenance, 7-13 less suitable",
      "max_score": 21,
      "score": 7,
      "risk": 4,
      "diagnosis": 1,
      "chemical": 1,
      "efficacy": 1,
      "intractability": 1,
      "psychological": 1,
      "social_support": 1,
      "suitable_candidate": false
    }
  ]
}
```

## Response fields

- `formula` (string): dire
- `formula_expression` (string): Exact expression used
- `score` (integer): Belgrade 2006 DIRE points 7-21 (Diagnosis + Intractability + Risk + Efficacy)
- `max_score` (integer): Always 21
- `suitable_candidate` (boolean): true iff score >= 14 (Belgrade 2006 more suitable for long-term opioid maintenance). Not an opioid prescription or taper order.
- `diagnosis` (integer): Caller-assigned Diagnosis points 1-3
- `intractability` (integer): Caller-assigned Intractability points 1-3
- `psychological` (integer): Caller-assigned Psychological Risk points 1-3
- `chemical` (integer): Caller-assigned Chemical Risk points 1-3
- `reliability` (integer): Caller-assigned Reliability Risk points 1-3
- `social_support` (integer): Caller-assigned Social support Risk points 1-3
- `efficacy` (integer): Caller-assigned Efficacy points 1-3
- `risk` (integer): Belgrade 2006 Risk 4-12: psychological + chemical + reliability + social_support
- `components` (array): Per-item caller-assigned points
- `citation` (object): Belgrade et al. J Pain 2006 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "reliability": 1,
  "components": [
    {
      "value": 1,
      "factor": "diagnosis",
      "points": 1,
      "present": true
    },
    {
      "value": 1,
      "factor": "intractability",
      "points": 1,
      "present": true
    },
    {
      "value": 1,
      "factor": "psychological",
      "points": 1,
      "present": true
    },
    {
      "value": 1,
      "factor": "chemical",
      "points": 1,
      "present": true
    },
    {
      "value": 1,
      "factor": "reliability",
      "points": 1,
      "present": true
    },
    {
      "value": 1,
      "factor": "social_support",
      "points": 1,
      "present": true
    },
    {
      "value": 1,
      "factor": "efficacy",
      "points": 1,
      "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": "Belgrade MJ, Schamber CD, Lindgren BR",
    "doi": "10.1016/j.jpain.2006.03.001",
    "id": "belgrade-2006",
    "pmid": "16942953",
    "source": "J Pain. 2006;7(9):671-681",
    "title": "The DIRE score: predicting outcomes of opioid prescribing for chronic pain"
  },
  "formula": "dire",
  "formula_expression": "DIRE = diagnosis + intractability + risk + efficacy; diagnosis, intractability, and efficacy each caller-assigned 1-3; risk = psychological + chemical + reliability + social_support (each 1-3, so risk 4-12); total 7-21; Belgrade 2006; score 14-21 more suitable for long-term opioid maintenance, 7-13 less suitable",
  "max_score": 21,
  "score": 7,
  "risk": 4,
  "diagnosis": 1,
  "chemical": 1,
  "efficacy": 1,
  "intractability": 1,
  "psychological": 1,
  "social_support": 1,
  "suitable_candidate": false
}
```

## Errors

- HTTP 400 `invalid_dire`: DIRE score inputs must be integers in the Belgrade 2006 published 1-3 range for diagnosis, intractability, risk subcategories, and efficacy. 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

- [ORT](https://magentlab.com/docs/ort) — Sum Webster 2005 Table 1 Opioid Risk Tool item weights for the assigned sex and return the published low, moderate, or high category.
- [Morphine milligram equivalents](https://magentlab.com/docs/mme) — Compute morphine milligram equivalents from a CDC 2022 table opioid and daily dose (or transdermal fentanyl mcg/hr).
- [PEG](https://magentlab.com/docs/peg) — Compute the Krebs 2009 PEG as the unweighted mean of three caller-assigned 0-10 integers (pain_average, enjoyment_of_life, general_activity). Potential range 0-10. Krebs 2009 did not publish a diagnostic cutoff.

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