# Opioid Risk Tool (Webster 2005)

ORT

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

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

## What it computes

Sum Webster 2005 Table 1 Opioid Risk Tool item weights for the assigned sex and return the published low, moderate, or high category.

## When to use

When an agent has already assigned the ten yes/no flags and sex and needs the published 2005 point total, not an interview, not a diagnosis of opioid use disorder, and not the 2019 ORT-OUD revision.

## When not to use

- Not a medical device.
- Not a diagnosis of opioid use disorder. Not the 2019 ORT-OUD revision.
- The caller assigns each flag. magent does not interview the patient or take free-text abuse history.
- Flags are PHI-adjacent. Persist them only encrypted for the allowlisted console.
- Age 16-45 is a yes/no flag, not a numeric age. Preadolescent sexual abuse is 3 points for females and 0 for males (Webster 2005 Table 1).

## Formula

```
ORT = Webster 2005 Table 1 sex-specific weights; family_alcohol F1/M3 + family_illegal_drugs F2/M3 + family_prescription_drugs 4 + personal_alcohol 3 + personal_illegal_drugs 4 + personal_prescription_drugs 5 + age_16_to_45 1 + preadolescent_sexual_abuse F3/M0 + add_ocd_bipolar_schizophrenia 2 + depression 1; absent = 0; low 0-3, moderate 4-7, high >=8; max 26
```

## Citation

