# D:A:D CKD risk score (Mocroft)

D:A:D CKD

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

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

## What it computes

Sum the Mocroft 2015 D:A:D Table 2 full integer CKD risk score from injecting drug use, hepatitis C, age, caller-assigned eGFR >60, sex, nadir CD4, hypertension, prior CVD, and diabetes.

## When to use

When an agent already has those caller-assigned values and needs the published full-score point total and low/medium/high band. magent does not compute eGFR, diagnose HIV or CKD, or order ART.

## When not to use

- Not a medical device. Not a CKD diagnosis and not an antiretroviral (ART) start or switch order.
- Mocroft 2015 Table 2 full integer risk score only. This is not the short score, not the Poisson exact-probability model, not number needed to harm (NNTH), and not an ARV-start decision tool.
- Derivation required eGFR > 60 mL/min. eGFR ≤60 is invalid (not in that population).
- eGFR is caller-assigned. magent does not compute CKD-EPI, MDRD, or Cockcroft–Gault.
- Race was not in the published score and is not an input.
- Flags are caller-supplied booleans. magent does not diagnose injecting drug use, hepatitis C, hypertension, CVD, or diabetes.

## Formula

```
D:A:D full CKD = ivdu 2 + hepatitis_c 1 + age (≤35 0; >35 and ≤50 4; >50 and ≤60 7; >60 10) + egfr (>90 −6; >70 and ≤90 0; >60 and ≤70 6) + female 1 + nadir_cd4 (>200 −1; ≤200 0) + hypertension 1 + prior_cvd 1 + diabetes 2; Mocroft 2015 Table 2; max 24; bands low <0, medium 0–4, high ≥5
```

## Citation

