# AAP 2022 phototherapy threshold (Kemper)

AAP 2022 phototherapy threshold (Kemper)

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

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

## What it computes

Return the AAP 2022 Kemper KAS 10 intensive phototherapy threshold from Supplemental Table 1 (no extra neurotoxicity risk factors other than gestational age) or Supplemental Table 2 (any additional listed factor), with TSB minus that threshold and whether TSB is at or above it.

## When to use

When an agent already has completed gestational age ≥35 weeks, age in hours, TSB, and caller-assigned extra neurotoxicity risk factors and needs the published hour-specific phototherapy threshold. magent does not assay TSB or order phototherapy. Gestational age <38 weeks is already in the GA-specific curve; use Table 2 only when an additional listed factor is assigned.

## When not to use

- Not a medical device and not a phototherapy or exchange-transfusion order. magent does not assay TSB.
- Published for newborn infants 35 or more weeks of gestation only (Kemper 2022). Ages under 1 hour and after 336 hours are rejected.
- Use total serum bilirubin. Do not subtract direct-reacting or conjugated bilirubin.
- Neurotoxicity risk factors other than gestational age are caller-assigned (isoimmune hemolytic disease, G6PD deficiency or other hemolytic conditions, sepsis, albumin <3.0 g/dL, significant clinical instability in the previous 24 hours). magent does not determine those factors or assign race or ethnicity.
- This tool is Supplemental Tables 1 and 2 only. It is not Bhutani 1999 percentile zones and is not an exchange-transfusion threshold.

## Formula

```
Kemper 2022 KAS 10 intensive phototherapy threshold (mg/dL) from Supplemental Table 1 when the caller assigns no neurotoxicity risk factors other than gestational age, or Supplemental Table 2 when any additional listed factor is assigned. Table 1 curves are completed GA 35, 36, 37, 38, 39, and ≥40 weeks. Table 2 curves are 35, 36, 37, and ≥38 weeks. Age is in hours (tabulated hourly from 1 through 336); interpolate linearly between adjacent tabulated hours. Use total serum bilirubin; do not subtract direct-reacting or conjugated bilirubin. Gestational age <38 weeks is already in the GA-specific curve — do not apply Table 2 solely for prematurity. Not a phototherapy or exchange order. magent does not assay TSB
```

## Citation

