# PIAMA preschool asthma prediction score

PIAMA

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

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

## What it computes

Sum the Caudri 2009 PIAMA Table III decimal clinical prediction weights for preschool children with symptoms suggestive of asthma and return below_10 (score < 10) and ge_30 (score ≥ 30).

## When to use

When an agent has caller-assigned sex, post-term delivery, parental education and inhaled-medication flags, wheezing frequency, wheeze or dyspnea apart from colds, serious-infection frequency, and eczema with rash, and needs the published PIAMA Table III decimal total rather than API, mAPI, or a simplified integer port.

## When not to use

- Not a medical device and not a diagnosis of asthma. magent does not examine the child.
- Decimal Caudri 2009 Table III clinical-prediction weights only. This is not a simplified 0–18 integer port.
- Not the Castro-Rodriguez 2000 Asthma Predictive Index (API) and not the modified Asthma Predictive Index (mAPI).
- wheeze_dyspnea_apart_from_colds was collected only at ages 3–4 in PIAMA; younger children were treated as negative by default. The caller assigns the boolean. magent does not take numeric age and does not auto-override.
- below_10 and ge_30 are the published abstract flags (~3% and ~42% asthma at 7–8 years). Table IV cutoffs 15/20/25/35 are test characteristics, not exclusive bands. magent does not return a continuous probability.

## Formula

```
piama = 4.6*male + 7.3*postterm_delivery + 4.2*medium_low_parental_education + 7.7*parental_inhaled_medication + wheezing(none 0, 1_to_3 4.2, ge_4 9.1) + 7.1*wheeze_dyspnea_apart_from_colds + serious_infections(none 0, 1_to_2 4.6, ge_3 6.9) + 8.2*eczema_with_rash; Caudri 2009 Table III; max 55.1; below_10 iff score < 10 (~3% asthma at 7-8 years); ge_30 iff score ≥ 30 (~42% risk)
```

## Citation

