# FDA Drug Shortage Monitor (new / status change / resolved) (`sovereign_workspace/fda-drug-shortage-monitor`) Actor

Track FDA drug shortage changes (new, status change, resolved) via openFDA with snapshot delta so reverification noise is not charged.

- **URL**: https://apify.com/sovereign\_workspace/fda-drug-shortage-monitor.md
- **Developed by:** [Chase Mariano](https://apify.com/sovereign_workspace) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 shortage changes

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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## FDA Drug Shortage Monitor

One **event per shortage change** in the FDA Drug Shortages database. A
change is a newly posted shortage or discontinuation, a status change
(e.g. Current → Resolved), an update to availability, the reason or
dates, or a listing that drops out of the feed. You choose what to watch:
drug names, therapeutic categories or NDCs. Built for health-system
pharmacy buyers, GPOs, distributors and pharmacy-software teams who need
"tell me when something I stock changes", not a nightly re-dump of
1,600 rows.

**Pricing: pay per event.** `shortage-change` costs $0.02 per change
reported. Runs where nothing changed cost you nothing.

### How it works

- **First run = baseline.** The first run of a watch stores a snapshot
  and doesn't charge for it. The only exception is listings FDA first
  posted in the last `first_run_new_days` days (default 7), which are
  reported as `new` so run one isn't empty.
- **Every later run reports only what changed since the last one.** The
  Actor compares substantive fields: status, availability, shortage
  reason, notes, discontinued date, resolved note and status-change date.
  **FDA's routine reverifications are not changes.** They bump the
  "updated" date without changing anything, and you are never charged
  for them.
- **Nothing is lost or charged twice.** A change cut off by your max
  charge or the per-run limit stays pending and is reported next run,
  exactly once.
- **Feed-gap guard.** If 25 or more watched records (and over 20% of
  them) vanish at once, the run stops without charging and keeps the
  snapshot. That pattern is almost always an upstream gap, not news.
- Changing the status or change-type filters doesn't reset your
  baseline. Changing keywords, categories or NDCs starts a new watch,
  and so does a new `state_key`.

### Input

```json
{"keywords": ["cisplatin", "carboplatin"], "therapeutic_categories": ["Oncology"],
 "change_types": ["new", "status_changed", "removed"]}
```

### Example output (one dataset item per change)

```json
{"change_type": "new", "changed_fields": [], "previous_status": null,
 "previous_values": {}, "generic_name": "Insulin Lispro Injection",
 "brand_name": "INSULIN LISPRO JUNIOR KWIKPEN", "company_name": "Eli Lilly and Co.",
 "package_ndc": "0002-7752-05",
 "presentation": "Insulin Lispro Junior KwikPen, Injection, 100 [iU]/1 mL (NDC 0002-7752-05)",
 "dosage_form": "Injection", "therapeutic_category": "Endocrinology/Metabolism",
 "status": "To Be Discontinued", "availability": null, "shortage_reason": null,
 "related_info": "A business decision was made to discontinue manufacture of the drug. Distribution projected to end June 2027. …",
 "discontinued_date": "2026-09-01", "resolved_note": null, "change_date": null,
 "initial_posting_date": "2026-09-01", "update_date": "2026-09-01",
 "update_type": "New", "related_info_link": null,
 "record_key": "0002-7752-05|discontinuation", "feed_last_updated": "2026-09-23"}
```

A status change looks like this (trimmed):

```json
{"change_type": "status_changed", "changed_fields": ["status", "resolved_note"],
 "previous_status": "Current",
 "previous_values": {"status": "Current", "resolved_note": null},
 "generic_name": "Rifapentine Tablet, Film Coated", "status": "Resolved",
 "resolved_note": "Available", "change_date": "2026-08-06"}
```

### Output fields

One dataset item per change. Every field is always present (empty or
null when the source has no value). Defined in
`.actor/dataset_schema.json`. Dates are `YYYY-MM-DD`.

| Field | Type | Description |
|---|---|---|
| `change_type` | string | new, status\_changed, updated or removed |
| `changed_fields` | array | Tracked fields that changed (status\_changed / updated only) |
| `previous_status` | string | Status before this change (null for new) |
| `previous_values` | object | Old value of each changed field |
| `generic_name` | string | Generic name and dosage form as FDA lists it |
| `brand_name` | string | Brand name(s) from openFDA label data, '; '-joined |
| `company_name` | string | Company reporting the shortage/discontinuation |
| `package_ndc` | string | Package NDC |
| `presentation` | string | Presentation (product, strength, package; max 500 chars) |
| `dosage_form` | string | Dosage form |
| `therapeutic_category` | string | FDA therapeutic categories, '; '-joined |
| `status` | string | Current, To Be Discontinued or Resolved (last known, for removed) |
| `availability` | string | Availability as FDA lists it (e.g. Available, Limited Availability, Unavailable) |
| `shortage_reason` | string | Reason for the shortage as reported |
| `related_info` | string | Company/FDA notes (max 1000 chars) |
| `discontinued_date` | string | Discontinuation date, YYYY-MM-DD |
| `resolved_note` | string | Resolution note (resolved entries) |
| `change_date` | string | FDA status change date, YYYY-MM-DD |
| `initial_posting_date` | string | First posted by FDA, YYYY-MM-DD |
| `update_date` | string | Last FDA update or reverification, YYYY-MM-DD |
| `update_type` | string | FDA's last update type: New, Revised or Reverified |
| `related_info_link` | string | Link to the FDA Drug Shortages page for the ingredient |
| `record_key` | string | Stable id: package NDC | list (shortage or discontinuation) |
| `feed_last_updated` | string | openFDA dataset last\_updated date at run time |

`removed` means FDA took the listing off the feed. Most resolved
shortages leave this way rather than switching to "Resolved", so treat
`removed` as "no longer listed", not as a confirmed resolution.

Runs stop cleanly at your max-charge limit: nothing is pushed past what
you agreed to pay for.

The watch snapshot lives in a named key-value store in your account,
`fda-drug-shortage-monitor-state`.

Source: the openFDA drug shortages API (public, CC0, updated daily). It
mirrors FDA's Drug Shortages database. On 2026-09-23 the ingredient
lists matched FDA's own page exactly. Not affiliated with or endorsed by
FDA. openFDA says: "Do not rely on openFDA to make decisions regarding
medical care." Run it on a daily schedule for a standing watch. Pair it
with **FDA Recall Monitor** for recalls in the same categories.

# Actor input Schema

## `profile` (type: `string`):

Named config preset applied at start. Any field you set explicitly below overrides the preset.

## `keywords` (type: `array`):

Watch only shortages whose generic, brand or substance name contains at least one of these words (e.g. cisplatin, amoxicillin). Leave empty to watch every listed drug.

## `therapeutic_categories` (type: `array`):

Watch only these FDA therapeutic categories, exact name, any case (e.g. Oncology, Anesthesia, Anti-Infective, Pediatric, Cardiovascular, Total Parenteral Nutrition). Leave empty for all.

## `ndcs` (type: `array`):

Watch only these NDCs. A labeler or product code (e.g. 0409 or 0409-4888) matches every package under it. Leave empty for all.

## `statuses` (type: `array`):

Report only changes where the new or previous status is one of: Current, To Be Discontinued, Resolved. Leave empty for all.

## `change_types` (type: `array`):

Report only these change types: new, status\_changed, updated, removed. Leave empty for all four.

## `first_run_new_days` (type: `integer`):

The first run of a watch records a baseline and charges nothing for it, except listings FDA first posted in the last N days, which are reported as new. 0 = a silent baseline.

## `limit` (type: `integer`):

Maximum changes to report per run. Changes over the limit are not lost: they are reported (and charged) on the next run.

## `state_key` (type: `string`):

Names the stored snapshot this watch compares against. Leave blank to derive it from your keywords, categories and NDCs. Use a new name to start a fresh baseline. Letters, digits, - and \_ only.

## `allow_mass_removal` (type: `boolean`):

By default, if 25+ watched records (and over 20%) vanish from the feed at once, the run stops without charging, since that is almost always an FDA feed gap. Turn on only to accept a real bulk delisting.

## `api_key` (type: `string`):

Optional free openFDA key (open.fda.gov). Raises the daily request cap. Never logged.

## Actor input object example

```json
{
  "first_run_new_days": 7,
  "limit": 100,
  "allow_mass_removal": false
}
```

# Actor output Schema

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

No description

## `errorCounters` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("sovereign_workspace/fda-drug-shortage-monitor").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("sovereign_workspace/fda-drug-shortage-monitor").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 '{}' |
apify call sovereign_workspace/fda-drug-shortage-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,sovereign_workspace/fda-drug-shortage-monitor"
        }
    }
}
```

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/VD3xxEyUWk1bgBdVc/builds/AM62F2CHWbmpyoHkD/openapi.json
