# MEDPED US total cholesterol

MEDPED

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

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

## What it computes

Apply the Williams 1993 US MEDPED total cholesterol tables and return whether caller-supplied total cholesterol exceeds the cutoff for that age and relative degree. Not a diagnosis.

## When to use

When an agent already has age, a caller-assigned relative degree (first, second, third, or general population), and one total cholesterol value, and needs the published US MEDPED cutoff comparison. magent does not assay lipids or take a pedigree.

## When not to use

- Not a medical device. Not a diagnosis of familial hypercholesterolemia.
- Williams 1993 US MEDPED total cholesterol tables only. Does not implement Dutch Lipid Clinic Network or Simon Broome criteria.
- Does not use LDL cholesterol cutoffs from later reprints. Total cholesterol only.
- magent does not assay lipids or take a pedigree. The caller assigns relative_degree and supplies exactly one total cholesterol value.

## Formula

```
meets_criteria iff total_cholesterol_mg_dl > cutoff_mg_dl (Williams 1993 US MEDPED total cholesterol); mmol/L converted as mg/dL = mmol/L * 38.67; age <20: first 220, second 230, third 240, general_population 270; 20-29: 240/250/260/290; 30-39: 270/280/290/340; >=40: 290/300/310/360
```

## Citation

[Diagnosing heterozygous familial hypercholesterolemia using new practical criteria validated by molecular genetics](https://doi.org/10.1016/0002-9149(93)90155-6)
Williams RR, Hunt SC, Schumacher MC, Hegele RA, Leppert MF, Ludwig EH, Hopkins PN
Am J Cardiol. 1993;72(2):171-176
DOI: [10.1016/0002-9149(93)90155-6](https://doi.org/10.1016/0002-9149(93)90155-6)

## Worked example

### Age 50, general population, total cholesterol 200 mg/dL is below the cutoff

Given: `age=50, relative_degree=general_population, total_cholesterol_mg_dl=200`

1. age 50 selects the >=40 row; general_population cutoff is 360 mg/dL
2. total_cholesterol_mg_dl 200 is not greater than 360
3. meets_criteria false; classification below_cutoff


## Also searched as

- MEDPED criteria
- Williams familial hypercholesterolemia
- US MEDPED cholesterol
- Make Early Diagnosis Prevent Early Death
- heterozygous FH cholesterol cutoff
- Williams 1993 FH
- first-degree relative cholesterol FH

## Parameters

- `age` (integer, required): Age in years (integer 1-120). Selects the Williams 1993 US MEDPED total cholesterol row: <20, 20-29, 30-39, or >=40.
- `relative_degree` (string, required): Relative degree as assigned by the caller: first, second, third, or general_population (Williams 1993). magent does not take a pedigree.
- `total_cholesterol_mg_dl` (number, optional): Total cholesterol in mg/dL (50-800). Provide exactly one of total_cholesterol_mg_dl or total_cholesterol_mmol_l. Meets the published cutoff iff this value is greater than the age- and relative-degree-specific mg/dL cutoff. magent does not assay lipids.
- `total_cholesterol_mmol_l` (number, optional): Total cholesterol in mmol/L (1.3-20). Converted as mg/dL = mmol/L * 38.67, then compared with the US MEDPED mg/dL cutoff. Provide exactly one lipid parameter.

## 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/medped`
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": "50",
      "relative_degree": "general_population",
      "total_cholesterol_mg_dl": "200"
    },
    {
      "age": "50",
      "relative_degree": "general_population",
      "total_cholesterol_mg_dl": "200"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/medped",
  "items": [
    {
      "age": 50,
      "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": "Williams RR, Hunt SC, Schumacher MC, Hegele RA, Leppert MF, Ludwig EH, Hopkins PN",
        "doi": "10.1016/0002-9149(93)90155-6",
        "id": "williams-1993",
        "pmid": "8328379",
        "source": "Am J Cardiol. 1993;72(2):171-176",
        "title": "Diagnosing heterozygous familial hypercholesterolemia using new practical criteria validated by molecular genetics"
      },
      "formula": "medped",
      "formula_expression": "meets_criteria iff total_cholesterol_mg_dl > cutoff_mg_dl (Williams 1993 US MEDPED total cholesterol); mmol/L converted as mg/dL = mmol/L * 38.67; age <20: first 220, second 230, third 240, general_population 270; 20-29: 240/250/260/290; 30-39: 270/280/290/340; >=40: 290/300/310/360",
      "criteria": [
        {
          "value": 200.0,
          "factor": "total_cholesterol_gt_cutoff",
          "met": false,
          "cutoff_mg_dl": 360
        }
      ],
      "classification": "below_cutoff",
      "total_cholesterol_mg_dl": 200.0,
      "cutoff_mg_dl": 360,
      "meets_criteria": false,
      "relative_degree": "general_population"
    },
    {
      "age": 50,
      "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": "Williams RR, Hunt SC, Schumacher MC, Hegele RA, Leppert MF, Ludwig EH, Hopkins PN",
        "doi": "10.1016/0002-9149(93)90155-6",
        "id": "williams-1993",
        "pmid": "8328379",
        "source": "Am J Cardiol. 1993;72(2):171-176",
        "title": "Diagnosing heterozygous familial hypercholesterolemia using new practical criteria validated by molecular genetics"
      },
      "formula": "medped",
      "formula_expression": "meets_criteria iff total_cholesterol_mg_dl > cutoff_mg_dl (Williams 1993 US MEDPED total cholesterol); mmol/L converted as mg/dL = mmol/L * 38.67; age <20: first 220, second 230, third 240, general_population 270; 20-29: 240/250/260/290; 30-39: 270/280/290/340; >=40: 290/300/310/360",
      "criteria": [
        {
          "value": 200.0,
          "factor": "total_cholesterol_gt_cutoff",
          "met": false,
          "cutoff_mg_dl": 360
        }
      ],
      "classification": "below_cutoff",
      "total_cholesterol_mg_dl": 200.0,
      "cutoff_mg_dl": 360,
      "meets_criteria": false,
      "relative_degree": "general_population"
    }
  ]
}
```

## Response fields

- `formula` (string): medped
- `formula_expression` (string): Williams 1993 US MEDPED total cholesterol cutoffs
- `age` (integer): Echo of the caller-assigned age in years
- `relative_degree` (string): first, second, third, or general_population
- `total_cholesterol_mg_dl` (number): Total cholesterol in mg/dL (converted when a mmol/L key is used)
- `cutoff_mg_dl` (integer): Williams 1993 US MEDPED total cholesterol cutoff in mg/dL for that age and relative degree
- `meets_criteria` (boolean): true iff total_cholesterol_mg_dl is greater than cutoff_mg_dl. Equality does not meet. Not a diagnosis.
- `classification` (string): meets_criteria when the cutoff is exceeded; otherwise below_cutoff. Not a diagnosis.
- `criteria` (array): Tree row for total_cholesterol_gt_cutoff with factor, met, value, and cutoff_mg_dl
- `citation` (object): Williams 1993 Am J Cardiol citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "age": 50,
  "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": "Williams RR, Hunt SC, Schumacher MC, Hegele RA, Leppert MF, Ludwig EH, Hopkins PN",
    "doi": "10.1016/0002-9149(93)90155-6",
    "id": "williams-1993",
    "pmid": "8328379",
    "source": "Am J Cardiol. 1993;72(2):171-176",
    "title": "Diagnosing heterozygous familial hypercholesterolemia using new practical criteria validated by molecular genetics"
  },
  "formula": "medped",
  "formula_expression": "meets_criteria iff total_cholesterol_mg_dl > cutoff_mg_dl (Williams 1993 US MEDPED total cholesterol); mmol/L converted as mg/dL = mmol/L * 38.67; age <20: first 220, second 230, third 240, general_population 270; 20-29: 240/250/260/290; 30-39: 270/280/290/340; >=40: 290/300/310/360",
  "criteria": [
    {
      "value": 200.0,
      "factor": "total_cholesterol_gt_cutoff",
      "met": false,
      "cutoff_mg_dl": 360
    }
  ],
  "classification": "below_cutoff",
  "total_cholesterol_mg_dl": 200.0,
  "cutoff_mg_dl": 360,
  "meets_criteria": false,
  "relative_degree": "general_population"
}
```

## Errors

- HTTP 400 `invalid_medped_age`: age must be an integer from 1 to 120 (Williams 1993). Returned before settlement; you are not charged.
- HTTP 400 `invalid_medped_relation`: relative_degree must be first, second, third, or general_population (Williams 1993). Returned before settlement; you are not charged.
- HTTP 400 `invalid_medped_lipid`: provide exactly one of total_cholesterol_mg_dl (50-800) or total_cholesterol_mmol_l (1.3-20). 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

- [Simon Broome](https://magentlab.com/docs/simon-broome) — Apply the 1991 Simon Broome Register adult definite familial hypercholesterolaemia rule and return definite or not_definite from one lipid value plus a caller-assigned tendon-xanthoma flag.
- [Friedewald LDL-C](https://magentlab.com/docs/friedewald) — Estimate LDL-C from total cholesterol, HDL, and triglycerides using Friedewald 1972.

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