# Asthma Predictive Index

Asthma Predictive Index

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

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

## What it computes

Apply Castro-Rodriguez 2000 Table 1 and return stringent and loose Asthma Predictive Index flags from caller-assigned early-wheeze class and five major/minor criteria.

## When to use

When an agent has caller-assigned early-wheeze frequency (none, any, or frequent) and the published major and minor criteria for a young child with recurrent wheezing and needs the Castro-Rodriguez 2000 Asthma Predictive Index, not mAPI and not an asthma diagnosis.

## When not to use

- Not a medical device. Not a diagnosis of asthma. magent does not examine the child.
- This tool is the Castro-Rodriguez 2000 original Asthma Predictive Index (stringent and loose) only. It is not the modified Asthma Predictive Index (mAPI).
- The caller assigns parental MD asthma, MD eczema, MD allergic rhinitis, wheezing apart from colds, and circulating eosinophils >4% of WBC. magent does not take an eosinophil percent and does not interpret a CBC.
- Derivation was in the Tucson Children's Respiratory Study among children with recurrent wheezing in the first 3 years. magent does not take numeric age.
- stringent_positive and loose_positive are published risk-index flags, not an asthma diagnosis or a treatment or inhaler order.

## Formula

```
stringent_positive iff wheeze is frequent and (major_count >= 1 or minor_count >= 2); loose_positive iff wheeze is any or frequent and the same risk factors; majors parental_md_asthma and md_eczema; minors md_allergic_rhinitis, wheezing_apart_from_colds, eosinophilia_gt_4pct (Castro-Rodriguez 2000 Table 1)
```

## Citation

