# PRECISE-DAPT (Costa 2017)

PRECISE-DAPT

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

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

## What it computes

Sum Costa 2017 Figure 1 PRECISE-DAPT nomogram points from age, caller-assigned creatinine clearance, hemoglobin, white-blood-cell count, and previous spontaneous bleeding, and return whether the total is in the published high-bleeding-risk stratum (score >=25).

## When to use

When an agent needs the published Costa 2017 PRECISE-DAPT integer after PCI and must not invent a dual antiplatelet duration, Yeh DAPT points, or extra cutoffs besides score >=25.

## When not to use

- Not a medical device and not a prescription for dual antiplatelet therapy duration.
- Not a diagnosis. magent does not assay hemoglobin or WBC, does not compute Cockcroft-Gault, and does not take a bleeding history; creatinine clearance and previous spontaneous bleeding are caller-assigned.
- Not the Yeh 2016 DAPT score. PRECISE-DAPT is the Costa 2017 five-item out-of-hospital bleeding nomogram at the time of stenting.
- Table 1 truncations: age 50-90, hemoglobin 10-12 g/dL, CrCl capped at 100 mL/min, WBC 5-20 x10^3/uL. Values beyond those bounds use the truncated nomogram ends.
- high_bleeding_risk is true only when score >=25, the paper's high-risk stratum used to compare DAPT duration. This tool does not return quartile labels or TIMI bleeding percents.

## Formula

```
PRECISE-DAPT = age_points + crcl_points + hemoglobin_points + wbc_points + previous_bleed_points (Costa 2017 Figure 1 nomogram; Table 1 truncated linear terms); age years truncated 50-90 (0 at <=50, 19 at >=90); caller-assigned CrCl mL/min truncated 0-100 (0 at >=100, 25 at 0; magent does not compute Cockcroft-Gault); hemoglobin g/dL truncated 10-12 (0 at >=12, 15 at <=10); WBC x10^3 cells/uL truncated 5-20 (0 at <=5, 15 at >=20); previous spontaneous bleeding 26 if true else 0; integer score is the rounded sum (0-100); high_bleeding_risk iff score >=25
```

## Citation

