# IOTA Simple Rules

IOTA Simple Rules

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

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

## What it computes

Apply Timmerman 2008 simple ultrasound-based rules from ten caller-assigned M-rule and B-rule flags and return m_count, b_count, and whether the mass classifies as malignant, benign, or inconclusive.

## When to use

When an agent already has the ten caller-assigned Timmerman 2008 M-rule and B-rule ultrasound flags and needs the published Simple Rules classification. magent does not read ultrasound. Not a diagnosis of ovarian cancer, not RMI, not Swede, and not the later SRRisk logistic model.

## When not to use

- Not a medical device.
- Not a diagnosis of ovarian cancer. magent does not diagnose ovarian cancer.
- Timmerman 2008 Simple Rules only. Not the later SRRisk logistic model. Not RMI. Not Swede.
- The caller assigns ten ultrasound flags. magent does not read ultrasound or perform Doppler.
- Rules classify as malignant when one or more M-rules apply and no B-rule applies, and as benign when one or more B-rules apply and no M-rule applies. Otherwise inconclusive. magent does not invent a probability.

## Formula

```
classification malignant iff m_count >= 1 and b_count == 0; benign iff b_count >= 1 and m_count == 0; otherwise inconclusive; m_count counts irregular_solid_tumor, ascites, at_least_four_papillary_structures, irregular_multilocular_solid_ge_100mm, very_high_color_doppler; b_count counts unilocular_cyst, solid_component_lt_7mm, acoustic_shadows, smooth_multilocular_lt_100mm, no_detectable_blood_flow (Timmerman 2008 Simple Rules; not SRRisk)
```

## Citation

