# Recipes

URL: https://docs.healthcare.dev/agents/recipes

## Verify an NPI

An NPI is 10 digits; the last is a Luhn check digit computed over `80840` plus the first nine.

```ts
import { isValidNpi } from "@healthcare.dev/sdk";

isValidNpi("1234567893"); // true
```

A valid check digit doesn't prove the provider exists or is active. Provider lookups
(`/v1/providers/{npi}`) are coming with the NPPES dataset.

## Map an NDC to RxNorm

```sh
curl https://api.healthcare.dev/v1/drugs/ndc/0002-0152-01 \
  -H "Authorization: Bearer $HDEV_API_KEY" | jq '.data.rxnorm'
```

```json
[{ "rxcui": "2679323", "name": "0.5 ML tirzepatide 5 MG/ML Injection [Zepbound]", "tty": "SBD" }]
```

Any NDC format works: `0002-0152-01`, `00002015201` or the product NDC `0002-0152`.

## Find a code's replacement

Retired codes still resolve, so you never have to guess:

```sh
curl https://api.healthcare.dev/v1/codes/icd10cm/<old-code> \
  -H "Authorization: Bearer $HDEV_API_KEY" | jq '.data | {status, effective_end, replaced_by}'
```

If `replaced_by` is empty, the source named no successor: search by description instead and let
a person choose.

## Check a code was valid on a date

```sh
curl "https://api.healthcare.dev/v1/codes/icd10cm/E11.9?as_of=2019-06-01" \
  -H "Authorization: Bearer $HDEV_API_KEY"
```

## Keep a local copy current

Poll `/v1/changes?dataset=icd10cm&since=<last published_at>` daily and apply `added`, `changed`
and `retired` rows.