[Development and Validation of a Risk Score for Chronic Kidney Disease in HIV Infection Using Prospective Cohort Data from the D:A:D Study](https://doi.org/10.1371/journal.pmed.1001809)
Mocroft A, Lundgren JD, Ross M, Law M, Reiss P, Kirk O, et al.
PLoS Med. 2015;12(3):e1001809
DOI: [10.1371/journal.pmed.1001809](https://doi.org/10.1371/journal.pmed.1001809)

## Worked example

### Mocroft 2015 worked example (score 12, high)

Given: `age_years=38, diabetes=true, egfr_ml_min=68, hepatitis_c=false, hypertension=false, ivdu=false, nadir_cd4_cells_mm3=250, prior_cvd=false, sex=female`

1. female 1 + no IVDU 0 + no HCV 0 + age 38 → 4 + eGFR 68 → 6 + nadir CD4 250 → −1 + no HTN 0 + no CVD 0 + diabetes 2
2. Score = 12 (max 24); risk_band high


### Young male, eGFR >90, nadir CD4 >200, no flags

Given: `age_years=30, diabetes=false, egfr_ml_min=95, hepatitis_c=false, hypertension=false, ivdu=false, nadir_cd4_cells_mm3=300, prior_cvd=false, sex=male`

1. age ≤35 → 0; eGFR >90 → −6; nadir CD4 >200 → −1; remaining factors 0
2. Score = −7 (max 24); risk_band low


## Also searched as

- D:A:D CKD score
- Mocroft CKD HIV
- D:A:D chronic kidney disease
- HIV CKD risk score
- DAD CKD

## Parameters

- `ivdu` (boolean, required): Caller-assigned injecting drug use (Mocroft 2015 Table 2). true scores 2. magent does not diagnose injecting drug use.
- `hepatitis_c` (boolean, required): Caller-assigned hepatitis C co-infection (Mocroft 2015 Table 2). true scores 1. magent does not diagnose hepatitis C.
- `age_years` (integer, required): Age in years (integer 16-120). Mocroft 2015 Table 2: ≤35 scores 0; >35 and ≤50 scores 4; >50 and ≤60 scores 7; >60 scores 10.
- `egfr_ml_min` (number, required): Caller-assigned eGFR in mL/min (0.1-250, must be >60). Mocroft 2015 Table 2: >90 scores −6; >70 and ≤90 scores 0; >60 and ≤70 scores 6. eGFR ≤60 is outside the derivation population. magent does not compute eGFR.
- `sex` (string, required): Sex (Mocroft 2015 Table 2). female scores 1; male scores 0.
- `nadir_cd4_cells_mm3` (integer, required): Nadir CD4 count in cells/mm³ (integer 0-3000). Mocroft 2015 Table 2: ≤200 scores 0; >200 scores −1. magent does not assay CD4.
- `hypertension` (boolean, required): Caller-assigned hypertension (Mocroft 2015 Table 2). true scores 1. magent does not diagnose hypertension.
- `prior_cvd` (boolean, required): Caller-assigned prior cardiovascular disease (Mocroft 2015 Table 2). true scores 1. magent does not diagnose CVD.
- `diabetes` (boolean, required): Caller-assigned diabetes (Mocroft 2015 Table 2). true scores 2. magent does not diagnose diabetes.

## 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/dad_ckd`
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_years": "38",
      "diabetes": "true",
      "egfr_ml_min": "68",
      "hepatitis_c": "false",
      "hypertension": "false",
      "ivdu": "false",
      "nadir_cd4_cells_mm3": "250",
      "prior_cvd": "false",
      "sex": "female"
    },
    {
      "age_years": "38",
      "diabetes": "true",
      "egfr_ml_min": "68",
      "hepatitis_c": "false",
      "hypertension": "false",
      "ivdu": "false",
      "nadir_cd4_cells_mm3": "250",
      "prior_cvd": "false",
      "sex": "female"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/dad_ckd",
  "items": [
    {
      "components": [
        {
          "factor": "ivdu",
          "points": 0,
          "present": false
        },
        {
          "factor": "hepatitis_c",
          "points": 0,
          "present": false
        },
        {
          "value": 38,
          "factor": "age_years",
          "points": 4,
          "present": true
        },
        {
          "value": 68.0,
          "factor": "egfr_ml_min",
          "points": 6,
          "present": true
        },
        {
          "value": "female",
          "factor": "sex",
          "points": 1,
          "present": true
        },
        {
          "value": 250,
          "factor": "nadir_cd4_cells_mm3",
          "points": -1,
          "present": true
        },
        {
          "factor": "hypertension",
          "points": 0,
          "present": false
        },
        {
          "factor": "prior_cvd",
          "points": 0,
          "present": false
        },
        {
          "factor": "diabetes",
          "points": 2,
          "present": 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.",
      "age_years": 38,
      "citation": {
        "authors": "Mocroft A, Lundgren JD, Ross M, Law M, Reiss P, Kirk O, et al.",
        "doi": "10.1371/journal.pmed.1001809",
        "id": "mocroft-2015",
        "pmid": "25826420",
        "source": "PLoS Med. 2015;12(3):e1001809",
        "title": "Development and Validation of a Risk Score for Chronic Kidney Disease in HIV Infection Using Prospective Cohort Data from the D:A:D Study"
      },
      "formula": "dad_ckd",
      "formula_expression": "D:A:D full CKD = ivdu 2 + hepatitis_c 1 + age (≤35 0; >35 and ≤50 4; >50 and ≤60 7; >60 10) + egfr (>90 −6; >70 and ≤90 0; >60 and ≤70 6) + female 1 + nadir_cd4 (>200 −1; ≤200 0) + hypertension 1 + prior_cvd 1 + diabetes 2; Mocroft 2015 Table 2; max 24; bands low <0, medium 0–4, high ≥5",
      "max_score": 24,
      "score": 12,
      "risk_band": "high",
      "sex": "female",
      "diabetes": true,
      "egfr_ml_min": 68.0,
      "hepatitis_c": false,
      "hypertension": false,
      "ivdu": false,
      "nadir_cd4_cells_mm3": 250,
      "prior_cvd": false
    },
    {
      "components": [
        {
          "factor": "ivdu",
          "points": 0,
          "present": false
        },
        {
          "factor": "hepatitis_c",
          "points": 0,
          "present": false
        },
        {
          "value": 38,
          "factor": "age_years",
          "points": 4,
          "present": true
        },
        {
          "value": 68.0,
          "factor": "egfr_ml_min",
          "points": 6,
          "present": true
        },
        {
          "value": "female",
          "factor": "sex",
          "points": 1,
          "present": true
        },
        {
          "value": 250,
          "factor": "nadir_cd4_cells_mm3",
          "points": -1,
          "present": true
        },
        {
          "factor": "hypertension",
          "points": 0,
          "present": false
        },
        {
          "factor": "prior_cvd",
          "points": 0,
          "present": false
        },
        {
          "factor": "diabetes",
          "points": 2,
          "present": 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.",
      "age_years": 38,
      "citation": {
        "authors": "Mocroft A, Lundgren JD, Ross M, Law M, Reiss P, Kirk O, et al.",
        "doi": "10.1371/journal.pmed.1001809",
        "id": "mocroft-2015",
        "pmid": "25826420",
        "source": "PLoS Med. 2015;12(3):e1001809",
        "title": "Development and Validation of a Risk Score for Chronic Kidney Disease in HIV Infection Using Prospective Cohort Data from the D:A:D Study"
      },
      "formula": "dad_ckd",
      "formula_expression": "D:A:D full CKD = ivdu 2 + hepatitis_c 1 + age (≤35 0; >35 and ≤50 4; >50 and ≤60 7; >60 10) + egfr (>90 −6; >70 and ≤90 0; >60 and ≤70 6) + female 1 + nadir_cd4 (>200 −1; ≤200 0) + hypertension 1 + prior_cvd 1 + diabetes 2; Mocroft 2015 Table 2; max 24; bands low <0, medium 0–4, high ≥5",
      "max_score": 24,
      "score": 12,
      "risk_band": "high",
      "sex": "female",
      "diabetes": true,
      "egfr_ml_min": 68.0,
      "hepatitis_c": false,
      "hypertension": false,
      "ivdu": false,
      "nadir_cd4_cells_mm3": 250,
      "prior_cvd": false
    }
  ]
}
```

## Response fields

- `formula` (string): dad_ckd
- `formula_expression` (string): Exact expression used
- `score` (integer): Mocroft 2015 Table 2 full-score points
- `max_score` (integer): 24
- `risk_band` (string): Mocroft 2015 band: low (score < 0), medium (0–4), or high (≥5). A band, not a CKD diagnosis.
- `age_years` (integer): Age in years used for Table 2 age bands
- `egfr_ml_min` (number): Caller-assigned eGFR used for Table 2 eGFR bands
- `sex` (string): female or male
- `nadir_cd4_cells_mm3` (integer): Nadir CD4 cells/mm³ used for Table 2 nadir bands
- `ivdu` (boolean): Caller-assigned injecting drug use flag
- `hepatitis_c` (boolean): Caller-assigned hepatitis C flag
- `hypertension` (boolean): Caller-assigned hypertension flag
- `prior_cvd` (boolean): Caller-assigned prior CVD flag
- `diabetes` (boolean): Caller-assigned diabetes flag
- `components` (array): Per-factor Table 2 points
- `citation` (object): Mocroft et al. PLoS Med 2015 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "factor": "ivdu",
      "points": 0,
      "present": false
    },
    {
      "factor": "hepatitis_c",
      "points": 0,
      "present": false
    },
    {
      "value": 38,
      "factor": "age_years",
      "points": 4,
      "present": true
    },
    {
      "value": 68.0,
      "factor": "egfr_ml_min",
      "points": 6,
      "present": true
    },
    {
      "value": "female",
      "factor": "sex",
      "points": 1,
      "present": true
    },
    {
      "value": 250,
      "factor": "nadir_cd4_cells_mm3",
      "points": -1,
      "present": true
    },
    {
      "factor": "hypertension",
      "points": 0,
      "present": false
    },
    {
      "factor": "prior_cvd",
      "points": 0,
      "present": false
    },
    {
      "factor": "diabetes",
      "points": 2,
      "present": 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.",
  "age_years": 38,
  "citation": {
    "authors": "Mocroft A, Lundgren JD, Ross M, Law M, Reiss P, Kirk O, et al.",
    "doi": "10.1371/journal.pmed.1001809",
    "id": "mocroft-2015",
    "pmid": "25826420",
    "source": "PLoS Med. 2015;12(3):e1001809",
    "title": "Development and Validation of a Risk Score for Chronic Kidney Disease in HIV Infection Using Prospective Cohort Data from the D:A:D Study"
  },
  "formula": "dad_ckd",
  "formula_expression": "D:A:D full CKD = ivdu 2 + hepatitis_c 1 + age (≤35 0; >35 and ≤50 4; >50 and ≤60 7; >60 10) + egfr (>90 −6; >70 and ≤90 0; >60 and ≤70 6) + female 1 + nadir_cd4 (>200 −1; ≤200 0) + hypertension 1 + prior_cvd 1 + diabetes 2; Mocroft 2015 Table 2; max 24; bands low <0, medium 0–4, high ≥5",
  "max_score": 24,
  "score": 12,
  "risk_band": "high",
  "sex": "female",
  "diabetes": true,
  "egfr_ml_min": 68.0,
  "hepatitis_c": false,
  "hypertension": false,
  "ivdu": false,
  "nadir_cd4_cells_mm3": 250,
  "prior_cvd": false
}
```

## Errors

- HTTP 400 `invalid_dad_ckd`: D:A:D CKD score inputs must match Mocroft 2015 age, eGFR, CD4 nadir, and flag categories from that paper. Returned before settlement; you are not charged.
- 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_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

- [CKD-EPI 2021 eGFR](https://magentlab.com/docs/egfr) — Compute race-free CKD-EPI 2021 creatinine eGFR in mL/min/1.73m2.
- [Cockcroft–Gault CrCl](https://magentlab.com/docs/crcl) — Compute Cockcroft–Gault creatinine clearance in mL/min using total body weight.
- [Schwartz 2009 eGFR](https://magentlab.com/docs/schwartz-gfr) — Compute the 2009 Schwartz bedside CKiD eGFR in mL/min/1.73m2 from height and serum creatinine.

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