# Modified Asthma Predictive Index

Modified Asthma Predictive Index

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

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

## What it computes

Apply Guilbert 2004 PEAK Table I and return a binary modified Asthma Predictive Index flag from caller-assigned history of 4 or more wheezing episodes and six major/minor criteria.

## When to use

When an agent has a caller-assigned history of 4 or more wheezing episodes in one year (at least one physician-diagnosed) and the published major and minor criteria for a child at high risk of childhood asthma and needs the Guilbert 2004 modified Asthma Predictive Index, not the Castro-Rodriguez 2000 original API, not Chang 2013 m²API, 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 Guilbert 2004 modified Asthma Predictive Index (mAPI, PEAK Table I) only. It is not the Castro-Rodriguez 2000 original Asthma Predictive Index (stringent and loose). It is not Chang 2013 m²API (≥2 wheeze episodes).
- The caller assigns 4 or more wheeze episodes, parental asthma, MD atopic dermatitis, aeroallergen sensitization, food sensitization to milk, egg, or peanut, wheezing unrelated to colds, and blood eosinophils ≥4%. magent does not take an eosinophil percent and does not interpret a CBC.
- Derivation was in the PEAK trial among children with recurrent wheezing at high risk for childhood asthma. magent does not take numeric age.
- positive is a published risk-index flag, not an asthma diagnosis or a treatment or inhaler order.

## Formula

```
positive iff four_or_more_wheeze_episodes and (major_count >= 1 or minor_count >= 2); majors parental_asthma, md_atopic_dermatitis, aeroallergen_sensitization; minors food_sensitization_milk_egg_peanut, wheezing_unrelated_to_colds, eosinophilia_ge_4pct (Guilbert 2004 PEAK Table I)
```

## Citation