[Simple ultrasound-based rules for the diagnosis of ovarian cancer.](https://doi.org/10.1002/uog.5365)
Timmerman D, Testa AC, Bourne T, Ameye L, Jurkovic D, Van Holsbeke C, Paladini D, Van Calster B, Vergote I, Van Huffel S, Valentin L
Ultrasound Obstet Gynecol. 2008;31(6):681-690
DOI: [10.1002/uog.5365](https://doi.org/10.1002/uog.5365)

## Worked example

### Ascites only (malignant)

Given: `acoustic_shadows=false, ascites=true, at_least_four_papillary_structures=false, irregular_multilocular_solid_ge_100mm=false, irregular_solid_tumor=false, no_detectable_blood_flow=false, smooth_multilocular_lt_100mm=false, solid_component_lt_7mm=false, unilocular_cyst=false, very_high_color_doppler=false`

1. Ascites is true; the other four M-rules are false (m_count 1)
2. All five B-rules are false (b_count 0)
3. m_count >= 1 and b_count == 0 → classification malignant


### No M-rules or B-rules (inconclusive)

Given: `acoustic_shadows=false, ascites=false, at_least_four_papillary_structures=false, irregular_multilocular_solid_ge_100mm=false, irregular_solid_tumor=false, no_detectable_blood_flow=false, smooth_multilocular_lt_100mm=false, solid_component_lt_7mm=false, unilocular_cyst=false, very_high_color_doppler=false`

1. All ten flags are false (m_count 0, b_count 0)
2. Neither M-rules nor B-rules apply → classification inconclusive


## Also searched as

- IOTA Simple Rules
- Timmerman 2008 simple rules
- simple ultrasound-based rules
- ovarian M-rules B-rules
- ovarian ultrasound simple rules
- Timmerman ovarian rules

## Parameters

- `irregular_solid_tumor` (boolean, required): Irregular solid tumor (M-rule). true or false as assigned by the caller (Timmerman 2008). magent does not read ultrasound.
- `ascites` (boolean, required): Ascites (M-rule). true or false as assigned by the caller. magent does not read ultrasound.
- `at_least_four_papillary_structures` (boolean, required): At least four papillary structures (M-rule). true or false as assigned by the caller. magent does not read ultrasound.
- `irregular_multilocular_solid_ge_100mm` (boolean, required): Irregular multilocular-solid tumor with largest diameter ≥100 mm (M-rule). true or false as assigned by the caller. magent does not measure the mass.
- `very_high_color_doppler` (boolean, required): Very high color content on color Doppler (M-rule). true or false as assigned by the caller. magent does not perform Doppler.
- `unilocular_cyst` (boolean, required): Unilocular cyst (B-rule). true or false as assigned by the caller. magent does not read ultrasound.
- `solid_component_lt_7mm` (boolean, required): Solid components with largest solid component <7 mm (B-rule). true or false as assigned by the caller. magent does not measure the mass.
- `acoustic_shadows` (boolean, required): Acoustic shadows (B-rule). true or false as assigned by the caller. magent does not read ultrasound.
- `smooth_multilocular_lt_100mm` (boolean, required): Smooth multilocular tumor <100 mm largest diameter (B-rule). true or false as assigned by the caller. magent does not measure the mass.
- `no_detectable_blood_flow` (boolean, required): No detectable blood flow on Doppler (B-rule). true or false as assigned by the caller. magent does not perform Doppler.

## 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/iota`
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": [
    {
      "acoustic_shadows": "false",
      "ascites": "true",
      "at_least_four_papillary_structures": "false",
      "irregular_multilocular_solid_ge_100mm": "false",
      "irregular_solid_tumor": "false",
      "no_detectable_blood_flow": "false",
      "smooth_multilocular_lt_100mm": "false",
      "solid_component_lt_7mm": "false",
      "unilocular_cyst": "false",
      "very_high_color_doppler": "false"
    },
    {
      "acoustic_shadows": "false",
      "ascites": "true",
      "at_least_four_papillary_structures": "false",
      "irregular_multilocular_solid_ge_100mm": "false",
      "irregular_solid_tumor": "false",
      "no_detectable_blood_flow": "false",
      "smooth_multilocular_lt_100mm": "false",
      "solid_component_lt_7mm": "false",
      "unilocular_cyst": "false",
      "very_high_color_doppler": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/iota",
  "items": [
    {
      "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": "Timmerman D, Testa AC, Bourne T, Ameye L, Jurkovic D, Van Holsbeke C, Paladini D, Van Calster B, Vergote I, Van Huffel S, Valentin L",
        "doi": "10.1002/uog.5365",
        "id": "timmerman-2008",
        "pmid": "18504770",
        "source": "Ultrasound Obstet Gynecol. 2008;31(6):681-690",
        "title": "Simple ultrasound-based rules for the diagnosis of ovarian cancer."
      },
      "formula": "iota",
      "formula_expression": "classification malignant iff m_count >= 1 and b_count == 0; benign iff b_count >= 1 and m_count == 0; otherwise inconclusive; m_count counts irregular_solid_tumor, ascites, at_least_four_papillary_structures, irregular_multilocular_solid_ge_100mm, very_high_color_doppler; b_count counts unilocular_cyst, solid_component_lt_7mm, acoustic_shadows, smooth_multilocular_lt_100mm, no_detectable_blood_flow (Timmerman 2008 Simple Rules; not SRRisk)",
      "criteria": [
        {
          "factor": "irregular_solid_tumor",
          "met": false
        },
        {
          "factor": "ascites",
          "met": true
        },
        {
          "factor": "at_least_four_papillary_structures",
          "met": false
        },
        {
          "factor": "irregular_multilocular_solid_ge_100mm",
          "met": false
        },
        {
          "factor": "very_high_color_doppler",
          "met": false
        },
        {
          "factor": "unilocular_cyst",
          "met": false
        },
        {
          "factor": "solid_component_lt_7mm",
          "met": false
        },
        {
          "factor": "acoustic_shadows",
          "met": false
        },
        {
          "factor": "smooth_multilocular_lt_100mm",
          "met": false
        },
        {
          "factor": "no_detectable_blood_flow",
          "met": false
        }
      ],
      "classification": "malignant",
      "b_count": 0,
      "m_count": 1
    },
    {
      "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": "Timmerman D, Testa AC, Bourne T, Ameye L, Jurkovic D, Van Holsbeke C, Paladini D, Van Calster B, Vergote I, Van Huffel S, Valentin L",
        "doi": "10.1002/uog.5365",
        "id": "timmerman-2008",
        "pmid": "18504770",
        "source": "Ultrasound Obstet Gynecol. 2008;31(6):681-690",
        "title": "Simple ultrasound-based rules for the diagnosis of ovarian cancer."
      },
      "formula": "iota",
      "formula_expression": "classification malignant iff m_count >= 1 and b_count == 0; benign iff b_count >= 1 and m_count == 0; otherwise inconclusive; m_count counts irregular_solid_tumor, ascites, at_least_four_papillary_structures, irregular_multilocular_solid_ge_100mm, very_high_color_doppler; b_count counts unilocular_cyst, solid_component_lt_7mm, acoustic_shadows, smooth_multilocular_lt_100mm, no_detectable_blood_flow (Timmerman 2008 Simple Rules; not SRRisk)",
      "criteria": [
        {
          "factor": "irregular_solid_tumor",
          "met": false
        },
        {
          "factor": "ascites",
          "met": true
        },
        {
          "factor": "at_least_four_papillary_structures",
          "met": false
        },
        {
          "factor": "irregular_multilocular_solid_ge_100mm",
          "met": false
        },
        {
          "factor": "very_high_color_doppler",
          "met": false
        },
        {
          "factor": "unilocular_cyst",
          "met": false
        },
        {
          "factor": "solid_component_lt_7mm",
          "met": false
        },
        {
          "factor": "acoustic_shadows",
          "met": false
        },
        {
          "factor": "smooth_multilocular_lt_100mm",
          "met": false
        },
        {
          "factor": "no_detectable_blood_flow",
          "met": false
        }
      ],
      "classification": "malignant",
      "b_count": 0,
      "m_count": 1
    }
  ]
}
```

## Response fields

- `formula` (string): iota
- `formula_expression` (string): Timmerman 2008 Simple Rules: malignant if any M-rule and no B-rule; benign if any B-rule and no M-rule; otherwise inconclusive
- `classification` (string): malignant, benign, or inconclusive. Not a diagnosis of ovarian cancer. Not RMI. Not Swede. Not SRRisk.
- `m_count` (integer): Count of true M-rules among irregular solid tumor, ascites, at least four papillary structures, irregular multilocular-solid ≥100 mm, and very high color Doppler (0-5)
- `b_count` (integer): Count of true B-rules among unilocular cyst, solid component <7 mm, acoustic shadows, smooth multilocular <100 mm, and no detectable blood flow (0-5)
- `criteria` (array): Per-flag rows with factor and met for each of the ten M-rules and B-rules
- `citation` (object): Timmerman 2008 Ultrasound Obstet Gynecol citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "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": "Timmerman D, Testa AC, Bourne T, Ameye L, Jurkovic D, Van Holsbeke C, Paladini D, Van Calster B, Vergote I, Van Huffel S, Valentin L",
    "doi": "10.1002/uog.5365",
    "id": "timmerman-2008",
    "pmid": "18504770",
    "source": "Ultrasound Obstet Gynecol. 2008;31(6):681-690",
    "title": "Simple ultrasound-based rules for the diagnosis of ovarian cancer."
  },
  "formula": "iota",
  "formula_expression": "classification malignant iff m_count >= 1 and b_count == 0; benign iff b_count >= 1 and m_count == 0; otherwise inconclusive; m_count counts irregular_solid_tumor, ascites, at_least_four_papillary_structures, irregular_multilocular_solid_ge_100mm, very_high_color_doppler; b_count counts unilocular_cyst, solid_component_lt_7mm, acoustic_shadows, smooth_multilocular_lt_100mm, no_detectable_blood_flow (Timmerman 2008 Simple Rules; not SRRisk)",
  "criteria": [
    {
      "factor": "irregular_solid_tumor",
      "met": false
    },
    {
      "factor": "ascites",
      "met": true
    },
    {
      "factor": "at_least_four_papillary_structures",
      "met": false
    },
    {
      "factor": "irregular_multilocular_solid_ge_100mm",
      "met": false
    },
    {
      "factor": "very_high_color_doppler",
      "met": false
    },
    {
      "factor": "unilocular_cyst",
      "met": false
    },
    {
      "factor": "solid_component_lt_7mm",
      "met": false
    },
    {
      "factor": "acoustic_shadows",
      "met": false
    },
    {
      "factor": "smooth_multilocular_lt_100mm",
      "met": false
    },
    {
      "factor": "no_detectable_blood_flow",
      "met": false
    }
  ],
  "classification": "malignant",
  "b_count": 0,
  "m_count": 1
}
```

## Errors

- HTTP 400 `invalid_iota`: IOTA Simple Rules need ten caller-assigned M and B ultrasound flags (Timmerman 2008). 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

- [RMI](https://magentlab.com/docs/rmi) — Compute the Jacobs 1990 risk of malignancy index as ultrasound score × menopausal score × CA125 (U/ml), then whether that product exceeds the published cutoff of 200.
- [Swede score](https://magentlab.com/docs/swede) — Sum five caller-assigned Strander 2005 Swede integers (acetowhiteness, margins_surface, vessels, lesion_size, iodine; each 0-2; max 10) and return the published total and <5 / 5-7 / >=8 bands.

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