[Predicting the long-term prognosis of children with symptoms suggestive of asthma at preschool age](https://doi.org/10.1016/j.jaci.2009.06.045)
Caudri D, Wijga A, Schipper CMA, Hoekstra M, Postma DS, Koppelman GH, Brunekreef B, Smit HA, de Jongste JC
J Allergy Clin Immunol. 2009;124(5):903-910
DOI: [10.1016/j.jaci.2009.06.045](https://doi.org/10.1016/j.jaci.2009.06.045)

## Worked example

### Female, all flags false, wheezing none, infections none

Given: `eczema_with_rash=false, medium_low_parental_education=false, parental_inhaled_medication=false, postterm_delivery=false, serious_infections=none, sex=female, wheeze_dyspnea_apart_from_colds=false, wheezing=none`

1. Female and all flags false; wheezing none; serious_infections none → 0
2. Score = 0 (max 55.1); below_10 = true (score < 10); ge_30 = false


### Male only

Given: `eczema_with_rash=false, medium_low_parental_education=false, parental_inhaled_medication=false, postterm_delivery=false, serious_infections=none, sex=male, wheeze_dyspnea_apart_from_colds=false, wheezing=none`

1. Male scores 4.6; remaining Table III factors are absent
2. Score = 4.6 (max 55.1); below_10 = true; ge_30 = false


### All Table III factors at maximum weight

Given: `eczema_with_rash=true, medium_low_parental_education=true, parental_inhaled_medication=true, postterm_delivery=true, serious_infections=ge_3, sex=male, wheeze_dyspnea_apart_from_colds=true, wheezing=ge_4`

1. male 4.6 + postterm 7.3 + medium_low education 4.2 + parental inhaled medication 7.7 + wheezing ge_4 9.1 + wheeze/dyspnea apart 7.1 + infections ge_3 6.9 + eczema with rash 8.2
2. Score = 55.1 (max 55.1); below_10 = false; ge_30 = true (score ≥ 30)


## Also searched as

- PIAMA score
- Caudri PIAMA
- preschool asthma prediction score
- Caudri 2009
- PIAMA Table III
- children symptoms suggestive of asthma
- PIAMA clinical prediction score
- preschool wheezing asthma risk

## Parameters

- `sex` (string, required): Caller-assigned sex (Caudri 2009 Table III). male scores 4.6; female scores 0. magent does not assign sex.
- `postterm_delivery` (boolean, required): Post-term delivery as assigned by the caller (Caudri 2009 Table III). true scores 7.3. magent does not take an obstetric history.
- `medium_low_parental_education` (boolean, required): Medium or low education in at least one parent as assigned by the caller (Caudri 2009 Table III). true scores 4.2. magent does not take a parental education history.
- `parental_inhaled_medication` (boolean, required): Inhalation medication by at least one parent as assigned by the caller (Caudri 2009 Table III). true scores 7.7. magent does not take a family medication history.
- `wheezing` (string, required): Wheezing frequency in the last year (Caudri 2009 Table III). none scores 0; 1_to_3 (infrequent, 1–3 times/year) scores 4.2; ge_4 (frequent, ≥4 times/year) scores 9.1. Mutually exclusive. magent does not auscultate.
- `wheeze_dyspnea_apart_from_colds` (boolean, required): Wheeze or dyspnea apart from colds as assigned by the caller (Caudri 2009 Table III). true scores 7.1. PIAMA collected this only at ages 3–4 and treated younger children as negative by default; the caller assigns the boolean. magent does not take numeric age and does not auto-override.
- `serious_infections` (string, required): Serious respiratory or ear/nose/throat infections per year (Caudri 2009 Table III). none scores 0; 1_to_2 (1–2 times/year) scores 4.6; ge_3 (≥3 times/year) scores 6.9. Mutually exclusive. magent does not diagnose infection.
- `eczema_with_rash` (boolean, required): Doctor's diagnosis of eczema AND eczematous rash present, as assigned by the caller (Caudri 2009 Table III). true scores 8.2. magent does not examine the child.

## 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/piama`
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": [
    {
      "eczema_with_rash": "false",
      "medium_low_parental_education": "false",
      "parental_inhaled_medication": "false",
      "postterm_delivery": "false",
      "serious_infections": "none",
      "sex": "female",
      "wheeze_dyspnea_apart_from_colds": "false",
      "wheezing": "none"
    },
    {
      "eczema_with_rash": "false",
      "medium_low_parental_education": "false",
      "parental_inhaled_medication": "false",
      "postterm_delivery": "false",
      "serious_infections": "none",
      "sex": "female",
      "wheeze_dyspnea_apart_from_colds": "false",
      "wheezing": "none"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/piama",
  "items": [
    {
      "components": [
        {
          "factor": "male",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "postterm_delivery",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "medium_low_parental_education",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "parental_inhaled_medication",
          "points": 0.0,
          "present": false
        },
        {
          "value": "none",
          "factor": "wheezing",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "wheeze_dyspnea_apart_from_colds",
          "points": 0.0,
          "present": false
        },
        {
          "value": "none",
          "factor": "serious_infections",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "eczema_with_rash",
          "points": 0.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": "Caudri D, Wijga A, Schipper CMA, Hoekstra M, Postma DS, Koppelman GH, Brunekreef B, Smit HA, de Jongste JC",
        "doi": "10.1016/j.jaci.2009.06.045",
        "id": "caudri-2009",
        "pmid": "19665765",
        "source": "J Allergy Clin Immunol. 2009;124(5):903-910",
        "title": "Predicting the long-term prognosis of children with symptoms suggestive of asthma at preschool age"
      },
      "formula": "piama",
      "formula_expression": "piama = 4.6*male + 7.3*postterm_delivery + 4.2*medium_low_parental_education + 7.7*parental_inhaled_medication + wheezing(none 0, 1_to_3 4.2, ge_4 9.1) + 7.1*wheeze_dyspnea_apart_from_colds + serious_infections(none 0, 1_to_2 4.6, ge_3 6.9) + 8.2*eczema_with_rash; Caudri 2009 Table III; max 55.1; below_10 iff score < 10 (~3% asthma at 7-8 years); ge_30 iff score ≥ 30 (~42% risk)",
      "max_score": 55.1,
      "score": 0.0,
      "below_10": true,
      "ge_30": false
    },
    {
      "components": [
        {
          "factor": "male",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "postterm_delivery",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "medium_low_parental_education",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "parental_inhaled_medication",
          "points": 0.0,
          "present": false
        },
        {
          "value": "none",
          "factor": "wheezing",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "wheeze_dyspnea_apart_from_colds",
          "points": 0.0,
          "present": false
        },
        {
          "value": "none",
          "factor": "serious_infections",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "eczema_with_rash",
          "points": 0.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": "Caudri D, Wijga A, Schipper CMA, Hoekstra M, Postma DS, Koppelman GH, Brunekreef B, Smit HA, de Jongste JC",
        "doi": "10.1016/j.jaci.2009.06.045",
        "id": "caudri-2009",
        "pmid": "19665765",
        "source": "J Allergy Clin Immunol. 2009;124(5):903-910",
        "title": "Predicting the long-term prognosis of children with symptoms suggestive of asthma at preschool age"
      },
      "formula": "piama",
      "formula_expression": "piama = 4.6*male + 7.3*postterm_delivery + 4.2*medium_low_parental_education + 7.7*parental_inhaled_medication + wheezing(none 0, 1_to_3 4.2, ge_4 9.1) + 7.1*wheeze_dyspnea_apart_from_colds + serious_infections(none 0, 1_to_2 4.6, ge_3 6.9) + 8.2*eczema_with_rash; Caudri 2009 Table III; max 55.1; below_10 iff score < 10 (~3% asthma at 7-8 years); ge_30 iff score ≥ 30 (~42% risk)",
      "max_score": 55.1,
      "score": 0.0,
      "below_10": true,
      "ge_30": false
    }
  ]
}
```

## Response fields

- `formula` (string): piama
- `formula_expression` (string): Caudri 2009 Table III decimal clinical prediction expression
- `score` (number): Caudri 2009 Table III points 0-55.1, one decimal
- `max_score` (number): Always 55.1
- `below_10` (boolean): true iff score < 10 (Caudri 2009 abstract: ~3% risk of asthma at 7–8 years). Not a diagnosis of asthma.
- `ge_30` (boolean): true iff score ≥ 30 (Caudri 2009 abstract: ~42% risk of asthma at 7–8 years). Not a diagnosis of asthma.
- `components` (array): Per-factor Table III points
- `citation` (object): Caudri 2009 J Allergy Clin Immunol citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "factor": "male",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "postterm_delivery",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "medium_low_parental_education",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "parental_inhaled_medication",
      "points": 0.0,
      "present": false
    },
    {
      "value": "none",
      "factor": "wheezing",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "wheeze_dyspnea_apart_from_colds",
      "points": 0.0,
      "present": false
    },
    {
      "value": "none",
      "factor": "serious_infections",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "eczema_with_rash",
      "points": 0.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": "Caudri D, Wijga A, Schipper CMA, Hoekstra M, Postma DS, Koppelman GH, Brunekreef B, Smit HA, de Jongste JC",
    "doi": "10.1016/j.jaci.2009.06.045",
    "id": "caudri-2009",
    "pmid": "19665765",
    "source": "J Allergy Clin Immunol. 2009;124(5):903-910",
    "title": "Predicting the long-term prognosis of children with symptoms suggestive of asthma at preschool age"
  },
  "formula": "piama",
  "formula_expression": "piama = 4.6*male + 7.3*postterm_delivery + 4.2*medium_low_parental_education + 7.7*parental_inhaled_medication + wheezing(none 0, 1_to_3 4.2, ge_4 9.1) + 7.1*wheeze_dyspnea_apart_from_colds + serious_infections(none 0, 1_to_2 4.6, ge_3 6.9) + 8.2*eczema_with_rash; Caudri 2009 Table III; max 55.1; below_10 iff score < 10 (~3% asthma at 7-8 years); ge_30 iff score ≥ 30 (~42% risk)",
  "max_score": 55.1,
  "score": 0.0,
  "below_10": true,
  "ge_30": false
}
```

## Errors

- HTTP 400 `invalid_sex`: sex must be female or male 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_piama`: wheezing must be none, 1_to_3, or ge_4; serious_infections must be none, 1_to_2, or ge_3 (Caudri 2009 PIAMA Table III). 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.