[Clinical Practice Guideline Revision: Management of Hyperbilirubinemia in the Newborn Infant 35 or More Weeks of Gestation](https://doi.org/10.1542/peds.2022-058859)
Kemper AR, Newman TB, Slaughter JL, et al.
Pediatrics. 2022;150(3):e2022058859
DOI: [10.1542/peds.2022-058859](https://doi.org/10.1542/peds.2022-058859)

## Worked example

### 40 weeks, no extra risk factors, age 48 hours, TSB 17 (Table 1, at threshold)

Given: `age_hours=48, albumin_lt_3=false, clinical_instability_24h=false, g6pd_deficiency=false, gestational_age_weeks=40, isoimmune_hemolytic_disease=false, other_hemolytic_condition=false, sepsis=false, tsb_mg_dl=17`

1. No additional neurotoxicity risk factor → Supplemental Table 1, ≥40-week curve
2. Age 48 hours is tabulated; printed threshold is 17.0 mg/dL
3. TSB 17.0 − 17.0 = 0.0; above_phototherapy_threshold true (at or above). Not a phototherapy order


### Same infant, TSB 16.9 (below the printed 17.0 threshold)

Given: `age_hours=48, albumin_lt_3=false, clinical_instability_24h=false, g6pd_deficiency=false, gestational_age_weeks=40, isoimmune_hemolytic_disease=false, other_hemolytic_condition=false, sepsis=false, tsb_mg_dl=16.9`

1. Table 1 ≥40 weeks at 48 hours remains 17.0 mg/dL
2. TSB 16.9 − 17.0 = −0.1; above_phototherapy_threshold false


### 40 weeks with caller-assigned sepsis, age 48 hours, TSB 14 (Table 2)

Given: `age_hours=48, albumin_lt_3=false, clinical_instability_24h=false, g6pd_deficiency=false, gestational_age_weeks=40, isoimmune_hemolytic_disease=false, other_hemolytic_condition=false, sepsis=true, tsb_mg_dl=14`

1. Any additional neurotoxicity risk factor → Supplemental Table 2, ≥38-week curve
2. Age 48 hours is tabulated; printed threshold is 14.0 mg/dL
3. TSB 14.0 − 14.0 = 0.0; above_phototherapy_threshold true


### 35 weeks, no extra risk factors, age 72 hours, TSB 16.8 (Table 1, at threshold)

Given: `age_hours=72, albumin_lt_3=false, clinical_instability_24h=false, g6pd_deficiency=false, gestational_age_weeks=35, isoimmune_hemolytic_disease=false, other_hemolytic_condition=false, sepsis=false, tsb_mg_dl=16.8`

1. No additional factor → Supplemental Table 1, 35-week curve
2. Age 72 hours is tabulated; printed threshold is 16.8 mg/dL
3. TSB 16.8 − 16.8 = 0.0; above_phototherapy_threshold true


## Also searched as

- AAP 2022 phototherapy threshold
- Kemper hyperbilirubinemia phototherapy
- neonatal TSB phototherapy threshold
- intensive phototherapy KAS 10
- Supplemental Table 1 phototherapy
- hour-specific phototherapy threshold
- neurotoxicity risk factor phototherapy

## Parameters

- `gestational_age_weeks` (integer, required): Completed gestational age in weeks, integer 35-45. Table 1 uses distinct curves for 35, 36, 37, 38, 39, and ≥40. Table 2 groups ≥38 together. magent does not convert days.
- `age_hours` (number, required): Chronologic age in hours (1-336). Supplemental Tables 1 and 2 are tabulated hourly; ages between adjacent hours are linearly interpolated. Hour 0 is not tabulated. magent does not convert days.
- `tsb_mg_dl` (number, required): Total serum bilirubin in mg/dL (0-40). Use TSB; do not subtract direct-reacting or conjugated bilirubin. magent does not assay TSB.
- `isoimmune_hemolytic_disease` (boolean, required): Caller-assigned isoimmune hemolytic disease (positive direct antiglobulin test) from Kemper 2022 Table 2. true or false. magent does not interpret DAT.
- `g6pd_deficiency` (boolean, required): Caller-assigned glucose-6-phosphate dehydrogenase (G6PD) deficiency from Kemper 2022 Table 2. true or false. magent does not assay G6PD.
- `other_hemolytic_condition` (boolean, required): Caller-assigned other hemolytic condition (Kemper 2022 Table 2, same neurotoxicity-risk row as isoimmune disease and G6PD deficiency). true or false.
- `sepsis` (boolean, required): Caller-assigned sepsis or suspected sepsis from Kemper 2022 Table 2. true or false. magent does not diagnose sepsis.
- `albumin_lt_3` (boolean, required): Caller-assigned albumin <3.0 g/dL from Kemper 2022 Table 2. true or false. magent does not assay albumin.
- `clinical_instability_24h` (boolean, required): Caller-assigned significant clinical instability in the previous 24 hours from Kemper 2022 Table 2. true or false. magent does not examine the infant.

## 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/aap_tsb`
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_hours": "48",
      "albumin_lt_3": "false",
      "clinical_instability_24h": "false",
      "g6pd_deficiency": "false",
      "gestational_age_weeks": "40",
      "isoimmune_hemolytic_disease": "false",
      "other_hemolytic_condition": "false",
      "sepsis": "false",
      "tsb_mg_dl": "17"
    },
    {
      "age_hours": "48",
      "albumin_lt_3": "false",
      "clinical_instability_24h": "false",
      "g6pd_deficiency": "false",
      "gestational_age_weeks": "40",
      "isoimmune_hemolytic_disease": "false",
      "other_hemolytic_condition": "false",
      "sepsis": "false",
      "tsb_mg_dl": "17"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/aap_tsb",
  "items": [
    {
      "components": [
        {
          "factor": "any_neurotoxicity_risk_factor",
          "met": false
        },
        {
          "value": 17.0,
          "factor": "above_phototherapy_threshold",
          "met": 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": "Kemper AR, Newman TB, Slaughter JL, et al.",
        "doi": "10.1542/peds.2022-058859",
        "id": "kemper-2022-aap-hyperbilirubinemia",
        "pmid": "35927462",
        "source": "Pediatrics. 2022;150(3):e2022058859",
        "title": "Clinical Practice Guideline Revision: Management of Hyperbilirubinemia in the Newborn Infant 35 or More Weeks of Gestation"
      },
      "formula": "aap_tsb",
      "formula_expression": "Kemper 2022 KAS 10 intensive phototherapy threshold (mg/dL) from Supplemental Table 1 when the caller assigns no neurotoxicity risk factors other than gestational age, or Supplemental Table 2 when any additional listed factor is assigned. Table 1 curves are completed GA 35, 36, 37, 38, 39, and ≥40 weeks. Table 2 curves are 35, 36, 37, and ≥38 weeks. Age is in hours (tabulated hourly from 1 through 336); interpolate linearly between adjacent tabulated hours. Use total serum bilirubin; do not subtract direct-reacting or conjugated bilirubin. Gestational age <38 weeks is already in the GA-specific curve — do not apply Table 2 solely for prematurity. Not a phototherapy or exchange order. magent does not assay TSB",
      "above_phototherapy_threshold": true,
      "age_hours": 48,
      "albumin_lt_3": false,
      "any_neurotoxicity_risk_factor": false,
      "clinical_instability_24h": false,
      "g6pd_deficiency": false,
      "gestational_age_group": "40_or_more",
      "gestational_age_weeks": 40,
      "isoimmune_hemolytic_disease": false,
      "other_hemolytic_condition": false,
      "phototherapy_threshold_mg_dl": 17.0,
      "sepsis": false,
      "supplemental_table": 1,
      "tsb_mg_dl": 17.0,
      "tsb_minus_threshold": 0.0
    },
    {
      "components": [
        {
          "factor": "any_neurotoxicity_risk_factor",
          "met": false
        },
        {
          "value": 17.0,
          "factor": "above_phototherapy_threshold",
          "met": 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": "Kemper AR, Newman TB, Slaughter JL, et al.",
        "doi": "10.1542/peds.2022-058859",
        "id": "kemper-2022-aap-hyperbilirubinemia",
        "pmid": "35927462",
        "source": "Pediatrics. 2022;150(3):e2022058859",
        "title": "Clinical Practice Guideline Revision: Management of Hyperbilirubinemia in the Newborn Infant 35 or More Weeks of Gestation"
      },
      "formula": "aap_tsb",
      "formula_expression": "Kemper 2022 KAS 10 intensive phototherapy threshold (mg/dL) from Supplemental Table 1 when the caller assigns no neurotoxicity risk factors other than gestational age, or Supplemental Table 2 when any additional listed factor is assigned. Table 1 curves are completed GA 35, 36, 37, 38, 39, and ≥40 weeks. Table 2 curves are 35, 36, 37, and ≥38 weeks. Age is in hours (tabulated hourly from 1 through 336); interpolate linearly between adjacent tabulated hours. Use total serum bilirubin; do not subtract direct-reacting or conjugated bilirubin. Gestational age <38 weeks is already in the GA-specific curve — do not apply Table 2 solely for prematurity. Not a phototherapy or exchange order. magent does not assay TSB",
      "above_phototherapy_threshold": true,
      "age_hours": 48,
      "albumin_lt_3": false,
      "any_neurotoxicity_risk_factor": false,
      "clinical_instability_24h": false,
      "g6pd_deficiency": false,
      "gestational_age_group": "40_or_more",
      "gestational_age_weeks": 40,
      "isoimmune_hemolytic_disease": false,
      "other_hemolytic_condition": false,
      "phototherapy_threshold_mg_dl": 17.0,
      "sepsis": false,
      "supplemental_table": 1,
      "tsb_mg_dl": 17.0,
      "tsb_minus_threshold": 0.0
    }
  ]
}
```

## Response fields

- `formula` (string): aap_tsb
- `formula_expression` (string): Published Kemper 2022 Supplemental Table 1 or 2 lookup
- `gestational_age_weeks` (integer): Echo of completed gestational age in weeks
- `gestational_age_group` (string): Guideline curve group: 35, 36, 37, 38, 39, or 40_or_more on Table 1; 35, 36, 37, or 38_or_more on Table 2
- `age_hours` (number): Echo of age in hours
- `tsb_mg_dl` (number): Echo of total serum bilirubin in mg/dL
- `isoimmune_hemolytic_disease` (boolean): Echo of caller-assigned isoimmune hemolytic disease
- `g6pd_deficiency` (boolean): Echo of caller-assigned G6PD deficiency
- `other_hemolytic_condition` (boolean): Echo of caller-assigned other hemolytic condition
- `sepsis` (boolean): Echo of caller-assigned sepsis
- `albumin_lt_3` (boolean): Echo of caller-assigned albumin <3.0 g/dL
- `clinical_instability_24h` (boolean): Echo of caller-assigned significant clinical instability in the previous 24 hours
- `any_neurotoxicity_risk_factor` (boolean): true when any additional neurotoxicity risk factor other than GA is assigned (Supplemental Table 2)
- `supplemental_table` (integer): 1 when Table 1 (no extra factors); 2 when Table 2 (any extra factor)
- `phototherapy_threshold_mg_dl` (number): Printed (or linearly interpolated) intensive phototherapy threshold in mg/dL
- `tsb_minus_threshold` (number): TSB minus phototherapy threshold in mg/dL (negative when below threshold)
- `above_phototherapy_threshold` (boolean): true when TSB is at or above the phototherapy threshold. Not a treatment order
- `components` (array): Tree rows for any_neurotoxicity_risk_factor and above_phototherapy_threshold (value is the threshold in mg/dL)
- `citation` (object): Kemper 2022 Pediatrics citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "factor": "any_neurotoxicity_risk_factor",
      "met": false
    },
    {
      "value": 17.0,
      "factor": "above_phototherapy_threshold",
      "met": 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": "Kemper AR, Newman TB, Slaughter JL, et al.",
    "doi": "10.1542/peds.2022-058859",
    "id": "kemper-2022-aap-hyperbilirubinemia",
    "pmid": "35927462",
    "source": "Pediatrics. 2022;150(3):e2022058859",
    "title": "Clinical Practice Guideline Revision: Management of Hyperbilirubinemia in the Newborn Infant 35 or More Weeks of Gestation"
  },
  "formula": "aap_tsb",
  "formula_expression": "Kemper 2022 KAS 10 intensive phototherapy threshold (mg/dL) from Supplemental Table 1 when the caller assigns no neurotoxicity risk factors other than gestational age, or Supplemental Table 2 when any additional listed factor is assigned. Table 1 curves are completed GA 35, 36, 37, 38, 39, and ≥40 weeks. Table 2 curves are 35, 36, 37, and ≥38 weeks. Age is in hours (tabulated hourly from 1 through 336); interpolate linearly between adjacent tabulated hours. Use total serum bilirubin; do not subtract direct-reacting or conjugated bilirubin. Gestational age <38 weeks is already in the GA-specific curve — do not apply Table 2 solely for prematurity. Not a phototherapy or exchange order. magent does not assay TSB",
  "above_phototherapy_threshold": true,
  "age_hours": 48,
  "albumin_lt_3": false,
  "any_neurotoxicity_risk_factor": false,
  "clinical_instability_24h": false,
  "g6pd_deficiency": false,
  "gestational_age_group": "40_or_more",
  "gestational_age_weeks": 40,
  "isoimmune_hemolytic_disease": false,
  "other_hemolytic_condition": false,
  "phototherapy_threshold_mg_dl": 17.0,
  "sepsis": false,
  "supplemental_table": 1,
  "tsb_mg_dl": 17.0,
  "tsb_minus_threshold": 0.0
}
```

## Errors

- HTTP 400 `invalid_aap_tsb`: AAP 2022 phototherapy-threshold inputs must match gestational age, age in hours, total serum bilirubin, and caller-assigned neurotoxicity risk factors. 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

- [Rebound hyperbilirubinemia](https://magentlab.com/docs/rebound-hyperbilirubinemia) — Return the Chang 2017 three-variable rebound hyperbilirubinemia prediction score after inpatient phototherapy from gestational age, age at phototherapy initiation in days, TSB at termination, and a caller-supplied AAP phototherapy threshold. Scores <20 correspond to a <4% probability of rebound in that paper.

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