[A clinical index to define risk of asthma in young children with recurrent wheezing](https://doi.org/10.1164/ajrccm.162.4.9912111)
Castro-Rodríguez JA, Holberg CJ, Wright AL, Martinez FD
Am J Respir Crit Care Med. 2000;162(4 Pt 1):1403-1406
DOI: [10.1164/ajrccm.162.4.9912111](https://doi.org/10.1164/ajrccm.162.4.9912111)

## Worked example

### No early wheeze and no criteria

Given: `eosinophilia_gt_4pct=false, md_allergic_rhinitis=false, md_eczema=false, parental_md_asthma=false, wheeze=none, wheezing_apart_from_colds=false`

1. wheeze is none (not an early wheezer)
2. No major or minor criterion is present
3. Both stringent and loose indices are negative


### Early wheezer with one major is loose only

Given: `eosinophilia_gt_4pct=false, md_allergic_rhinitis=false, md_eczema=false, parental_md_asthma=true, wheeze=any, wheezing_apart_from_colds=false`

1. wheeze is any (early wheezer; chest ever sounded wheezy in the first 3 years)
2. One major criterion (parental MD asthma) meets risk factors
3. Loose index is positive; stringent index requires frequent wheeze and stays negative


### Early frequent wheezer with one major is stringent and loose

Given: `eosinophilia_gt_4pct=false, md_allergic_rhinitis=false, md_eczema=false, parental_md_asthma=true, wheeze=frequent, wheezing_apart_from_colds=false`

1. wheeze is frequent (early frequent wheezer; parent frequency scale > 3)
2. One major criterion meets risk factors
3. Both stringent and loose indices are positive


## Also searched as

- Asthma Predictive Index
- Castro-Rodriguez API
- Tucson API
- stringent Asthma Predictive Index
- loose Asthma Predictive Index
- early frequent wheezer
- Castro-Rodriguez 2000
- pediatric recurrent wheeze index

## Parameters

- `wheeze` (string, required): Early-wheeze class from Castro-Rodriguez 2000. none = not an early wheezer; any = early wheezer (chest ever sounded wheezy in the first 3 years); frequent = early frequent wheezer (parent frequency scale > 3). Loose index requires any or frequent. Stringent index requires frequent.
- `parental_md_asthma` (boolean, required): Parental physician-diagnosed asthma as assigned by the caller. true or false. Major criterion (Castro-Rodriguez 2000 Table 1). magent does not take a family history.
- `md_eczema` (boolean, required): Physician-diagnosed eczema as assigned by the caller. true or false. Major criterion (Castro-Rodriguez 2000 Table 1). magent does not examine the child.
- `md_allergic_rhinitis` (boolean, required): Physician-diagnosed allergic rhinitis as assigned by the caller. true or false. Minor criterion (Castro-Rodriguez 2000 Table 1). magent does not examine the child.
- `wheezing_apart_from_colds` (boolean, required): Wheezing apart from colds as assigned by the caller. true or false. Minor criterion (Castro-Rodriguez 2000 Table 1). magent does not auscultate.
- `eosinophilia_gt_4pct` (boolean, required): Circulating eosinophils >4% of WBC as assigned by the caller (Castro-Rodriguez 2000 Table 1). true or false. Minor criterion. magent does not take an eosinophil percent and does not interpret a CBC.

## 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/asthma_api`
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": [
    {
      "eosinophilia_gt_4pct": "false",
      "md_allergic_rhinitis": "false",
      "md_eczema": "false",
      "parental_md_asthma": "false",
      "wheeze": "none",
      "wheezing_apart_from_colds": "false"
    },
    {
      "eosinophilia_gt_4pct": "false",
      "md_allergic_rhinitis": "false",
      "md_eczema": "false",
      "parental_md_asthma": "false",
      "wheeze": "none",
      "wheezing_apart_from_colds": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/asthma_api",
  "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": "Castro-Rodríguez JA, Holberg CJ, Wright AL, Martinez FD",
        "doi": "10.1164/ajrccm.162.4.9912111",
        "id": "castro-rodriguez-2000",
        "pmid": "11029352",
        "source": "Am J Respir Crit Care Med. 2000;162(4 Pt 1):1403-1406",
        "title": "A clinical index to define risk of asthma in young children with recurrent wheezing"
      },
      "formula": "asthma_api",
      "formula_expression": "stringent_positive iff wheeze is frequent and (major_count >= 1 or minor_count >= 2); loose_positive iff wheeze is any or frequent and the same risk factors; majors parental_md_asthma and md_eczema; minors md_allergic_rhinitis, wheezing_apart_from_colds, eosinophilia_gt_4pct (Castro-Rodriguez 2000 Table 1)",
      "criteria": [
        {
          "factor": "parental_md_asthma",
          "met": false
        },
        {
          "factor": "md_eczema",
          "met": false
        },
        {
          "factor": "md_allergic_rhinitis",
          "met": false
        },
        {
          "factor": "wheezing_apart_from_colds",
          "met": false
        },
        {
          "factor": "eosinophilia_gt_4pct",
          "met": false
        }
      ],
      "loose_positive": false,
      "major_count": 0,
      "minor_count": 0,
      "risk_factors_met": false,
      "stringent_positive": false,
      "wheeze": "none"
    },
    {
      "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": "Castro-Rodríguez JA, Holberg CJ, Wright AL, Martinez FD",
        "doi": "10.1164/ajrccm.162.4.9912111",
        "id": "castro-rodriguez-2000",
        "pmid": "11029352",
        "source": "Am J Respir Crit Care Med. 2000;162(4 Pt 1):1403-1406",
        "title": "A clinical index to define risk of asthma in young children with recurrent wheezing"
      },
      "formula": "asthma_api",
      "formula_expression": "stringent_positive iff wheeze is frequent and (major_count >= 1 or minor_count >= 2); loose_positive iff wheeze is any or frequent and the same risk factors; majors parental_md_asthma and md_eczema; minors md_allergic_rhinitis, wheezing_apart_from_colds, eosinophilia_gt_4pct (Castro-Rodriguez 2000 Table 1)",
      "criteria": [
        {
          "factor": "parental_md_asthma",
          "met": false
        },
        {
          "factor": "md_eczema",
          "met": false
        },
        {
          "factor": "md_allergic_rhinitis",
          "met": false
        },
        {
          "factor": "wheezing_apart_from_colds",
          "met": false
        },
        {
          "factor": "eosinophilia_gt_4pct",
          "met": false
        }
      ],
      "loose_positive": false,
      "major_count": 0,
      "minor_count": 0,
      "risk_factors_met": false,
      "stringent_positive": false,
      "wheeze": "none"
    }
  ]
}
```

## Response fields

- `formula` (string): asthma_api
- `formula_expression` (string): Castro-Rodriguez 2000 Table 1 stringent and loose API rule
- `stringent_positive` (boolean): true when wheeze is frequent (early frequent wheezer) and risk_factors_met is true. Not a diagnosis of asthma.
- `loose_positive` (boolean): true when wheeze is any or frequent (early wheezer) and risk_factors_met is true. Not a diagnosis of asthma.
- `risk_factors_met` (boolean): true when at least one major criterion is present or at least two minor criteria are present
- `major_count` (integer): Count of true major criteria (parental_md_asthma, md_eczema); 0-2
- `minor_count` (integer): Count of true minor criteria (md_allergic_rhinitis, wheezing_apart_from_colds, eosinophilia_gt_4pct); 0-3
- `wheeze` (string): Parsed early-wheeze class: none, any, or frequent
- `criteria` (array): Per-criterion rows with factor and met for the two majors then three minors; met is true when that Table 1 finding is present
- `citation` (object): Castro-Rodriguez 2000 Am J Respir Crit Care Med 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": "Castro-Rodríguez JA, Holberg CJ, Wright AL, Martinez FD",
    "doi": "10.1164/ajrccm.162.4.9912111",
    "id": "castro-rodriguez-2000",
    "pmid": "11029352",
    "source": "Am J Respir Crit Care Med. 2000;162(4 Pt 1):1403-1406",
    "title": "A clinical index to define risk of asthma in young children with recurrent wheezing"
  },
  "formula": "asthma_api",
  "formula_expression": "stringent_positive iff wheeze is frequent and (major_count >= 1 or minor_count >= 2); loose_positive iff wheeze is any or frequent and the same risk factors; majors parental_md_asthma and md_eczema; minors md_allergic_rhinitis, wheezing_apart_from_colds, eosinophilia_gt_4pct (Castro-Rodriguez 2000 Table 1)",
  "criteria": [
    {
      "factor": "parental_md_asthma",
      "met": false
    },
    {
      "factor": "md_eczema",
      "met": false
    },
    {
      "factor": "md_allergic_rhinitis",
      "met": false
    },
    {
      "factor": "wheezing_apart_from_colds",
      "met": false
    },
    {
      "factor": "eosinophilia_gt_4pct",
      "met": false
    }
  ],
  "loose_positive": false,
  "major_count": 0,
  "minor_count": 0,
  "risk_factors_met": false,
  "stringent_positive": false,
  "wheeze": "none"
}
```

## Errors

- HTTP 400 `invalid_api_wheeze`: wheeze must be none, any, or frequent (Castro-Rodriguez 2000 early wheezer vs early frequent wheezer). 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

- [PRAM](https://magentlab.com/docs/pram) — Sum five caller-assigned Chalut 2000 PRAM item points and return the published 0-12 total.

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