[Atopic characteristics of children with recurrent wheezing at high risk for the development of childhood asthma](https://doi.org/10.1016/j.jaci.2004.09.020)
Guilbert TW, Morgan WJ, Zeiger RS, et al.
J Allergy Clin Immunol. 2004;114(6):1282-1287
DOI: [10.1016/j.jaci.2004.09.020](https://doi.org/10.1016/j.jaci.2004.09.020)

## Worked example

### No four-or-more wheeze and no criteria

Given: `aeroallergen_sensitization=false, eosinophilia_ge_4pct=false, food_sensitization_milk_egg_peanut=false, four_or_more_wheeze_episodes=false, md_atopic_dermatitis=false, parental_asthma=false, wheezing_unrelated_to_colds=false`

1. four_or_more_wheeze_episodes is false
2. No major or minor criterion is present
3. mAPI is not positive


### Four-or-more wheeze with one major is positive

Given: `aeroallergen_sensitization=false, eosinophilia_ge_4pct=false, food_sensitization_milk_egg_peanut=false, four_or_more_wheeze_episodes=true, md_atopic_dermatitis=false, parental_asthma=true, wheezing_unrelated_to_colds=false`

1. four_or_more_wheeze_episodes is true
2. One major criterion (parental asthma) is present
3. mAPI is positive


### Four-or-more wheeze with two minors is positive

Given: `aeroallergen_sensitization=false, eosinophilia_ge_4pct=false, food_sensitization_milk_egg_peanut=true, four_or_more_wheeze_episodes=true, md_atopic_dermatitis=false, parental_asthma=false, wheezing_unrelated_to_colds=true`

1. four_or_more_wheeze_episodes is true
2. Two minor criteria and zero majors
3. mAPI is positive


## Also searched as

- Modified Asthma Predictive Index
- mAPI
- Guilbert 2004
- PEAK trial mAPI
- PEAK Table I
- modified Asthma Predictive Index
- aeroallergen sensitization wheeze
- Guilbert recurrent wheezing

## Parameters

- `four_or_more_wheeze_episodes` (boolean, required): Caller-assigned history of 4 or more wheezing episodes in one year with at least one physician-diagnosed episode (Guilbert 2004 PEAK Table I primary criterion). true or false. magent does not take a numeric episode count.
- `parental_asthma` (boolean, required): Parental asthma as assigned by the caller. true or false. Major criterion (Guilbert 2004 PEAK Table I). magent does not take a family history.
- `md_atopic_dermatitis` (boolean, required): Physician-diagnosed atopic dermatitis as assigned by the caller. true or false. Major criterion (Guilbert 2004 PEAK Table I). magent does not examine the child.
- `aeroallergen_sensitization` (boolean, required): Allergic sensitization to at least one aeroallergen as assigned by the caller. true or false. Major criterion (Guilbert 2004 PEAK Table I). magent does not interpret allergy testing.
- `food_sensitization_milk_egg_peanut` (boolean, required): Allergic sensitization to milk, egg, or peanuts as assigned by the caller. true or false. Minor criterion (Guilbert 2004 PEAK Table I). magent does not interpret allergy testing.
- `wheezing_unrelated_to_colds` (boolean, required): Wheezing unrelated to colds as assigned by the caller. true or false. Minor criterion (Guilbert 2004 PEAK Table I). magent does not auscultate.
- `eosinophilia_ge_4pct` (boolean, required): Blood eosinophils ≥4% of WBC as assigned by the caller (Guilbert 2004 PEAK Table I; 4% or greater). true or false. Minor criterion. magent does not take an eosinophil percent and does not interpret a CBC. Not Castro-Rodriguez circulating eosinophils >4%.

## 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/mapi`
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": [
    {
      "aeroallergen_sensitization": "false",
      "eosinophilia_ge_4pct": "false",
      "food_sensitization_milk_egg_peanut": "false",
      "four_or_more_wheeze_episodes": "false",
      "md_atopic_dermatitis": "false",
      "parental_asthma": "false",
      "wheezing_unrelated_to_colds": "false"
    },
    {
      "aeroallergen_sensitization": "false",
      "eosinophilia_ge_4pct": "false",
      "food_sensitization_milk_egg_peanut": "false",
      "four_or_more_wheeze_episodes": "false",
      "md_atopic_dermatitis": "false",
      "parental_asthma": "false",
      "wheezing_unrelated_to_colds": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/mapi",
  "items": [
    {
      "positive": 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": "Guilbert TW, Morgan WJ, Zeiger RS, et al.",
        "doi": "10.1016/j.jaci.2004.09.020",
        "id": "guilbert-2004",
        "pmid": "15577824",
        "source": "J Allergy Clin Immunol. 2004;114(6):1282-1287",
        "title": "Atopic characteristics of children with recurrent wheezing at high risk for the development of childhood asthma"
      },
      "formula": "mapi",
      "formula_expression": "positive iff four_or_more_wheeze_episodes and (major_count >= 1 or minor_count >= 2); majors parental_asthma, md_atopic_dermatitis, aeroallergen_sensitization; minors food_sensitization_milk_egg_peanut, wheezing_unrelated_to_colds, eosinophilia_ge_4pct (Guilbert 2004 PEAK Table I)",
      "criteria": [
        {
          "factor": "four_or_more_wheeze_episodes",
          "met": false
        },
        {
          "factor": "parental_asthma",
          "met": false
        },
        {
          "factor": "md_atopic_dermatitis",
          "met": false
        },
        {
          "factor": "aeroallergen_sensitization",
          "met": false
        },
        {
          "factor": "food_sensitization_milk_egg_peanut",
          "met": false
        },
        {
          "factor": "wheezing_unrelated_to_colds",
          "met": false
        },
        {
          "factor": "eosinophilia_ge_4pct",
          "met": false
        }
      ],
      "major_count": 0,
      "minor_count": 0,
      "four_or_more_wheeze_episodes": false
    },
    {
      "positive": 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": "Guilbert TW, Morgan WJ, Zeiger RS, et al.",
        "doi": "10.1016/j.jaci.2004.09.020",
        "id": "guilbert-2004",
        "pmid": "15577824",
        "source": "J Allergy Clin Immunol. 2004;114(6):1282-1287",
        "title": "Atopic characteristics of children with recurrent wheezing at high risk for the development of childhood asthma"
      },
      "formula": "mapi",
      "formula_expression": "positive iff four_or_more_wheeze_episodes and (major_count >= 1 or minor_count >= 2); majors parental_asthma, md_atopic_dermatitis, aeroallergen_sensitization; minors food_sensitization_milk_egg_peanut, wheezing_unrelated_to_colds, eosinophilia_ge_4pct (Guilbert 2004 PEAK Table I)",
      "criteria": [
        {
          "factor": "four_or_more_wheeze_episodes",
          "met": false
        },
        {
          "factor": "parental_asthma",
          "met": false
        },
        {
          "factor": "md_atopic_dermatitis",
          "met": false
        },
        {
          "factor": "aeroallergen_sensitization",
          "met": false
        },
        {
          "factor": "food_sensitization_milk_egg_peanut",
          "met": false
        },
        {
          "factor": "wheezing_unrelated_to_colds",
          "met": false
        },
        {
          "factor": "eosinophilia_ge_4pct",
          "met": false
        }
      ],
      "major_count": 0,
      "minor_count": 0,
      "four_or_more_wheeze_episodes": false
    }
  ]
}
```

## Response fields

- `formula` (string): mapi
- `formula_expression` (string): Guilbert 2004 PEAK Table I mAPI binary positive rule
- `positive` (boolean): true when four_or_more_wheeze_episodes is true and at least one major criterion is present or at least two minor criteria are present. Not a diagnosis of asthma.
- `major_count` (integer): Count of true major criteria (parental_asthma, md_atopic_dermatitis, aeroallergen_sensitization); 0-3
- `minor_count` (integer): Count of true minor criteria (food_sensitization_milk_egg_peanut, wheezing_unrelated_to_colds, eosinophilia_ge_4pct); 0-3
- `four_or_more_wheeze_episodes` (boolean): Parsed primary criterion: caller-assigned history of 4 or more wheezing episodes in one year with at least one physician-diagnosed episode
- `criteria` (array): Per-criterion rows with factor and met for the primary four-or-more wheeze flag then three majors then three minors; met is true when that Table I finding is present
- `citation` (object): Guilbert 2004 J Allergy Clin Immunol citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "positive": 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": "Guilbert TW, Morgan WJ, Zeiger RS, et al.",
    "doi": "10.1016/j.jaci.2004.09.020",
    "id": "guilbert-2004",
    "pmid": "15577824",
    "source": "J Allergy Clin Immunol. 2004;114(6):1282-1287",
    "title": "Atopic characteristics of children with recurrent wheezing at high risk for the development of childhood asthma"
  },
  "formula": "mapi",
  "formula_expression": "positive iff four_or_more_wheeze_episodes and (major_count >= 1 or minor_count >= 2); majors parental_asthma, md_atopic_dermatitis, aeroallergen_sensitization; minors food_sensitization_milk_egg_peanut, wheezing_unrelated_to_colds, eosinophilia_ge_4pct (Guilbert 2004 PEAK Table I)",
  "criteria": [
    {
      "factor": "four_or_more_wheeze_episodes",
      "met": false
    },
    {
      "factor": "parental_asthma",
      "met": false
    },
    {
      "factor": "md_atopic_dermatitis",
      "met": false
    },
    {
      "factor": "aeroallergen_sensitization",
      "met": false
    },
    {
      "factor": "food_sensitization_milk_egg_peanut",
      "met": false
    },
    {
      "factor": "wheezing_unrelated_to_colds",
      "met": false
    },
    {
      "factor": "eosinophilia_ge_4pct",
      "met": false
    }
  ],
  "major_count": 0,
  "minor_count": 0,
  "four_or_more_wheeze_episodes": false
}
```

## Errors

- 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

- [Asthma Predictive Index](https://magentlab.com/docs/asthma-api) — 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.
- [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.
