# Doctor Prescribing Patterns (Medicare Part D) (`scrapemint/doctor-prescribing-patterns`) Actor

Which doctors prescribe which drugs, and what Medicare paid: official CMS Part D prescriber data by drug, specialty, state or NPI, ranked by spend or claim volume, plus per-prescriber totals and national and state drug totals. No API key.

- **URL**: https://apify.com/scrapemint/doctor-prescribing-patterns.md
- **Developed by:** [Ken M](https://apify.com/scrapemint) (community)
- **Categories:** Business, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

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

## Doctor Prescribing Patterns (Medicare Part D)

Which doctors prescribe which drugs, and what Medicare paid for it. Every Part D prescriber in the United States reports through the program, and CMS publishes the result: the prescriber, the drug, how many claims, how many patients, and the total cost. This actor turns that into structured rows, ranked. No API key, no login, no browser.

The latest year holds about 28 million prescriber and drug combinations, going back to 2013.

### Three modes

**Prescribers by drug** - one row per doctor per drug, ranked highest first:

- NPI, name, specialty, city, state
- brand and generic name
- total claims, 30 day fills, day supply, beneficiaries
- total drug cost and a computed cost per claim

```json
{
    "mode": "prescribers",
    "brandName": "Ozempic",
    "state": "TX",
    "sortBy": "cost",
    "maxRows": 50
}
```

**Provider totals** - one row per prescriber across every drug they wrote, with credentials and ZIP. Use it to size a prescriber overall rather than drug by drug.

**Drug by geography** - national and per state totals for a drug: how many prescribers wrote it, claims, beneficiaries, total cost, plus CMS's own opioid, long acting opioid, antibiotic and antipsychotic flags.

### Ways to search

- **brandName** or **genericName** - Ozempic, Eliquis, Humira, or Semaglutide, Apixaban
- **state**, **specialty** - TX, Cardiology, Endocrinology, Family Practice
- **npi** or **lastName** - one specific prescriber
- **year** - 2013 through the newest published year
- **sortBy** - rank by total cost, claims or beneficiaries

Outside of geography mode a filter is required, because the prescriber table is far too large to browse.

**Names must match exactly, though capitalization does not matter.** The source has no partial search. If a name matches nothing you get a free row suggesting real names close to what you typed, so `zempic` and `ozempik` both come back pointing at `Ozempic`.

### Who uses this

- **Pharma commercial and competitive intelligence**: find the highest volume prescribers of your drug or a competitor's, by specialty and state, without a six figure data contract.
- **Health researchers and policy analysts**: prescribing variation, opioid and antipsychotic patterns, cost per claim across states.
- **Journalists**: outlier prescribers, and the pairing below.
- **Payers and PBMs**: prescriber level spend against your own claims.
- **Medical marketing agencies**: build targeted specialist lists grounded in real prescribing volume.

Joins on NPI with our **Doctor Payments Scraper**, which reports what drug and device companies paid each physician. Money in from one actor, prescriptions out from this one. Pairs with our **Prescription Drug Price Tracker** for what those drugs cost, and with **Healthcare Provider Leads** for prescriber contact details.

### Pricing

A small fee per row returned. Searches that match nothing are free note rows, including the did-you-mean suggestions, and the first 2 rows of every run are free.

### Notes

- Source is the keyless CMS data API at `data.cms.gov`. Dataset ids are resolved at run time from the catalog, so new program years work without an update.
- CMS publishes roughly 18 months behind, so the newest complete year is the default.
- CMS suppresses small counts for privacy: the lowest claim count published is 11, and some 65 and over columns are blanked with a suppression flag.
- Costs are what the program paid in total, including plan and patient portions. They are not a unit price and not what a patient paid at the counter.

# Actor input Schema

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

Prescribers by drug returns one row per doctor per drug, ranked - the flagship view. Provider totals returns one row per prescriber across every drug they wrote. Drug by geography returns national and per-state totals for a drug, with opioid and antibiotic flags.

## `brandName` (type: `string`):

Brand drug name, for example Ozempic, Eliquis, Humira. Must match exactly, though capitalization does not matter. If nothing matches, the run returns free suggestions of real names.

## `genericName` (type: `string`):

Generic ingredient name, for example Semaglutide, Apixaban. Exact match, capitalization does not matter.

## `state` (type: `string`):

Two letter state of the prescriber, for example TX or CA. In drug by geography mode this selects that state's totals instead of national.

## `specialty` (type: `string`):

Prescriber specialty exactly as CMS records it, for example Cardiology, Endocrinology, Family Practice, Internal Medicine.

## `npi` (type: `string`):

Ten digit National Provider Identifier, to pull one specific prescriber. Optional.

## `lastName` (type: `string`):

Prescriber last name or organization name. Exact match, capitalization does not matter. Combine with state to narrow common names.

## `year` (type: `string`):

Which program year to read. CMS publishes about 18 months behind, so the newest complete year is the default.

## `sortBy` (type: `string`):

Highest first. Total cost surfaces the biggest spenders, claims surfaces the highest volume prescribers.

## `maxRows` (type: `integer`):

Maximum rows to return, highest ranked first.

## Actor input object example

```json
{
  "mode": "prescribers",
  "brandName": "Ozempic",
  "state": "TX",
  "year": "2024",
  "sortBy": "cost",
  "maxRows": 50
}
```

# 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 = {
    "mode": "prescribers",
    "brandName": "Ozempic",
    "state": "TX",
    "year": "2024",
    "maxRows": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapemint/doctor-prescribing-patterns").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 = {
    "mode": "prescribers",
    "brandName": "Ozempic",
    "state": "TX",
    "year": "2024",
    "maxRows": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("scrapemint/doctor-prescribing-patterns").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "mode": "prescribers",
  "brandName": "Ozempic",
  "state": "TX",
  "year": "2024",
  "maxRows": 50
}' |
apify call scrapemint/doctor-prescribing-patterns --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=scrapemint/doctor-prescribing-patterns",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/oyP9QkCenbg1NZecA/builds/qARMSVEgAEPUONkfr/openapi.json
