# Agachan constipation scoring system

Agachan constipation score

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

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

## What it computes

Sum the eight Agachan 1996 constipation scoring system items from caller-assigned published table bands and return the 0-30 total and whether score > 15.

## When to use

When an agent already has the eight Agachan 1996 table bands assigned and needs the published 0-30 constipation score. magent does not take a bowel history. Not Jorge 1993 fecal incontinence scoring, not Rome, and not a laxative order.

## When not to use

- Not a medical device.
- Not a laxative order. magent does not prescribe laxatives, enemas, or digital assistance.
- Not fecal incontinence scoring. This is Agachan 1996 constipation scoring system, not Jorge 1993 fecal incontinence / CCF-FIS.
- The caller assigns the eight published table bands. magent does not take a bowel history.
- Agachan 1996 derivation patients all scored more than 15. constipation is true iff score > 15. Score 0 is the published normal pole; 30 is the published maximum. magent does not return Rome or ODS-only extra bands.

## Formula

```
wexner_constipation = frequency + painful_evacuation + incomplete_evacuation + abdominal_pain + time_per_attempt + assistance + unsuccessful_attempts + duration; Agachan 1996 eight-item constipation scoring system; frequency, painful_evacuation, incomplete_evacuation, abdominal_pain, time_per_attempt, unsuccessful_attempts, and duration each 0-4; assistance 0-2; max 30; constipation iff score > 15
```

## Citation

