# Apify Dataset Release QA Gate (`rotvuvo/apify-dataset-release-qa-gate`) Actor

Audit imported Apify-style dataset rows for missing required values, normalized duplicates, field coverage, type drift, URL/domain issues, and invalid emails. Get one PASS/WARN/FAIL report with blockers and sampled problem rows. This Actor does not fetch datasets by ID or mutate data.

- **URL**: https://apify.com/rotvuvo/apify-dataset-release-qa-gate.md
- **Developed by:** [Wit Nomad](https://apify.com/rotvuvo) (community)
- **Categories:** Developer tools, Automation
- **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

## Apify Dataset Release QA Gate

Audit pasted Apify-style dataset rows before you publish or trust an Actor output. The Actor produces one structured release-readiness report with blockers, warnings, scores, and sampled problem rows.

### What it does

- Checks required fields for missing or empty values.
- Detects duplicate rows using one or more top-level unique key fields.
- Normalizes domain and URL-like keys for duplicate detection.
- Reports field coverage for inspected fields.
- Flags type drift across rows, such as a field switching between number, string, and null.
- Validates configured URL/domain fields and email fields.
- Pushes a single summary QA report item to the default dataset.

### Input

This MVP supports `items` mode only.

Required:

- `items`: non-empty array of dataset row objects to audit.

Optional:

- `requiredFields`: top-level field names expected to be present and non-empty.
- `uniqueKeys`: top-level field names used as a composite duplicate key.
- `urlFields`: top-level field names expected to contain URLs or domains.
- `emailFields`: top-level field names expected to contain emails.
- `maxRows`: maximum rows to inspect. Default: `1000`.
- `strictMode`: when true, warnings become release blockers.

Example input:

```json
{
  "items": [
    {
      "name": "Acme AI",
      "domain": "https://acme.ai",
      "email": "hello@acme.ai"
    },
    {
      "name": "Acme AI Inc.",
      "domain": "acme.ai",
      "email": ""
    }
  ],
  "requiredFields": ["name", "domain"],
  "uniqueKeys": ["domain"],
  "urlFields": ["domain"],
  "emailFields": ["email"]
}
```

### Output

The Actor always emits one summary dataset item for any valid non-empty `items` input.

The default dataset is documented by `.actor/dataset_schema.json` for the Store/API output tab. The overview table highlights the release grade, score, row count, duplicate group count, blockers, warnings, recommendations, sample problem rows, and check timestamp.

Key output fields:

- `rowCount`
- `overallScore`
- `grade`: `PASS`, `WARN`, or `FAIL`
- `blockers`
- `warnings`
- `recommendations`
- `duplicateGroups`
- `missingRequiredCounts`
- `fieldCoverage`
- `typeDriftWarnings`
- `urlWarnings`
- `emailWarnings`
- `sampleProblemRows`

Example output shape:

```json
{
  "rowCount": 5,
  "overallScore": 58,
  "grade": "FAIL",
  "blockers": ["Required field \"name\" is missing in 40% of inspected rows."],
  "duplicateCount": 1,
  "missingRequiredCounts": { "name": 2, "domain": 0 }
}
```

### Scoring

The score starts at 100 and subtracts capped penalties for missing required values, duplicate groups, URL/domain warnings, email warnings, and type drift. A report fails when blockers exist or the score drops below 60.

### MVP limitations

- It does not fetch Apify datasets by ID.
- It does not call the Apify cloud API.
- It does not scrape websites.
- It does not use AI/LLM.
- It does not clean or mutate data; it reports quality signals only.
- It does not guarantee Store approval, legal compliance, deliverability, lead accuracy, or commercial usefulness.
- It supports top-level fields only for required-field, unique-key, URL/domain, and email checks.

### Running it

In Apify Console, start with the prefilled input in Apify Console or paste rows using the example input shape above. The prefilled sample intentionally contains quality issues, so a `FAIL` report is expected and proves the audit path is working.

For local source checkout verification:

```bash
npm install
npm test
apify validate-schema
```

To run locally without Apify storage, save the example input as `input.json` and run:

```bash
node src/main.js --input input.json --output output.json
```

# Actor input Schema

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

Input mode. This MVP supports pasted dataset rows only.

## `items` (type: `array`):

Rows from an Apify dataset, spreadsheet, JSON export, or local sample. This MVP audits pasted rows only and does not fetch datasets by ID.

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

Top-level fields that should be present and non-empty in each audited row.

## `uniqueKeys` (type: `array`):

Top-level fields used as a composite key for duplicate detection. Domain and URL-like fields are normalized before comparison.

## `urlFields` (type: `array`):

Top-level fields expected to contain a URL or domain-like value.

## `emailFields` (type: `array`):

Top-level fields expected to contain email values.

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

Maximum input rows to inspect. Leave the default in place for normal runs; do not use this as a tiny Store QA prefill limit.

## `strictMode` (type: `boolean`):

When true, any warning is treated as a release blocker.

## Actor input object example

```json
{
  "mode": "items",
  "items": [
    {
      "name": "Acme AI",
      "domain": "https://acme.ai",
      "email": "hello@acme.ai",
      "employeeCount": 42,
      "sourceUrl": "https://example.com/acme"
    },
    {
      "name": "Acme AI Inc.",
      "domain": "acme.ai",
      "email": "",
      "employeeCount": "42",
      "sourceUrl": "not a url"
    },
    {
      "name": "Beta Tools",
      "domain": "beta.tools",
      "email": "sales@beta.tools",
      "employeeCount": 12,
      "sourceUrl": "https://example.com/beta"
    },
    {
      "name": "",
      "domain": "gamma.example",
      "email": "bad-email",
      "employeeCount": null,
      "sourceUrl": "https://example.com/gamma"
    },
    {
      "domain": "delta.example",
      "email": "contact@delta.example",
      "employeeCount": 8,
      "sourceUrl": "https://example.com/delta"
    }
  ],
  "requiredFields": [
    "name",
    "domain"
  ],
  "uniqueKeys": [
    "domain"
  ],
  "urlFields": [
    "domain",
    "sourceUrl"
  ],
  "emailFields": [
    "email"
  ],
  "maxRows": 1000,
  "strictMode": false
}
```

# 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": "items",
    "items": [
        {
            "name": "Acme AI",
            "domain": "https://acme.ai",
            "email": "hello@acme.ai",
            "employeeCount": 42,
            "sourceUrl": "https://example.com/acme"
        },
        {
            "name": "Acme AI Inc.",
            "domain": "acme.ai",
            "email": "",
            "employeeCount": "42",
            "sourceUrl": "not a url"
        },
        {
            "name": "Beta Tools",
            "domain": "beta.tools",
            "email": "sales@beta.tools",
            "employeeCount": 12,
            "sourceUrl": "https://example.com/beta"
        },
        {
            "name": "",
            "domain": "gamma.example",
            "email": "bad-email",
            "employeeCount": null,
            "sourceUrl": "https://example.com/gamma"
        },
        {
            "domain": "delta.example",
            "email": "contact@delta.example",
            "employeeCount": 8,
            "sourceUrl": "https://example.com/delta"
        }
    ],
    "requiredFields": [
        "name",
        "domain"
    ],
    "uniqueKeys": [
        "domain"
    ],
    "urlFields": [
        "domain",
        "sourceUrl"
    ],
    "emailFields": [
        "email"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("rotvuvo/apify-dataset-release-qa-gate").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": "items",
    "items": [
        {
            "name": "Acme AI",
            "domain": "https://acme.ai",
            "email": "hello@acme.ai",
            "employeeCount": 42,
            "sourceUrl": "https://example.com/acme",
        },
        {
            "name": "Acme AI Inc.",
            "domain": "acme.ai",
            "email": "",
            "employeeCount": "42",
            "sourceUrl": "not a url",
        },
        {
            "name": "Beta Tools",
            "domain": "beta.tools",
            "email": "sales@beta.tools",
            "employeeCount": 12,
            "sourceUrl": "https://example.com/beta",
        },
        {
            "name": "",
            "domain": "gamma.example",
            "email": "bad-email",
            "employeeCount": None,
            "sourceUrl": "https://example.com/gamma",
        },
        {
            "domain": "delta.example",
            "email": "contact@delta.example",
            "employeeCount": 8,
            "sourceUrl": "https://example.com/delta",
        },
    ],
    "requiredFields": [
        "name",
        "domain",
    ],
    "uniqueKeys": ["domain"],
    "urlFields": [
        "domain",
        "sourceUrl",
    ],
    "emailFields": ["email"],
}

# Run the Actor and wait for it to finish
run = client.actor("rotvuvo/apify-dataset-release-qa-gate").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": "items",
  "items": [
    {
      "name": "Acme AI",
      "domain": "https://acme.ai",
      "email": "hello@acme.ai",
      "employeeCount": 42,
      "sourceUrl": "https://example.com/acme"
    },
    {
      "name": "Acme AI Inc.",
      "domain": "acme.ai",
      "email": "",
      "employeeCount": "42",
      "sourceUrl": "not a url"
    },
    {
      "name": "Beta Tools",
      "domain": "beta.tools",
      "email": "sales@beta.tools",
      "employeeCount": 12,
      "sourceUrl": "https://example.com/beta"
    },
    {
      "name": "",
      "domain": "gamma.example",
      "email": "bad-email",
      "employeeCount": null,
      "sourceUrl": "https://example.com/gamma"
    },
    {
      "domain": "delta.example",
      "email": "contact@delta.example",
      "employeeCount": 8,
      "sourceUrl": "https://example.com/delta"
    }
  ],
  "requiredFields": [
    "name",
    "domain"
  ],
  "uniqueKeys": [
    "domain"
  ],
  "urlFields": [
    "domain",
    "sourceUrl"
  ],
  "emailFields": [
    "email"
  ]
}' |
apify call rotvuvo/apify-dataset-release-qa-gate --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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