# Data Quality Gate (`aidatatools/data-quality-gate`) Actor

Before your AI agent acts on a dataset, check if it's trustworthy. Returns a deterministic verdict — RELIABLE / USABLE\_WITH\_CLEANING / UNRELIABLE — with exact facts: completeness,nulls,type errors,impossible values,duplicates, outliers.100% deterministic,no LLM, no hallucination. Any JSON dataset.

- **URL**: https://apify.com/aidatatools/data-quality-gate.md
- **Developed by:** [Nicolas Dupuis](https://apify.com/aidatatools) (community)
- **Categories:** Developer tools, AI, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / actor start

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## Data Quality Gate for AI Agents

**Call this before your agent acts on any dataset.** It returns a deterministic quality verdict so your agent knows whether to trust the data — before making decisions on it.

### When to call this tool

- Before feeding a dataset to an LLM or agent
- Right after a scraper run, to check if the output is usable
- Before loading data into a RAG pipeline
- Whenever an agent receives data from an untrusted or unknown source
- As a quality gate step in any automated data pipeline

### What it returns

A deterministic verdict in one call:

- **Verdict**: RELIABLE / USABLE\_WITH\_CLEANING / UNRELIABLE
- **Score**: 0-100, with transparent weights (recalculable by the agent)
- **Exact facts**: completeness, nulls per field, type consistency, impossible values, exact & fuzzy duplicates, statistical outliers, structural homogeneity, cardinality

### Why it's different

- **100% deterministic** — same data in, same verdict out, always. No LLM, no hallucination, no randomness.
- **Facts separated from verdict** — every number is traceable (method + threshold shown). The agent can trust the verdict OR recalculate from raw facts.
- **Hard gate on factual errors** — any impossible value (negative price, out-of-range rating) caps the verdict, transparently.
- **Transversal** — works on any tabular dataset, any domain (e-commerce, real estate, finance...). No domain assumptions.
- **Never crashes** — malformed, empty, or huge datasets degrade to a valid verdict, never an error.

### Benchmark (real datasets)

Token reduction 88–99.8%: turns a huge raw dataset into a compact, exploitable verdict — saving your agent tokens and preventing decisions on bad data.

### Input

- `datasetId` — an Apify dataset ID from a previous run, OR
- `rawJson` — a raw JSON array of records

### Output

One record: `facts` + `score` (with weights) + `verdict` (level, reasons, recommendation). Stable, predictable structure — safe to code against.

### Deterministic, agent-first

Built for AI agents, not dashboards. No interface, no setup, one call, one verdict, exact.

### MCP server

Ships as an MCP server for direct integration with Claude, Cursor, or any MCP-compatible agent.

# Actor input Schema

## `rawJson` (type: `array`):

The dataset to analyze, as a JSON array of row objects (e.g. items scraped by another Actor). Leave datasetId empty when using this.

## `datasetId` (type: `string`):

ID of an existing Apify dataset to analyze instead of rawJson. Leave rawJson empty (or clear it to \[]) when using this.

## Actor input object example

```json
{
  "rawJson": [
    {
      "id": 1,
      "address": "12 Elm Street",
      "city": "Springfield",
      "price": 250000,
      "surface_m2": 85,
      "rooms": 3,
      "agent_rating": 4.5,
      "listed_date": "2026-05-10",
      "agency": "Homefinder Realty",
      "description": "Charming 2-bedroom apartment near the park, recently renovated, close to transit.",
      "status": "active",
      "agent_notes": null
    },
    {
      "id": 2,
      "address": "45 Oak Avenue",
      "city": "Springfield",
      "price": 265000,
      "surface_m2": 88,
      "rooms": 3,
      "agent_rating": 4.2,
      "listed_date": "2026-05-11",
      "agency": "Homefinder Realty",
      "description": "Charming 2-bedroom apartment near the park, recently renovated, close to the transit stop.",
      "status": "active",
      "agent_notes": null
    },
    {
      "id": 1,
      "address": "12 Elm Street",
      "city": "Springfield",
      "price": 250000,
      "surface_m2": 85,
      "rooms": 3,
      "agent_rating": 4.5,
      "listed_date": "2026-05-10",
      "agency": "Homefinder Realty",
      "description": "Charming 2-bedroom apartment near the park, recently renovated, close to transit.",
      "status": "active",
      "agent_notes": null
    },
    {
      "id": 4,
      "address": "7 Pine Road",
      "city": "Shelbyville",
      "price": "$180,000",
      "surface_m2": 60,
      "rooms": 2,
      "agent_rating": 4.8,
      "listed_date": "2026-04-02",
      "agency": "Homefinder Realty",
      "description": "Cozy studio in the city center, walking distance to shops and restaurants.",
      "status": "active",
      "agent_notes": null
    },
    {
      "id": 5,
      "address": "9 Cedar Court",
      "city": "Shelbyville",
      "price": "$310,500",
      "surface_m2": 110,
      "rooms": 4,
      "agent_rating": 4.6,
      "listed_date": "2026-04-15",
      "agency": "Homefinder Realty",
      "description": "Spacious family home with a large backyard and a two-car garage.",
      "status": "sold",
      "agent_notes": null
    },
    {
      "id": 6,
      "address": "3 Birch Lane",
      "city": "Capital City",
      "price": "$425,000",
      "surface_m2": 140,
      "rooms": 5,
      "agent_rating": 4.9,
      "listed_date": "2026-06-01",
      "agency": "Homefinder Realty",
      "description": "Luxury villa with pool, modern kitchen, and panoramic city views.",
      "status": "active",
      "agent_notes": null
    },
    {
      "id": 7,
      "address": "21 Maple Drive",
      "city": "Capital City",
      "price": "$199,000",
      "surface_m2": -70,
      "rooms": 2,
      "agent_rating": 4.1,
      "listed_date": "2026-03-20",
      "agency": "Homefinder Realty",
      "description": "Bright and airy 1-bedroom condo close to downtown amenities.",
      "status": "active",
      "agent_notes": null
    },
    {
      "id": 8,
      "address": "18 Willow Way",
      "city": "Ogdenville",
      "price": "$145,000",
      "surface_m2": 55,
      "rooms": 2,
      "agent_rating": -1,
      "listed_date": "2026-02-18",
      "agency": "Homefinder Realty",
      "description": "Affordable starter home in a quiet residential neighborhood nearby.",
      "status": "active",
      "agent_notes": null
    },
    {
      "id": 9,
      "address": "30 Aspen Court",
      "city": "Ogdenville",
      "price": "$210,000",
      "surface_m2": 75,
      "rooms": 3,
      "agent_rating": 4.3,
      "listed_date": "1899-01-01",
      "agency": "Homefinder Realty",
      "description": "Recently updated 3-bedroom house with an updated kitchen and bath.",
      "status": "active",
      "agent_notes": null
    },
    {
      "id": 10,
      "address": "55 Chestnut St",
      "city": "North Haverbrook",
      "price": null,
      "surface_m2": 95,
      "rooms": 3,
      "agent_rating": 4.4,
      "listed_date": "2026-05-25",
      "agency": "Homefinder Realty",
      "description": "Modern townhouse with rooftop terrace and secure parking included.",
      "status": true,
      "agent_notes": null
    },
    {
      "id": 11,
      "address": "8 Poplar Place",
      "city": "North Haverbrook",
      "price": "$185,000",
      "surface_m2": 68,
      "agent_rating": 4,
      "listed_date": "2026-05-28",
      "agency": "Homefinder Realty",
      "description": "Well-maintained duplex close to schools and public transportation.",
      "status": "active",
      "agent_notes": null
    },
    {
      "id": 12,
      "address": "14 Sycamore Ave",
      "city": "Brockway",
      "price": "$220,000",
      "surface_m2": 80,
      "rooms": 3,
      "agent_rating": 4.5,
      "listed_date": "2026-06-10",
      "agency": "Homefinder Realty",
      "description": "Turn-key 3-bedroom home with updated appliances and fresh paint.",
      "status": "active",
      "agent_notes": null
    },
    {
      "id": 13,
      "address": "2 Magnolia Blvd",
      "city": "Brockway",
      "price": "",
      "surface_m2": 102,
      "rooms": 4,
      "agent_rating": 4.7,
      "listed_date": "2026-06-12",
      "agency": "Homefinder Realty",
      "description": "Elegant 4-bedroom colonial with a finished basement and deck.",
      "status": "active",
      "agent_notes": null
    },
    {
      "id": 14,
      "address": "27 Redwood Circle",
      "city": "Brockway",
      "price": "$275,000",
      "surface_m2": 90,
      "rooms": 3,
      "agent_rating": 4.2,
      "listed_date": "2026-06-15",
      "agency": "Homefinder Realty",
      "description": "Bright 3-bedroom ranch with an open floor plan and new roof.",
      "status": "active",
      "agent_notes": null
    },
    {
      "id": 15,
      "address": "41 Dogwood Trail",
      "city": "Capital City",
      "price": "$305,000",
      "surface_m2": 105,
      "rooms": 4,
      "agent_rating": 4.6,
      "listed_date": "2026-06-18",
      "agency": "Homefinder Realty",
      "description": "Updated 4-bedroom home near top-rated schools and parks nearby.",
      "status": "active",
      "agent_notes": null
    }
  ]
}
```

# 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("aidatatools/data-quality-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("aidatatools/data-quality-gate").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 aidatatools/data-quality-gate --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,aidatatools/data-quality-gate"
        }
    }
}

```

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/30C13gYmsLpPDH26U/builds/J1WtYmyjae2vRHRjE/openapi.json
