# NLM Clinical Tables Scraper (ICD-10, NPI, Conditions, Drugs) (`ninhothedev/nlm-clinical-tables-scraper`) Actor

$0.5/1K 🔥 NLM Clinical Tables! Search ICD-10, RxNorm, LOINC & clinical code sets. No key. JSON, CSV, Excel or API in seconds. Build medical coding and EHR tools ⚡

- **URL**: https://apify.com/ninhothedev/nlm-clinical-tables-scraper.md
- **Developed by:** [ninhothedev](https://apify.com/ninhothedev) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## NLM Clinical Tables Scraper (ICD-10, NPI, Conditions, Procedures, Drugs)

Fast, autocomplete-grade medical lookups across **seven** NLM Clinical Table Search Service datasets from a **single** actor — pick a table, pass search terms, get clean structured rows. **No API key. No account. No proxy required.**

Tables supported (one `mode` selector drives them all):

| `mode` | Dataset | Example code |
|---|---|---|
| `icd10cm` | ICD-10-CM diagnoses | `E11.9` |
| `npi_idv` | NPI individual providers | `1942278643` |
| `npi_org` | NPI provider organizations | `1982048666` |
| `conditions` | Medical conditions | `Asthma` |
| `procedures` | Medical procedures | `Breast biopsy` |
| `rxterms` | RxTerms drugs (+ strengths/forms + RxCUIs) | `Aspirin (Oral Pill)` |
| `hcpcs` | HCPCS procedure/supply codes | `K0001` |

Great for **medical coding**, **EHR/EMR autocomplete**, **provider lookup / NPI enrichment**, and **pharmacy tools** — anywhere you need instant, standards-based clinical term resolution.

***

### Why use this instead of hitting the raw API?

The NLM Clinical Table Search Service is fast and free, but its responses are a **trap for the unwary**: every endpoint returns a **positional JSON array**, never an object:

```
[ totalCount, [codes...], hashOrNull, [[displayFieldValues...]], [extraMatrix?] ]
    idx 0       idx 1        idx 2            idx 3                    idx 4
```

- `idx 0` — total matches available on the server
- `idx 1` — the list of codes
- `idx 2` — `null`, **or** (when you request extra fields via `ef=`) a dict of `ef-name -> per-row list-of-lists`
- `idx 3` — the display-field matrix: one row per code, each column ordered **exactly** as you asked in `df=`
- `idx 4` — optional code-system matrix

A naive `response["name"]` **fails completely** — there are no keys. You have to know precisely which `df` and `ef` you requested and re-associate every column by its numeric position. Miss the `sf=code,name` search-field quirk on `icd10cm` and a query like `diabetes` silently returns **zero** results.

This actor does all of that for you: it pins the correct `df`/`ef`/`sf` per table, un-pivots the positional arrays, and emits **flat, named rows** where every value is resolved to its real column name — a bare positional index is **never** emitted as a value.

***

### Output

Each item is a generic `clinical_record`:

```json
{
  "type": "clinical_record",
  "table": "npi_idv",
  "code": "1942278643",
  "primary_name": "SMITH, SMITH",
  "name": null,
  "full_name": "SMITH, SMITH",
  "provider_type": "Physician/Internal Medicine",
  "strengths_and_forms": null,
  "rxcuis": null,
  "address": "9912 LITTLE RD, NEW PORT RICHEY, FL 34654",
  "taxonomy": "Physician/Internal Medicine",
  "fields": {
    "NPI": "1942278643",
    "name.full": "SMITH, SMITH",
    "provider_type": "Physician/Internal Medicine",
    "addr_practice.full": "9912 LITTLE RD, NEW PORT RICHEY, FL 34654"
  },
  "query": "smith",
  "total_available": 10000,
  "url": "https://npiregistry.cms.hhs.gov/provider-view/1942278643",
  "source": "nlm-clinical-tables",
  "scraped_at": "2026-08-11T00:00:00Z"
}
```

- `fields` always maps **each requested df/ef name → its value** for that row.
- Common columns are promoted to top-level when present: `name`, `full_name`, `provider_type`, `strengths_and_forms` (list), `rxcuis` (list), `address`, `taxonomy`.
- `url` is a best-effort deep link where one exists (ICD-10 → icd10data, NPI → the CMS NPI Registry), else `null`.
- All fields are nullable.

For `rxterms`, `strengths_and_forms` and `rxcuis` come back as **lists** per drug, e.g. `["81 mg Cap", "325 mg Tab", ...]` and `["252857", "308416", ...]`.

***

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | select | `icd10cm` | Which table to search (`icd10cm`, `npi_idv`, `npi_org`, `conditions`, `procedures`, `rxterms`, `hcpcs`). |
| `queries` | array | `["diabetes","hypertension"]` | Autocomplete-style search terms; each runs its own search. |
| `maxItemsPerQuery` | integer | `50` | Max rows per term (maps to the API's `count`/`maxList`; auto-paginated past 500). |
| `maxItems` | integer | `300` (max `5000`) | Hard cap on total items across all queries. |

Example:

```json
{
  "mode": "rxterms",
  "queries": ["aspirin", "ibuprofen"],
  "maxItemsPerQuery": 25,
  "maxItems": 200
}
```

***

### Pricing

Runs are cheap: the NLM API is free and keyless, and lookups are lightweight autocomplete calls. Budget roughly **~$0.50 per 1,000 records** in platform usage — most real jobs cost pennies.

***

### How this differs from my other medical/clinical actors

This actor is **the NLM Clinical Table Search Service** — fast, autocomplete-grade **terminology/registry lookups** (ICD-10-CM, NPI, conditions, procedures, HCPCS, RxTerms). It is **not** a trials database and **not** a full drug-terminology graph:

- **[clinical-trials-scraper](https://apify.com/ninhothedev/clinical-trials-scraper)** — searches ClinicalTrials.gov study records (interventions, phases, sponsors, eligibility, locations). Use it for **research studies**, not code lookups.
- **[rxnorm-scraper](https://apify.com/ninhothedev/rxnorm-scraper)** — the full **RxNorm** normalized drug graph (ingredients, brand/generic relationships, NDC/RxCUI crosswalks). Use it for deep **drug normalization**; use *this* actor's `rxterms` mode for quick clinician-facing drug-name + strength/form autocomplete.

Related actors: [clinical-trials-scraper](https://apify.com/ninhothedev/clinical-trials-scraper), [rxnorm-scraper](https://apify.com/ninhothedev/rxnorm-scraper), [ncbi-eutils-scraper](https://apify.com/ninhothedev/ncbi-eutils-scraper), [hpo-phenotype-scraper](https://apify.com/ninhothedev/hpo-phenotype-scraper).

***

### Data source & notes

Data: **NLM Clinical Table Search Service** (`https://clinicaltables.nlm.nih.gov/api`), a free public service of the U.S. National Library of Medicine. This actor is an independent tool and is not affiliated with or endorsed by the NLM. Respect the source's terms and use responsibly.

# Actor input Schema

## `mode` (type: `string`):

Which NLM Clinical Table to search. icd10cm = ICD-10-CM diagnoses; npi\_idv = individual providers (NPI registry); npi\_org = provider organizations; conditions = medical conditions; procedures = medical procedures; rxterms = RxTerms drugs (with strengths/forms + RxCUIs); hcpcs = HCPCS procedure/supply codes.

## `queries` (type: `array`):

One or more autocomplete-style search terms to look up in the selected table. Each term runs its own search (e.g. a diagnosis name, provider surname, drug name).

## `maxItemsPerQuery` (type: `integer`):

Maximum number of matched rows to return for each search term. Maps to the API's count/maxList paging (the API caps a single page at 500; larger values are paginated automatically).

## `maxItems` (type: `integer`):

Hard cap on the total number of clinical\_record items pushed across all queries in this run.

## Actor input object example

```json
{
  "mode": "icd10cm",
  "queries": [
    "diabetes",
    "hypertension"
  ],
  "maxItemsPerQuery": 50,
  "maxItems": 300
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "queries": [
        "diabetes",
        "hypertension"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ninhothedev/nlm-clinical-tables-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "queries": [
        "diabetes",
        "hypertension",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ninhothedev/nlm-clinical-tables-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "queries": [
    "diabetes",
    "hypertension"
  ]
}' |
apify call ninhothedev/nlm-clinical-tables-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ninhothedev/nlm-clinical-tables-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/XUx1iy2KfUdUwUXDd/builds/MW2KQfkf5DSIgnEre/openapi.json