[A constipation scoring system to simplify evaluation and management of constipated patients](https://doi.org/10.1007/BF02056950)
Agachan F, Chen T, Pfeifer J, Reissman P, Wexner SD
Dis Colon Rectum. 1996;39(6):681-685
DOI: [10.1007/BF02056950](https://doi.org/10.1007/BF02056950)

## Worked example

### All lowest published bands

Given: `abdominal_pain=never, assistance=without_assistance, duration=0, frequency=1_2_times_per_1_2_days, incomplete_evacuation=never, painful_evacuation=never, time_per_attempt=less_than_5, unsuccessful_attempts=never`

1. Each item is the published 0 pole (frequency 1-2 times per 1-2 days; never for painful, incomplete, and abdominal pain; time less than 5 minutes; without assistance; never unsuccessful; duration 0 years)
2. Score = 0 (max 30); constipation false (Agachan 1996 cut is score > 15)


### Four items at published maxima

Given: `abdominal_pain=always, assistance=without_assistance, duration=0, frequency=less_than_once_per_month, incomplete_evacuation=always, painful_evacuation=always, time_per_attempt=less_than_5, unsuccessful_attempts=never`

1. frequency less_than_once_per_month → 4; painful_evacuation always → 4; incomplete_evacuation always → 4; abdominal_pain always → 4; remaining items 0
2. Score = 16 (max 30); constipation true (score > 15)


## Also searched as

- Wexner constipation score
- Agachan constipation score
- constipation scoring system
- Agachan 1996 CSS
- Wexner constipation
- Agachan CSS
- constipation score Agachan

## Parameters

- `frequency` (string, required): Caller-assigned Agachan 1996 frequency of bowel movements. 1_2_times_per_1_2_days (1-2 times per 1-2 days) scores 0; 2_times_per_week scores 1; once_per_week scores 2; less_than_once_per_week scores 3; less_than_once_per_month scores 4. magent does not take a bowel history.
- `painful_evacuation` (string, required): Caller-assigned Agachan 1996 painful evacuation effort. never scores 0; rarely 1; sometimes 2; usually 3; always 4. magent does not take a bowel history.
- `incomplete_evacuation` (string, required): Caller-assigned Agachan 1996 feeling of incomplete evacuation. never scores 0; rarely 1; sometimes 2; usually 3; always 4. magent does not take a bowel history.
- `abdominal_pain` (string, required): Caller-assigned Agachan 1996 abdominal pain. never scores 0; rarely 1; sometimes 2; usually 3; always 4. magent does not take a bowel history.
- `time_per_attempt` (string, required): Caller-assigned Agachan 1996 minutes in lavatory per attempt. less_than_5 scores 0; 5_10 scores 1; 10_20 scores 2; 20_30 scores 3; more_than_30 scores 4. magent does not time the attempt.
- `assistance` (string, required): Caller-assigned Agachan 1996 type of assistance. without_assistance scores 0; stimulative_laxatives scores 1; digital_assistance_or_enema scores 2. This item is 0-2 in that table, not 0-4. magent does not order laxatives, enemas, or digital assistance.
- `unsuccessful_attempts` (string, required): Caller-assigned Agachan 1996 unsuccessful attempts for evacuation per 24 hours. never scores 0; 1_3 scores 1; 3_6 scores 2; 6_9 scores 3; more_than_9 scores 4. Adjacent printed ranges overlap; the caller assigns the published band. magent does not take a bowel history.
- `duration` (string, required): Caller-assigned Agachan 1996 duration of constipation in years. 0 scores 0; 1_5 scores 1; 5_10 scores 2; 10_20 scores 3; more_than_20 scores 4. Adjacent printed ranges overlap; the caller assigns the published band. magent does not take a bowel history.

## 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/wexner_constipation`
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": [
    {
      "abdominal_pain": "never",
      "assistance": "without_assistance",
      "duration": "0",
      "frequency": "1_2_times_per_1_2_days",
      "incomplete_evacuation": "never",
      "painful_evacuation": "never",
      "time_per_attempt": "less_than_5",
      "unsuccessful_attempts": "never"
    },
    {
      "abdominal_pain": "never",
      "assistance": "without_assistance",
      "duration": "0",
      "frequency": "1_2_times_per_1_2_days",
      "incomplete_evacuation": "never",
      "painful_evacuation": "never",
      "time_per_attempt": "less_than_5",
      "unsuccessful_attempts": "never"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/wexner_constipation",
  "items": [
    {
      "components": [
        {
          "value": "1_2_times_per_1_2_days",
          "factor": "frequency",
          "points": 0,
          "present": false
        },
        {
          "value": "never",
          "factor": "painful_evacuation",
          "points": 0,
          "present": false
        },
        {
          "value": "never",
          "factor": "incomplete_evacuation",
          "points": 0,
          "present": false
        },
        {
          "value": "never",
          "factor": "abdominal_pain",
          "points": 0,
          "present": false
        },
        {
          "value": "less_than_5",
          "factor": "time_per_attempt",
          "points": 0,
          "present": false
        },
        {
          "value": "without_assistance",
          "factor": "assistance",
          "points": 0,
          "present": false
        },
        {
          "value": "never",
          "factor": "unsuccessful_attempts",
          "points": 0,
          "present": false
        },
        {
          "value": "0",
          "factor": "duration",
          "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": "Agachan F, Chen T, Pfeifer J, Reissman P, Wexner SD",
        "doi": "10.1007/BF02056950",
        "id": "agachan-1996",
        "pmid": "8646957",
        "source": "Dis Colon Rectum. 1996;39(6):681-685",
        "title": "A constipation scoring system to simplify evaluation and management of constipated patients"
      },
      "formula": "wexner_constipation",
      "formula_expression": "wexner_constipation = frequency + painful_evacuation + incomplete_evacuation + abdominal_pain + time_per_attempt + assistance + unsuccessful_attempts + duration; Agachan 1996 eight-item constipation scoring system; frequency, painful_evacuation, incomplete_evacuation, abdominal_pain, time_per_attempt, unsuccessful_attempts, and duration each 0-4; assistance 0-2; max 30; constipation iff score > 15",
      "max_score": 30,
      "score": 0,
      "cutoff": 15,
      "constipation": false
    },
    {
      "components": [
        {
          "value": "1_2_times_per_1_2_days",
          "factor": "frequency",
          "points": 0,
          "present": false
        },
        {
          "value": "never",
          "factor": "painful_evacuation",
          "points": 0,
          "present": false
        },
        {
          "value": "never",
          "factor": "incomplete_evacuation",
          "points": 0,
          "present": false
        },
        {
          "value": "never",
          "factor": "abdominal_pain",
          "points": 0,
          "present": false
        },
        {
          "value": "less_than_5",
          "factor": "time_per_attempt",
          "points": 0,
          "present": false
        },
        {
          "value": "without_assistance",
          "factor": "assistance",
          "points": 0,
          "present": false
        },
        {
          "value": "never",
          "factor": "unsuccessful_attempts",
          "points": 0,
          "present": false
        },
        {
          "value": "0",
          "factor": "duration",
          "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": "Agachan F, Chen T, Pfeifer J, Reissman P, Wexner SD",
        "doi": "10.1007/BF02056950",
        "id": "agachan-1996",
        "pmid": "8646957",
        "source": "Dis Colon Rectum. 1996;39(6):681-685",
        "title": "A constipation scoring system to simplify evaluation and management of constipated patients"
      },
      "formula": "wexner_constipation",
      "formula_expression": "wexner_constipation = frequency + painful_evacuation + incomplete_evacuation + abdominal_pain + time_per_attempt + assistance + unsuccessful_attempts + duration; Agachan 1996 eight-item constipation scoring system; frequency, painful_evacuation, incomplete_evacuation, abdominal_pain, time_per_attempt, unsuccessful_attempts, and duration each 0-4; assistance 0-2; max 30; constipation iff score > 15",
      "max_score": 30,
      "score": 0,
      "cutoff": 15,
      "constipation": false
    }
  ]
}
```

## Response fields

- `formula` (string): wexner_constipation
- `formula_expression` (string): Exact expression used
- `score` (integer): Agachan 1996 constipation scoring system points 0-30
- `max_score` (integer): 30
- `cutoff` (integer): 15. Agachan 1996 derivation patients all scored more than 15. constipation is true iff score > 15. Score 15 is not constipation by that cut.
- `constipation` (boolean): true iff score > 15 (Agachan 1996 derivation cohort). Not Rome. Not an ODS-only extra band. Not a diagnosis.
- `components` (array): Per-item Agachan 1996 points
- `citation` (object): Agachan et al. Dis Colon Rectum 1996 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": "1_2_times_per_1_2_days",
      "factor": "frequency",
      "points": 0,
      "present": false
    },
    {
      "value": "never",
      "factor": "painful_evacuation",
      "points": 0,
      "present": false
    },
    {
      "value": "never",
      "factor": "incomplete_evacuation",
      "points": 0,
      "present": false
    },
    {
      "value": "never",
      "factor": "abdominal_pain",
      "points": 0,
      "present": false
    },
    {
      "value": "less_than_5",
      "factor": "time_per_attempt",
      "points": 0,
      "present": false
    },
    {
      "value": "without_assistance",
      "factor": "assistance",
      "points": 0,
      "present": false
    },
    {
      "value": "never",
      "factor": "unsuccessful_attempts",
      "points": 0,
      "present": false
    },
    {
      "value": "0",
      "factor": "duration",
      "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": "Agachan F, Chen T, Pfeifer J, Reissman P, Wexner SD",
    "doi": "10.1007/BF02056950",
    "id": "agachan-1996",
    "pmid": "8646957",
    "source": "Dis Colon Rectum. 1996;39(6):681-685",
    "title": "A constipation scoring system to simplify evaluation and management of constipated patients"
  },
  "formula": "wexner_constipation",
  "formula_expression": "wexner_constipation = frequency + painful_evacuation + incomplete_evacuation + abdominal_pain + time_per_attempt + assistance + unsuccessful_attempts + duration; Agachan 1996 eight-item constipation scoring system; frequency, painful_evacuation, incomplete_evacuation, abdominal_pain, time_per_attempt, unsuccessful_attempts, and duration each 0-4; assistance 0-2; max 30; constipation iff score > 15",
  "max_score": 30,
  "score": 0,
  "cutoff": 15,
  "constipation": false
}
```

## Errors

- HTTP 400 `invalid_wexner_constipation`: Constipation score inputs must match Agachan 1996 frequency, evacuation, pain, time, assistance, failures, and duration bands from that paper. 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

- [Rome IV FC](https://magentlab.com/docs/rome-iv-fc) — Apply the Mearin 2016 Rome IV C2 functional constipation criteria and return symptom_count (0-6) and whether the published C2 box holds (rome_iv_fc).
- [Rome IV OIC](https://magentlab.com/docs/rome-iv-oic) — Apply the Mearin 2016 Rome IV C6 opioid-induced constipation criteria and return symptom_count (0-6) and whether the published C6 box holds (rome_iv_oic).
- [Kruis](https://magentlab.com/docs/kruis) — Sum the Kruis 1984 signed weights (history items plus physical and laboratory flags) and return whether the published IBS cutoff of 44 is met.

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