# CholeS elective cholecystectomy duration score

CholeS score

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

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

## What it computes

Sum Bharamgoudar 2018 Table 3 points from caller-assigned age, sex, indication, BMI, CBD diameter, gallbladder wall, pre-operative CT, planned intraoperative cholangiogram, previous surgical admissions, and ASA class, and return the numeric total (max 20). Does not classify operative duration or risk bands.

## When to use

When an agent has already assigned Bharamgoudar 2018 Table 3 inputs before elective laparoscopic cholecystectomy and needs the published 0-20 point total, not an operative booking, Nassar difficulty grade, or Tokyo cholecystitis/cholangitis grade.

## When not to use

- Not a medical device. This is a published arithmetic total, not an operative booking, cancellation, or theatre-time allocation.
- magent does not image the gallbladder, measure CBD diameter, or assign ASA class; the caller supplies Table 3 tokens and numbers.
- Not Nassar operative difficulty. This tool does not grade difficulty or conversion risk.
- Not Tokyo Guidelines cholecystitis or cholangitis severity. Related Tokyo tools are separate.
- Bharamgoudar 2018 reports cohort percentages lasting >90 min at score 0-3 vs >8; magent returns score and max_score only and does not classify the patient as low or high duration.

## Formula

```
CholeS = age (<40 0, >=40 1.5) + sex (female 0, male 1) + indication (pancreatitis 0, colic_dyskinesia_polyp 0.5, cbd_stone 2, acalculous_cholecystitis 2.5) + bmi_kg_m2 (<25 0, 25-35 inclusive 1, >35 2) + cbd_diameter (normal 0, dilated 2) + gallbladder_wall (normal 0, thick 1.5) + pre_operative_ct (true 1.5) + planned_intraop_cholangiogram (true 3) + previous_surgical_admissions (0 0, 1-2 1, >2 2.5) + asa_class (1 0, 2 1, 3-5 2.5); Bharamgoudar 2018 Table 3; max 20; numeric total only, no duration or risk bands
```

## Citation

