# OpenFDA Drug Safety — Adverse Events Scraper (`wakey7dev/openfda-drug-safety`) Actor

Search FDA adverse events by drug, reaction, or manufacturer. Normalizes brand→generic drug names, standardizes reaction terms, and deduplicates manufacturers.

- **URL**: https://apify.com/wakey7dev/openfda-drug-safety.md
- **Developed by:** [Chris Wakefield](https://apify.com/wakey7dev) (community)
- **Categories:** AI, Business
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 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/platform/actors/running/actors-in-store#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

![Chris The Dev](https://raw.githubusercontent.com/chriswakefield87/appstore-screenshot-translator/main/assets/actor-banner.png)

## OpenFDA Drug Safety — Adverse Events Scraper

Search the FDA Adverse Event Reporting System (FAERS) by drug name, reaction, manufacturer, or date range. Returns **normalized results** with brand-to-generic drug name mapping, reaction term standardization, and manufacturer deduplication.

### Features

- 🔍 **4 search modes**: drug name, adverse reaction, manufacturer, date range
- 💊 **Brand → generic mapping**: 130+ drug names normalized (Ozempic→Semaglutide, Humira→Adalimumab, etc.)
- 🩺 **Reaction standardization**: 150+ reaction terms unified (dyspnoea→Shortness of Breath, myocardial infarction→Heart Attack)
- 🏭 **Manufacturer dedup**: legal suffix stripping, case normalization
- 📊 **Top N summaries**: most common drugs, reactions, manufacturers, and countries
- 🆓 **No API key required** — uses the free openFDA API

### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `searchType` | select | ✅ | `drug`, `reaction`, `manufacturer`, or `dateRange` |
| `drugName` | string | for drug | Brand or generic drug name (e.g. ozempic, keytruda) |
| `reaction` | string | for reaction | Side effect to search (e.g. headache, nausea) |
| `manufacturer` | string | for manufacturer | Company name (e.g. pfizer, moderna) |
| `dateFrom` | string | for dateRange | Start date YYYY-MM-DD |
| `dateTo` | string | for dateRange | End date YYYY-MM-DD |
| `maxResults` | integer | no | 1–1000 (default: 100) |
| `seriousOnly` | boolean | no | Only serious events (death, hospitalization, etc.) |

### Example Input

```json
{
  "searchType": "drug",
  "drugName": "ozempic",
  "maxResults": 50,
  "seriousOnly": false
}
```

```json
{
  "searchType": "reaction",
  "reaction": "myocardial infarction",
  "maxResults": 100
}
```

```json
{
  "searchType": "dateRange",
  "dateFrom": "2024-01-01",
  "dateTo": "2024-03-31",
  "maxResults": 200
}
```

### Example Output

```
==========================================================================================
  OPENFDA DRUG SAFETY — ADVERSE EVENT SEARCH RESULTS
==========================================================================================
  Drug: ozempic
  Retrieved:    50 events
  Serious:      38 (76.0%)
  API Queries:  1

  Top Drugs:
    Semaglutide                               50
    Metformin                                  12

  Top Reactions:
    Nausea                                     15
    Vomiting                                   12
    Diarrhea                                    8
    Pancreatitis                                5
    Weight Loss                                 5

  Top Manufacturers:
    Novo Nordisk                               50

  Countries:
    US                                          42
    GB                                           3
    CA                                           2
```

### Use Cases

- **Pharma competitive intelligence** — track adverse event patterns for competitor drugs
- **Legal / mass tort** — identify drug-event associations for litigation
- **Healthcare analytics** — population-level drug safety surveillance
- **Regulatory compliance** — monitor post-market safety signals
- **Academic research** — epidemiological studies on drug safety

### Data Source

Data from the [FDA Adverse Event Reporting System (FAERS)](https://open.fda.gov/apis/drug/event/) via the openFDA API. Updated quarterly by the FDA. Contains 2+ million adverse event reports from 2004 to present.

**License**: Public domain (U.S. government data). See [openFDA terms](https://open.fda.gov/terms/).

### Output

- **Dataset** — full normalized adverse event records
- **OUTPUT** — human-readable summary table
- **STATS** — machine-readable run statistics

### Pricing

Pay-per-event pricing. Only charged for results returned.

# Actor input Schema

## `searchType` (type: `string`):

Choose how to search the FDA adverse events database.

## `drugName` (type: `string`):

Brand or generic drug name (e.g., ozempic, ibuprofen, keytruda). Required for 'drug' search type.

## `reaction` (type: `string`):

Reaction or side effect to search for (e.g., headache, nausea, rash). Required for 'reaction' search type.

## `manufacturer` (type: `string`):

Drug manufacturer / marketing authorization holder (e.g., pfizer, moderna). Required for 'manufacturer' search type.

## `dateFrom` (type: `string`):

Start date for date range search (YYYY-MM-DD). Required for 'dateRange' search type.

## `dateTo` (type: `string`):

End date for date range search (YYYY-MM-DD). Required for 'dateRange' search type.

## `maxResults` (type: `integer`):

Maximum number of results to return (1-1000).

## `seriousOnly` (type: `boolean`):

Only return serious adverse events (hospitalization, death, life-threatening, etc.).

## Actor input object example

```json
{
  "searchType": "drug",
  "maxResults": 100,
  "seriousOnly": false
}
```

# Actor output Schema

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

All normalized adverse event records.

## `summary` (type: `string`):

Human-readable summary of search results.

## `stats` (type: `string`):

Machine-readable statistics from the run.

# 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("wakey7dev/openfda-drug-safety").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("wakey7dev/openfda-drug-safety").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 '{}' |
apify call wakey7dev/openfda-drug-safety --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=wakey7dev/openfda-drug-safety",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/pPPSOUO34GpZgbd2o/builds/173dttB0U7rsUp92U/openapi.json