[Predicting aberrant behaviors in opioid-treated patients: preliminary validation of the Opioid Risk Tool](https://doi.org/10.1111/j.1526-4637.2005.00072.x)
Webster LR, Webster RM
Pain Med. 2005;6(6):432-442
DOI: [10.1111/j.1526-4637.2005.00072.x](https://doi.org/10.1111/j.1526-4637.2005.00072.x)

## Worked example

### Female, all flags false

Given: `add_ocd_bipolar_schizophrenia=false, age_16_to_45=false, depression=false, family_alcohol=false, family_illegal_drugs=false, family_prescription_drugs=false, personal_alcohol=false, personal_illegal_drugs=false, personal_prescription_drugs=false, preadolescent_sexual_abuse=false, sex=female`

1. every Table 1 item absent → 0
2. score = 0; risk low


### Female family prescription drugs, personal alcohol, and age 16-45

Given: `add_ocd_bipolar_schizophrenia=false, age_16_to_45=true, depression=false, family_alcohol=false, family_illegal_drugs=false, family_prescription_drugs=true, personal_alcohol=true, personal_illegal_drugs=false, personal_prescription_drugs=false, preadolescent_sexual_abuse=false, sex=female`

1. family_prescription_drugs 4 + personal_alcohol 3 + age_16_to_45 1
2. score = 8; risk high


## Also searched as

- opioid risk tool
- Webster ORT
- ORT score
- opioid aberrant behavior
- Webster 2005 opioid risk
- ORT Pain Medicine 2005

## Parameters

- `sex` (string, required): female or male. Webster 2005 Table 1 item weights are sex-specific. Assigned by the caller.
- `family_alcohol` (boolean, required): Family history of alcohol abuse as assigned by the caller (Webster 2005 Table 1). Female 1, male 3. true or false. magent does not interview the patient.
- `family_illegal_drugs` (boolean, required): Family history of illegal-drug abuse as assigned by the caller (Webster 2005 Table 1). Female 2, male 3. true or false.
- `family_prescription_drugs` (boolean, required): Family history of prescription-drug abuse as assigned by the caller (Webster 2005 Table 1). 4 points. true or false.
- `personal_alcohol` (boolean, required): Personal history of alcohol abuse as assigned by the caller (Webster 2005 Table 1). 3 points. true or false. magent does not interview the patient.
- `personal_illegal_drugs` (boolean, required): Personal history of illegal-drug abuse as assigned by the caller (Webster 2005 Table 1). 4 points. true or false.
- `personal_prescription_drugs` (boolean, required): Personal history of prescription-drug abuse as assigned by the caller (Webster 2005 Table 1). 5 points. true or false.
- `age_16_to_45` (boolean, required): Age 16-45 years as a flag, not a numeric age (Webster 2005 Table 1). true scores 1. Assigned by the caller.
- `preadolescent_sexual_abuse` (boolean, required): History of preadolescent sexual abuse as assigned by the caller (Webster 2005 Table 1). Female 3, male 0. true or false. magent does not interview the patient.
- `add_ocd_bipolar_schizophrenia` (boolean, required): ADD, OCD, bipolar disorder, or schizophrenia as one flag (Webster 2005 Table 1). true scores 2. Assigned by the caller. magent does not diagnose.
- `depression` (boolean, required): Depression as assigned by the caller (Webster 2005 Table 1). true scores 1. magent does not diagnose.

## 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/ort`
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": [
    {
      "add_ocd_bipolar_schizophrenia": "false",
      "age_16_to_45": "false",
      "depression": "false",
      "family_alcohol": "false",
      "family_illegal_drugs": "false",
      "family_prescription_drugs": "false",
      "personal_alcohol": "false",
      "personal_illegal_drugs": "false",
      "personal_prescription_drugs": "false",
      "preadolescent_sexual_abuse": "false",
      "sex": "female"
    },
    {
      "add_ocd_bipolar_schizophrenia": "false",
      "age_16_to_45": "false",
      "depression": "false",
      "family_alcohol": "false",
      "family_illegal_drugs": "false",
      "family_prescription_drugs": "false",
      "personal_alcohol": "false",
      "personal_illegal_drugs": "false",
      "personal_prescription_drugs": "false",
      "preadolescent_sexual_abuse": "false",
      "sex": "female"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/ort",
  "items": [
    {
      "components": [
        {
          "factor": "family_alcohol",
          "points": 0,
          "present": false
        },
        {
          "factor": "family_illegal_drugs",
          "points": 0,
          "present": false
        },
        {
          "factor": "family_prescription_drugs",
          "points": 0,
          "present": false
        },
        {
          "factor": "personal_alcohol",
          "points": 0,
          "present": false
        },
        {
          "factor": "personal_illegal_drugs",
          "points": 0,
          "present": false
        },
        {
          "factor": "personal_prescription_drugs",
          "points": 0,
          "present": false
        },
        {
          "factor": "age_16_to_45",
          "points": 0,
          "present": false
        },
        {
          "factor": "preadolescent_sexual_abuse",
          "points": 0,
          "present": false
        },
        {
          "factor": "add_ocd_bipolar_schizophrenia",
          "points": 0,
          "present": false
        },
        {
          "factor": "depression",
          "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": "Webster LR, Webster RM",
        "doi": "10.1111/j.1526-4637.2005.00072.x",
        "id": "webster-2005",
        "pmid": "16336480",
        "source": "Pain Med. 2005;6(6):432-442",
        "title": "Predicting aberrant behaviors in opioid-treated patients: preliminary validation of the Opioid Risk Tool"
      },
      "formula": "ort",
      "formula_expression": "ORT = Webster 2005 Table 1 sex-specific weights; family_alcohol F1/M3 + family_illegal_drugs F2/M3 + family_prescription_drugs 4 + personal_alcohol 3 + personal_illegal_drugs 4 + personal_prescription_drugs 5 + age_16_to_45 1 + preadolescent_sexual_abuse F3/M0 + add_ocd_bipolar_schizophrenia 2 + depression 1; absent = 0; low 0-3, moderate 4-7, high >=8; max 26",
      "max_score": 26,
      "score": 0,
      "sex": "female",
      "risk": "low"
    },
    {
      "components": [
        {
          "factor": "family_alcohol",
          "points": 0,
          "present": false
        },
        {
          "factor": "family_illegal_drugs",
          "points": 0,
          "present": false
        },
        {
          "factor": "family_prescription_drugs",
          "points": 0,
          "present": false
        },
        {
          "factor": "personal_alcohol",
          "points": 0,
          "present": false
        },
        {
          "factor": "personal_illegal_drugs",
          "points": 0,
          "present": false
        },
        {
          "factor": "personal_prescription_drugs",
          "points": 0,
          "present": false
        },
        {
          "factor": "age_16_to_45",
          "points": 0,
          "present": false
        },
        {
          "factor": "preadolescent_sexual_abuse",
          "points": 0,
          "present": false
        },
        {
          "factor": "add_ocd_bipolar_schizophrenia",
          "points": 0,
          "present": false
        },
        {
          "factor": "depression",
          "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": "Webster LR, Webster RM",
        "doi": "10.1111/j.1526-4637.2005.00072.x",
        "id": "webster-2005",
        "pmid": "16336480",
        "source": "Pain Med. 2005;6(6):432-442",
        "title": "Predicting aberrant behaviors in opioid-treated patients: preliminary validation of the Opioid Risk Tool"
      },
      "formula": "ort",
      "formula_expression": "ORT = Webster 2005 Table 1 sex-specific weights; family_alcohol F1/M3 + family_illegal_drugs F2/M3 + family_prescription_drugs 4 + personal_alcohol 3 + personal_illegal_drugs 4 + personal_prescription_drugs 5 + age_16_to_45 1 + preadolescent_sexual_abuse F3/M0 + add_ocd_bipolar_schizophrenia 2 + depression 1; absent = 0; low 0-3, moderate 4-7, high >=8; max 26",
      "max_score": 26,
      "score": 0,
      "sex": "female",
      "risk": "low"
    }
  ]
}
```

## Response fields

- `formula` (string): ort
- `formula_expression` (string): Exact expression used
- `score` (integer): Webster 2005 Table 1 points 0-26
- `max_score` (integer): 26
- `risk` (string): Webster 2005 category: low (0-3), moderate (4-7), or high (>=8). Not a diagnosis of opioid use disorder.
- `sex` (string): female or male
- `components` (array): Per-item points for the assigned sex
- `citation` (object): Webster and Webster Pain Medicine 2005 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "factor": "family_alcohol",
      "points": 0,
      "present": false
    },
    {
      "factor": "family_illegal_drugs",
      "points": 0,
      "present": false
    },
    {
      "factor": "family_prescription_drugs",
      "points": 0,
      "present": false
    },
    {
      "factor": "personal_alcohol",
      "points": 0,
      "present": false
    },
    {
      "factor": "personal_illegal_drugs",
      "points": 0,
      "present": false
    },
    {
      "factor": "personal_prescription_drugs",
      "points": 0,
      "present": false
    },
    {
      "factor": "age_16_to_45",
      "points": 0,
      "present": false
    },
    {
      "factor": "preadolescent_sexual_abuse",
      "points": 0,
      "present": false
    },
    {
      "factor": "add_ocd_bipolar_schizophrenia",
      "points": 0,
      "present": false
    },
    {
      "factor": "depression",
      "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": "Webster LR, Webster RM",
    "doi": "10.1111/j.1526-4637.2005.00072.x",
    "id": "webster-2005",
    "pmid": "16336480",
    "source": "Pain Med. 2005;6(6):432-442",
    "title": "Predicting aberrant behaviors in opioid-treated patients: preliminary validation of the Opioid Risk Tool"
  },
  "formula": "ort",
  "formula_expression": "ORT = Webster 2005 Table 1 sex-specific weights; family_alcohol F1/M3 + family_illegal_drugs F2/M3 + family_prescription_drugs 4 + personal_alcohol 3 + personal_illegal_drugs 4 + personal_prescription_drugs 5 + age_16_to_45 1 + preadolescent_sexual_abuse F3/M0 + add_ocd_bipolar_schizophrenia 2 + depression 1; absent = 0; low 0-3, moderate 4-7, high >=8; max 26",
  "max_score": 26,
  "score": 0,
  "sex": "female",
  "risk": "low"
}
```

## Errors

- HTTP 400 `invalid_sex`: sex must be female or male 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

- [COWS](https://magentlab.com/docs/cows) — Sum the eleven Wesson 2003 Clinical Opiate Withdrawal Scale (COWS) items from caller-assigned appendix integers and return the published total (max 48) with the published severity cutoffs.
- [PAWSS](https://magentlab.com/docs/pawss) — Apply the Maldonado 2014 PAWSS Part A threshold and ten yes/no items and return the published 0–10 total with the ≥4 high-risk band.
- [CAGE](https://magentlab.com/docs/cage) — Sum the four Ewing 1984 CAGE items and return whether two or more answers are affirmative.

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