# Apify Dataset QA Gate (`leadops_lab/dataset-quality-auditor`) Actor

Pass, warn, or stop Apify datasets before CRM import, enrichment, client delivery, or webhook automation.

- **URL**: https://apify.com/leadops\_lab/dataset-quality-auditor.md
- **Developed by:** [jiaxun mao](https://apify.com/leadops_lab) (community)
- **Categories:** Automation, Developer tools, Lead generation
- **Stats:** 3 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 qa reports

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

## Apify Dataset QA Gate

Pass, warn, or stop Apify datasets before CRM import, enrichment, client delivery, or webhook automation.

This Actor is for teams that run scrapers repeatedly and need a quality gate before bad data flows into expensive or visible downstream steps.

Use it after a scraper and before:

- CRM import
- enrichment APIs
- Google Sheets exports
- client lead-list delivery
- n8n, Make, Zapier, or Apify webhook workflows

### Why use a QA gate?

Deduplication tools clean rows. Enrichment tools add data. This Actor answers the earlier question:

Should this dataset continue through the workflow at all?

It returns:

- `qaStatus`: `PASS`, `WARN`, or `FAIL`
- `automationAction`: `continue`, `review`, or `stop`
- failed quality checks with actual vs expected values
- CRM-ready record count and percentage
- duplicate count and percentage
- field coverage for company, domain, email, phone, location, and category
- sample messy rows for review
- sample clean rows that can continue downstream
- recommendations for cleanup, enrichment, or scoring

### Input options

Use either:

- `records`: paste raw records as JSON.
- `sourceDatasetId`: select an existing Apify Dataset ID.

Example:

```json
{
  "sourceDatasetId": "YOUR_DATASET_ID",
  "requiredFields": ["companyName", "domain", "email", "phone", "location"],
  "passThresholds": {
    "minCrmReadyPercent": 80,
    "maxDuplicatePercent": 10,
    "minRequiredFieldCoveragePercent": 70
  },
  "maxRecords": 10000,
  "sampleSize": 25
}
```

### Automation workflow

1. Run a lead, directory, product, review, or listing scraper.
2. Send the scraper Dataset ID into this Actor.
3. If `automationAction` is `continue`, send clean rows to CRM, Sheets, or enrichment.
4. If `automationAction` is `review`, route the dataset to manual review.
5. If `automationAction` is `stop`, block the workflow before wasting enrichment credits or importing bad data.

### Lead workflow

For lead lists, run this Actor first. If the dataset passes, run Lead Intelligence Scorer to deduplicate, score, and prioritize the leads.

Recommended chain:

`scraper -> QA Gate -> Lead Intelligence Scorer -> CRM/export`

### Best fit

- agencies validating client lead-list deliverables
- operators running scheduled Apify scrapers
- founders sending scraper output into Sheets or a CRM
- automation builders who need a simple pass/fail signal

# Actor input Schema

## `records` (type: `array`):

Paste raw dataset records as JSON objects. Use this or sourceDatasetId.

## `sourceDatasetId` (type: `string`):

Optional Apify Dataset ID to audit instead of inline records.

## `requiredFields` (type: `array`):

Fields that must be present for a row to count as CRM-ready.

## `passThresholds` (type: `object`):

Quality thresholds used to return PASS, WARN, or FAIL for downstream automations.

## `maxRecords` (type: `integer`):

Maximum records to read and audit.

## `sampleSize` (type: `integer`):

Maximum number of rows with missing required fields to include in sampleIssues.

## Actor input object example

```json
{
  "records": [
    {
      "company": "Acme Supply",
      "website": "https://acme.example",
      "email": "sales@acme.example",
      "phone": "+1 555 0100",
      "city": "Austin",
      "state": "TX"
    },
    {
      "company": "Acme Supply",
      "website": "https://www.acme.example/contact",
      "city": "Austin",
      "state": "TX"
    }
  ],
  "requiredFields": [
    "companyName",
    "domain",
    "email",
    "phone",
    "location"
  ],
  "passThresholds": {
    "minCrmReadyPercent": 80,
    "maxDuplicatePercent": 10,
    "minRequiredFieldCoveragePercent": 70
  },
  "maxRecords": 10000,
  "sampleSize": 25
}
```

# 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 = {
    "records": [
        {
            "company": "Acme Supply",
            "website": "https://acme.example",
            "email": "sales@acme.example",
            "phone": "+1 555 0100",
            "city": "Austin",
            "state": "TX"
        },
        {
            "company": "Acme Supply",
            "website": "https://www.acme.example/contact",
            "city": "Austin",
            "state": "TX"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("leadops_lab/dataset-quality-auditor").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 = { "records": [
        {
            "company": "Acme Supply",
            "website": "https://acme.example",
            "email": "sales@acme.example",
            "phone": "+1 555 0100",
            "city": "Austin",
            "state": "TX",
        },
        {
            "company": "Acme Supply",
            "website": "https://www.acme.example/contact",
            "city": "Austin",
            "state": "TX",
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("leadops_lab/dataset-quality-auditor").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 '{
  "records": [
    {
      "company": "Acme Supply",
      "website": "https://acme.example",
      "email": "sales@acme.example",
      "phone": "+1 555 0100",
      "city": "Austin",
      "state": "TX"
    },
    {
      "company": "Acme Supply",
      "website": "https://www.acme.example/contact",
      "city": "Austin",
      "state": "TX"
    }
  ]
}' |
apify call leadops_lab/dataset-quality-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=leadops_lab/dataset-quality-auditor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/7K25m3wKkp08Hgqeb/builds/nPTTQ6nofRFIqaVTc/openapi.json