[The development and validation of a scoring tool to predict the operative duration of elective laparoscopic cholecystectomy](https://doi.org/10.1007/s00464-018-6030-6)
Bharamgoudar R, Sonsale A, Hodson J, Griffiths E; CholeS Study Group, West Midlands Research Collaborative
Surg Endosc. 2018;32(7):3149-3157
DOI: [10.1007/s00464-018-6030-6](https://doi.org/10.1007/s00464-018-6030-6)

## Worked example

### All Table 3 zeros (age 35 female pancreatitis BMI 24)

Given: `age=35, asa_class=1, bmi_kg_m2=24, cbd_diameter=normal, gallbladder_wall=normal, indication=pancreatitis, planned_intraop_cholangiogram=false, pre_operative_ct=false, previous_surgical_admissions=0, sex=female`

1. Age 35 → 0; female → 0; pancreatitis → 0; BMI 24 → 0
2. CBD normal → 0; wall normal → 0; CT false → 0; IOC false → 0; admissions 0 → 0; ASA 1 → 0
3. Score = 0 (max 20). No duration band.


### All Table 3 maxima (score 20)

Given: `age=40, asa_class=3, bmi_kg_m2=36, cbd_diameter=dilated, gallbladder_wall=thick, indication=acalculous_cholecystitis, planned_intraop_cholangiogram=true, pre_operative_ct=true, previous_surgical_admissions=3, sex=male`

1. Age 40 → 1.5; male → 1; acalculous_cholecystitis → 2.5; BMI 36 → 2
2. CBD dilated → 2; wall thick → 1.5; CT true → 1.5; IOC true → 3; admissions 3 → 2.5; ASA 3 → 2.5
3. Score = 20 (max 20). No duration band.


## Also searched as

- CholeS score
- laparoscopic cholecystectomy duration
- Bharamgoudar 2018
- CholeS Study Group score
- elective cholecystectomy duration score
- gallbladder surgery duration points
- CholeS Table 3
- LC duration score
- intraoperative cholangiogram score

## Parameters

- `age` (integer, required): Age in years (integer 18-120). Bharamgoudar 2018 Table 3: <40 scores 0; ≥40 scores 1.5. Age 39 scores 0; 40 scores 1.5.
- `sex` (string, required): female or male. Female scores 0; male scores 1 (Bharamgoudar 2018 Table 3).
- `indication` (string, required): Caller-assigned indication for elective laparoscopic cholecystectomy (Bharamgoudar 2018 Table 3). pancreatitis scores 0. colic_dyskinesia_polyp (biliary colic, biliary dyskinesia, or gallbladder polyp) scores 0.5. cbd_stone scores 2. acalculous_cholecystitis scores 2.5. magent does not diagnose the indication.
- `bmi_kg_m2` (number, required): Body-mass index in kg/m^2 (10-80). Caller-supplied; magent does not compute BMI from height and weight. Bharamgoudar 2018 Table 3: <25 scores 0; 25-35 inclusive scores 1; >35 scores 2. 25.0 and 35.0 score 1; 36 scores 2.
- `cbd_diameter` (string, required): Caller-assigned common bile duct diameter (Bharamgoudar 2018 Table 3). normal scores 0; dilated scores 2. magent does not image the gallbladder or measure the CBD.
- `gallbladder_wall` (string, required): Caller-assigned gallbladder wall (Bharamgoudar 2018 Table 3). normal scores 0; thick scores 1.5. magent does not image the gallbladder.
- `pre_operative_ct` (boolean, required): Pre-operative CT as assigned by the caller (Bharamgoudar 2018 Table 3). true scores 1.5. magent does not read imaging.
- `planned_intraop_cholangiogram` (boolean, required): Planned intraoperative cholangiogram as assigned by the caller (Bharamgoudar 2018 Table 3). true scores 3. magent does not plan the operation.
- `previous_surgical_admissions` (integer, required): Previous surgical admissions, integer 0-20 (Bharamgoudar 2018 Table 3). 0 scores 0; 1-2 scores 1; >2 scores 2.5.
- `asa_class` (integer, required): ASA physical status class, integer 1-5 (Bharamgoudar 2018 Table 3; Gupta 2011 1-5 range). 1 scores 0; 2 scores 1; 3-5 scores 2.5. magent does not assign ASA class.

## 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/choles_score`
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": "35",
      "asa_class": "1",
      "bmi_kg_m2": "24",
      "cbd_diameter": "normal",
      "gallbladder_wall": "normal",
      "indication": "pancreatitis",
      "planned_intraop_cholangiogram": "false",
      "pre_operative_ct": "false",
      "previous_surgical_admissions": "0",
      "sex": "female"
    },
    {
      "age": "35",
      "asa_class": "1",
      "bmi_kg_m2": "24",
      "cbd_diameter": "normal",
      "gallbladder_wall": "normal",
      "indication": "pancreatitis",
      "planned_intraop_cholangiogram": "false",
      "pre_operative_ct": "false",
      "previous_surgical_admissions": "0",
      "sex": "female"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/choles_score",
  "items": [
    {
      "components": [
        {
          "value": 35,
          "factor": "age",
          "points": 0,
          "present": true
        },
        {
          "value": "female",
          "factor": "sex",
          "points": 0,
          "present": true
        },
        {
          "value": "pancreatitis",
          "factor": "indication",
          "points": 0,
          "present": true
        },
        {
          "value": 24.0,
          "factor": "bmi_kg_m2",
          "points": 0,
          "present": true
        },
        {
          "value": "normal",
          "factor": "cbd_diameter",
          "points": 0,
          "present": true
        },
        {
          "value": "normal",
          "factor": "gallbladder_wall",
          "points": 0,
          "present": true
        },
        {
          "factor": "pre_operative_ct",
          "points": 0,
          "present": true
        },
        {
          "factor": "planned_intraop_cholangiogram",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "previous_surgical_admissions",
          "points": 0,
          "present": true
        },
        {
          "value": 1,
          "factor": "asa_class",
          "points": 0,
          "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": "Bharamgoudar R, Sonsale A, Hodson J, Griffiths E; CholeS Study Group, West Midlands Research Collaborative",
        "doi": "10.1007/s00464-018-6030-6",
        "id": "bharamgoudar-2018",
        "pmid": "29340820",
        "source": "Surg Endosc. 2018;32(7):3149-3157",
        "title": "The development and validation of a scoring tool to predict the operative duration of elective laparoscopic cholecystectomy"
      },
      "formula": "choles_score",
      "formula_expression": "CholeS = age (<40 0, >=40 1.5) + sex (female 0, male 1) + indication (pancreatitis 0, colic_dyskinesia_polyp 0.5, cbd_stone 2, acalculous_cholecystitis 2.5) + bmi_kg_m2 (<25 0, 25-35 inclusive 1, >35 2) + cbd_diameter (normal 0, dilated 2) + gallbladder_wall (normal 0, thick 1.5) + pre_operative_ct (true 1.5) + planned_intraop_cholangiogram (true 3) + previous_surgical_admissions (0 0, 1-2 1, >2 2.5) + asa_class (1 0, 2 1, 3-5 2.5); Bharamgoudar 2018 Table 3; max 20; numeric total only, no duration or risk bands",
      "max_score": 20,
      "score": 0,
      "age_years": 35,
      "sex": "female",
      "asa_class": 1,
      "bmi_kg_m2": 24.0,
      "cbd_diameter": "normal",
      "gallbladder_wall": "normal",
      "indication": "pancreatitis",
      "planned_intraop_cholangiogram": false,
      "pre_operative_ct": false,
      "previous_surgical_admissions": 0
    },
    {
      "components": [
        {
          "value": 35,
          "factor": "age",
          "points": 0,
          "present": true
        },
        {
          "value": "female",
          "factor": "sex",
          "points": 0,
          "present": true
        },
        {
          "value": "pancreatitis",
          "factor": "indication",
          "points": 0,
          "present": true
        },
        {
          "value": 24.0,
          "factor": "bmi_kg_m2",
          "points": 0,
          "present": true
        },
        {
          "value": "normal",
          "factor": "cbd_diameter",
          "points": 0,
          "present": true
        },
        {
          "value": "normal",
          "factor": "gallbladder_wall",
          "points": 0,
          "present": true
        },
        {
          "factor": "pre_operative_ct",
          "points": 0,
          "present": true
        },
        {
          "factor": "planned_intraop_cholangiogram",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "previous_surgical_admissions",
          "points": 0,
          "present": true
        },
        {
          "value": 1,
          "factor": "asa_class",
          "points": 0,
          "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": "Bharamgoudar R, Sonsale A, Hodson J, Griffiths E; CholeS Study Group, West Midlands Research Collaborative",
        "doi": "10.1007/s00464-018-6030-6",
        "id": "bharamgoudar-2018",
        "pmid": "29340820",
        "source": "Surg Endosc. 2018;32(7):3149-3157",
        "title": "The development and validation of a scoring tool to predict the operative duration of elective laparoscopic cholecystectomy"
      },
      "formula": "choles_score",
      "formula_expression": "CholeS = age (<40 0, >=40 1.5) + sex (female 0, male 1) + indication (pancreatitis 0, colic_dyskinesia_polyp 0.5, cbd_stone 2, acalculous_cholecystitis 2.5) + bmi_kg_m2 (<25 0, 25-35 inclusive 1, >35 2) + cbd_diameter (normal 0, dilated 2) + gallbladder_wall (normal 0, thick 1.5) + pre_operative_ct (true 1.5) + planned_intraop_cholangiogram (true 3) + previous_surgical_admissions (0 0, 1-2 1, >2 2.5) + asa_class (1 0, 2 1, 3-5 2.5); Bharamgoudar 2018 Table 3; max 20; numeric total only, no duration or risk bands",
      "max_score": 20,
      "score": 0,
      "age_years": 35,
      "sex": "female",
      "asa_class": 1,
      "bmi_kg_m2": 24.0,
      "cbd_diameter": "normal",
      "gallbladder_wall": "normal",
      "indication": "pancreatitis",
      "planned_intraop_cholangiogram": false,
      "pre_operative_ct": false,
      "previous_surgical_admissions": 0
    }
  ]
}
```

## Response fields

- `formula` (string): choles_score
- `formula_expression` (string): Exact expression used
- `score` (number): Bharamgoudar 2018 Table 3 points 0-20 (half-points allowed; not integer-rounded). Numeric total only; not a duration or risk band.
- `max_score` (integer): Always 20
- `age_years` (integer): Age used for the exclusive age band
- `sex` (string): female or male used for the sex points
- `indication` (string): Exclusive indication used (pancreatitis, colic_dyskinesia_polyp, cbd_stone, or acalculous_cholecystitis)
- `bmi_kg_m2` (number): BMI in kg/m^2 used for the exclusive BMI band
- `cbd_diameter` (string): Caller-assigned CBD diameter used (normal or dilated)
- `gallbladder_wall` (string): Caller-assigned gallbladder wall used (normal or thick)
- `pre_operative_ct` (boolean): Whether pre-operative CT was assigned true
- `planned_intraop_cholangiogram` (boolean): Whether planned intraoperative cholangiogram was assigned true
- `previous_surgical_admissions` (integer): Previous surgical admissions used (0-20)
- `asa_class` (integer): ASA class used (1-5)
- `components` (array): Per-factor Bharamgoudar 2018 Table 3 points
- `citation` (object): Bharamgoudar et al. Surg Endosc 2018 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": 35,
      "factor": "age",
      "points": 0,
      "present": true
    },
    {
      "value": "female",
      "factor": "sex",
      "points": 0,
      "present": true
    },
    {
      "value": "pancreatitis",
      "factor": "indication",
      "points": 0,
      "present": true
    },
    {
      "value": 24.0,
      "factor": "bmi_kg_m2",
      "points": 0,
      "present": true
    },
    {
      "value": "normal",
      "factor": "cbd_diameter",
      "points": 0,
      "present": true
    },
    {
      "value": "normal",
      "factor": "gallbladder_wall",
      "points": 0,
      "present": true
    },
    {
      "factor": "pre_operative_ct",
      "points": 0,
      "present": true
    },
    {
      "factor": "planned_intraop_cholangiogram",
      "points": 0,
      "present": true
    },
    {
      "value": 0,
      "factor": "previous_surgical_admissions",
      "points": 0,
      "present": true
    },
    {
      "value": 1,
      "factor": "asa_class",
      "points": 0,
      "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": "Bharamgoudar R, Sonsale A, Hodson J, Griffiths E; CholeS Study Group, West Midlands Research Collaborative",
    "doi": "10.1007/s00464-018-6030-6",
    "id": "bharamgoudar-2018",
    "pmid": "29340820",
    "source": "Surg Endosc. 2018;32(7):3149-3157",
    "title": "The development and validation of a scoring tool to predict the operative duration of elective laparoscopic cholecystectomy"
  },
  "formula": "choles_score",
  "formula_expression": "CholeS = age (<40 0, >=40 1.5) + sex (female 0, male 1) + indication (pancreatitis 0, colic_dyskinesia_polyp 0.5, cbd_stone 2, acalculous_cholecystitis 2.5) + bmi_kg_m2 (<25 0, 25-35 inclusive 1, >35 2) + cbd_diameter (normal 0, dilated 2) + gallbladder_wall (normal 0, thick 1.5) + pre_operative_ct (true 1.5) + planned_intraop_cholangiogram (true 3) + previous_surgical_admissions (0 0, 1-2 1, >2 2.5) + asa_class (1 0, 2 1, 3-5 2.5); Bharamgoudar 2018 Table 3; max 20; numeric total only, no duration or risk bands",
  "max_score": 20,
  "score": 0,
  "age_years": 35,
  "sex": "female",
  "asa_class": 1,
  "bmi_kg_m2": 24.0,
  "cbd_diameter": "normal",
  "gallbladder_wall": "normal",
  "indication": "pancreatitis",
  "planned_intraop_cholangiogram": false,
  "pre_operative_ct": false,
  "previous_surgical_admissions": 0
}
```

## 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_bmi_kg_m2`: bmi_kg_m2 must be a number from 10 to 80. Returned before settlement; you are not charged.
- HTTP 400 `invalid_asa_class`: asa_class must be an integer from 1 to 5 (Gupta 2011 ASA physical status). 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_choles`: indication must be pancreatitis, colic_dyskinesia_polyp, cbd_stone, or acalculous_cholecystitis; cbd_diameter normal or dilated; gallbladder_wall normal or thick; previous_surgical_admissions an integer 0-20 (Bharamgoudar 2018 CholeS Table 3). 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

- [Tokyo cholangitis](https://magentlab.com/docs/tokyo-cholangitis) — Apply Kiriyama 2018 Tokyo Guidelines 2018 diagnostic criteria and severity grading of acute cholangitis (unchanged from TG13) and return diagnosis (definite, suspected, or none) and severity (grade_i, grade_ii, grade_iii, or none) from caller-assigned flags and age.
- [Tokyo cholecystitis](https://magentlab.com/docs/tokyo-cholecystitis) — Apply Yokoe 2018 Tokyo Guidelines 2018 diagnostic criteria and severity grading of acute cholecystitis (unchanged from TG13) and return diagnosis (definite, suspected, or none) and severity (grade_i, grade_ii, grade_iii, or none) from caller-assigned flags.

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