[Derivation and validation of the predicting bleeding complications in patients undergoing stent implantation and subsequent dual antiplatelet therapy (PRECISE-DAPT) score: a pooled analysis of individual-patient datasets from clinical trials](https://doi.org/10.1016/S0140-6736(17)30397-5)
Costa F, van Klaveren D, James S, et al
Lancet. 2017;389(10073):1025-1034
DOI: [10.1016/S0140-6736(17)30397-5](https://doi.org/10.1016/S0140-6736(17)30397-5)

## Worked example

### Lowest published nomogram anchors (score 0)

Given: `age=50, crcl_ml_min=100, hemoglobin_g_dl=12, previous_spontaneous_bleeding=false, wbc_k_ul=5`

1. Age 50 is the lower truncation → 0; CrCl 100 mL/min is the upper truncation → 0; hemoglobin 12 g/dL → 0; WBC 5 → 0; no previous spontaneous bleeding → 0
2. Rounded sum = 0 (max 100); high_bleeding_risk false


### CrCl 0 mL/min only (score 25, high-risk cutoff)

Given: `age=50, crcl_ml_min=0, hemoglobin_g_dl=12, previous_spontaneous_bleeding=false, wbc_k_ul=5`

1. Protective age, hemoglobin, WBC, and no prior bleed → 0; CrCl 0 → 25
2. Rounded sum = 25 (max 100); high_bleeding_risk true


## Also searched as

- PRECISE-DAPT
- PRECISE-DAPT score
- Costa 2017 bleeding score
- predicting bleeding complications DAPT
- stent DAPT bleeding score
- out-of-hospital DAPT bleeding

## Parameters

- `age` (integer, required): Age in years (18-120). Costa 2017 Table 1 truncates below 50 and above 90. Figure 1: <=50 scores 0; >=90 scores 19; linear between. Age 18 and age 50 both score 0.
- `crcl_ml_min` (number, required): Creatinine clearance in mL/min (0-300) as assigned by the caller. Costa 2017 Figure 1 uses CrCl, not raw creatinine. magent does not compute Cockcroft-Gault. Truncated above 100: >=100 scores 0; 0 mL/min scores 25; linear between.
- `hemoglobin_g_dl` (number, required): Hemoglobin in g/dL (4-22). Table 1 truncates above 12 and below 10. Figure 1: >=12.0 scores 0; <=10.0 scores 15; linear between. magent does not assay hemoglobin.
- `wbc_k_ul` (number, required): White-blood-cell count in x10^3 cells per uL, same as x10^9/L (0.1-100). Table 1 truncates below 5 and above 20. Figure 1: <=5 scores 0; >=20 scores 15; linear between. magent does not assay WBC.
- `previous_spontaneous_bleeding` (boolean, required): Previous spontaneous bleeding as assigned by the caller (Costa 2017). true scores 26; false scores 0. magent does not take a bleeding history.

## 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/precise_dapt`
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",
      "crcl_ml_min": "100",
      "hemoglobin_g_dl": "12",
      "previous_spontaneous_bleeding": "false",
      "wbc_k_ul": "5"
    },
    {
      "age": "50",
      "crcl_ml_min": "100",
      "hemoglobin_g_dl": "12",
      "previous_spontaneous_bleeding": "false",
      "wbc_k_ul": "5"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/precise_dapt",
  "items": [
    {
      "components": [
        {
          "value": 50,
          "factor": "age",
          "points": 0.0,
          "present": false
        },
        {
          "value": 100.0,
          "factor": "crcl_ml_min",
          "points": 0.0,
          "present": false
        },
        {
          "value": 12.0,
          "factor": "hemoglobin_g_dl",
          "points": 0.0,
          "present": false
        },
        {
          "value": 5.0,
          "factor": "wbc_k_ul",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "previous_spontaneous_bleeding",
          "points": 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": "Costa F, van Klaveren D, James S, et al",
        "doi": "10.1016/S0140-6736(17)30397-5",
        "id": "costa-2017",
        "pmid": "28290994",
        "source": "Lancet. 2017;389(10073):1025-1034",
        "title": "Derivation and validation of the predicting bleeding complications in patients undergoing stent implantation and subsequent dual antiplatelet therapy (PRECISE-DAPT) score: a pooled analysis of individual-patient datasets from clinical trials"
      },
      "formula": "precise_dapt",
      "formula_expression": "PRECISE-DAPT = age_points + crcl_points + hemoglobin_points + wbc_points + previous_bleed_points (Costa 2017 Figure 1 nomogram; Table 1 truncated linear terms); age years truncated 50-90 (0 at <=50, 19 at >=90); caller-assigned CrCl mL/min truncated 0-100 (0 at >=100, 25 at 0; magent does not compute Cockcroft-Gault); hemoglobin g/dL truncated 10-12 (0 at >=12, 15 at <=10); WBC x10^3 cells/uL truncated 5-20 (0 at <=5, 15 at >=20); previous spontaneous bleeding 26 if true else 0; integer score is the rounded sum (0-100); high_bleeding_risk iff score >=25",
      "age_years": 50,
      "max_score": 100,
      "score": 0,
      "high_bleeding_risk": false,
      "hemoglobin_g_dl": 12.0,
      "wbc_k_ul": 5.0,
      "crcl_ml_min": 100.0,
      "previous_spontaneous_bleeding": false
    },
    {
      "components": [
        {
          "value": 50,
          "factor": "age",
          "points": 0.0,
          "present": false
        },
        {
          "value": 100.0,
          "factor": "crcl_ml_min",
          "points": 0.0,
          "present": false
        },
        {
          "value": 12.0,
          "factor": "hemoglobin_g_dl",
          "points": 0.0,
          "present": false
        },
        {
          "value": 5.0,
          "factor": "wbc_k_ul",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "previous_spontaneous_bleeding",
          "points": 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": "Costa F, van Klaveren D, James S, et al",
        "doi": "10.1016/S0140-6736(17)30397-5",
        "id": "costa-2017",
        "pmid": "28290994",
        "source": "Lancet. 2017;389(10073):1025-1034",
        "title": "Derivation and validation of the predicting bleeding complications in patients undergoing stent implantation and subsequent dual antiplatelet therapy (PRECISE-DAPT) score: a pooled analysis of individual-patient datasets from clinical trials"
      },
      "formula": "precise_dapt",
      "formula_expression": "PRECISE-DAPT = age_points + crcl_points + hemoglobin_points + wbc_points + previous_bleed_points (Costa 2017 Figure 1 nomogram; Table 1 truncated linear terms); age years truncated 50-90 (0 at <=50, 19 at >=90); caller-assigned CrCl mL/min truncated 0-100 (0 at >=100, 25 at 0; magent does not compute Cockcroft-Gault); hemoglobin g/dL truncated 10-12 (0 at >=12, 15 at <=10); WBC x10^3 cells/uL truncated 5-20 (0 at <=5, 15 at >=20); previous spontaneous bleeding 26 if true else 0; integer score is the rounded sum (0-100); high_bleeding_risk iff score >=25",
      "age_years": 50,
      "max_score": 100,
      "score": 0,
      "high_bleeding_risk": false,
      "hemoglobin_g_dl": 12.0,
      "wbc_k_ul": 5.0,
      "crcl_ml_min": 100.0,
      "previous_spontaneous_bleeding": false
    }
  ]
}
```

## Response fields

- `formula` (string): precise_dapt
- `formula_expression` (string): Exact expression used
- `score` (integer): Rounded Costa 2017 Figure 1 nomogram total (0-100)
- `max_score` (integer): 100
- `high_bleeding_risk` (boolean): true iff score >=25, the Costa 2017 high-risk stratum used to compare DAPT duration. No other cutoffs.
- `age_years` (integer): Age used
- `crcl_ml_min` (number): Caller-assigned creatinine clearance, mL/min
- `hemoglobin_g_dl` (number): Hemoglobin used, g/dL
- `wbc_k_ul` (number): WBC used, x10^3 cells per uL
- `previous_spontaneous_bleeding` (boolean): Caller-assigned previous spontaneous bleeding
- `components` (array): Per-factor Figure 1 points
- `citation` (object): Costa et al. Lancet 2017 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": 50,
      "factor": "age",
      "points": 0.0,
      "present": false
    },
    {
      "value": 100.0,
      "factor": "crcl_ml_min",
      "points": 0.0,
      "present": false
    },
    {
      "value": 12.0,
      "factor": "hemoglobin_g_dl",
      "points": 0.0,
      "present": false
    },
    {
      "value": 5.0,
      "factor": "wbc_k_ul",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "previous_spontaneous_bleeding",
      "points": 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": "Costa F, van Klaveren D, James S, et al",
    "doi": "10.1016/S0140-6736(17)30397-5",
    "id": "costa-2017",
    "pmid": "28290994",
    "source": "Lancet. 2017;389(10073):1025-1034",
    "title": "Derivation and validation of the predicting bleeding complications in patients undergoing stent implantation and subsequent dual antiplatelet therapy (PRECISE-DAPT) score: a pooled analysis of individual-patient datasets from clinical trials"
  },
  "formula": "precise_dapt",
  "formula_expression": "PRECISE-DAPT = age_points + crcl_points + hemoglobin_points + wbc_points + previous_bleed_points (Costa 2017 Figure 1 nomogram; Table 1 truncated linear terms); age years truncated 50-90 (0 at <=50, 19 at >=90); caller-assigned CrCl mL/min truncated 0-100 (0 at >=100, 25 at 0; magent does not compute Cockcroft-Gault); hemoglobin g/dL truncated 10-12 (0 at >=12, 15 at <=10); WBC x10^3 cells/uL truncated 5-20 (0 at <=5, 15 at >=20); previous spontaneous bleeding 26 if true else 0; integer score is the rounded sum (0-100); high_bleeding_risk iff score >=25",
  "age_years": 50,
  "max_score": 100,
  "score": 0,
  "high_bleeding_risk": false,
  "hemoglobin_g_dl": 12.0,
  "wbc_k_ul": 5.0,
  "crcl_ml_min": 100.0,
  "previous_spontaneous_bleeding": false
}
```

## Errors

- HTTP 400 `invalid_precise_dapt`: PRECISE-DAPT needs Costa 2017 age, creatinine clearance, hemoglobin, WBC, and prior spontaneous bleeding in published ranges. 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

- [DAPT score](https://magentlab.com/docs/dapt) — Sum the Yeh 2016 DAPT prediction rule after PCI from exclusive age bands and eight caller-assigned flags and return the published high/low band.
- [CRUSADE bleeding score](https://magentlab.com/docs/crusade) — Compute the CRUSADE in-hospital major bleeding score from hematocrit, caller-assigned Cockcroft–Gault creatinine clearance, heart rate, sex, signs of CHF, prior vascular disease, diabetes, and systolic BP (Subherwal 2009 Table 4).

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