# Dataset Cleaner & Deduplicator — Quality Engine (`egeusta/dataset-quality-deduplication-engine`) Actor

Clean datasets, remove duplicate rows, detect missing values, normalize emails and phones, and validate schemas before exporting to CRM or databases.

- **URL**: https://apify.com/egeusta/dataset-quality-deduplication-engine.md
- **Developed by:** [Ege Usta](https://apify.com/egeusta) (community)
- **Categories:** Developer tools, Automation, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.10 / 1,000 record processeds

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?

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

## Dataset Quality & Deduplication Engine

A deterministic utility for cleaning Apify datasets and structured JSON without an AI model or external API.

### What it does

- exact duplicate detection
- bounded fuzzy duplicate detection with a hard comparison limit
- case, whitespace, and URL normalization
- common tracking-parameter removal
- missing-value and completeness analysis
- field type-consistency analysis
- email syntax validation only
- cleaned records, duplicate/rejected records, and a transparent quality score

### Quick start

```json
{
  "records": [
    { "name": " Acme  ", "url": "https://example.com/product/?utm_source=demo" },
    { "name": "acme", "url": "https://example.com/product/" }
  ],
  "keyFields": ["name", "url"],
  "fuzzyThreshold": 0.9
}
```

For an existing Apify dataset, provide `datasetId` instead of `records`.

### Quality score

The score starts at 100 and applies documented penalties for duplicates, malformed records, missing values, invalid email syntax, and fields with inconsistent non-null types. It is a dataset-health indicator, not a guarantee that values are factually correct.

### Pricing

This Actor is intended as an acquisition utility under pay-per-usage pricing: users pay only standard Apify platform resources and no developer event fee. The Actor uses 256 MB by default and caps rows and fuzzy comparisons to keep compute predictable.

### Limitations

Fuzzy matching uses token similarity inside bounded buckets and may miss reordered or very short near-duplicates. Nested objects are preserved and deterministically serialized, but quality metrics focus on top-level fields. Email validation checks format only; it does not contact mail servers, verify ownership, enrich identities, or harvest addresses. Review cleaned output before replacing production data.

# Actor input Schema

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

Paste JSON objects or use datasetId.

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

Read records from an accessible Apify dataset when pasted records are absent.

## `keyFields` (type: `array`):

Leave empty to compare all non-ignored fields.

## `ignoreFields` (type: `array`):

Exclude volatile fields such as timestamps from duplicate signatures.

## `fuzzyThreshold` (type: `number`):

1 disables fuzzy matches; 0.90 is conservative.

## `normalizeCase` (type: `boolean`):

Lowercase non-URL strings before duplicate comparison.

## `trimWhitespace` (type: `boolean`):

Trim strings and collapse repeated whitespace before analysis.

## `normalizeUrls` (type: `boolean`):

Removes fragments and common tracking parameters; sorts remaining query parameters.

## `removeEmptyStrings` (type: `boolean`):

Represent blank text consistently as null in cleaned rows.

## `validateEmailFormat` (type: `boolean`):

Syntax only. No mailbox lookup, enrichment, or harvesting.

## `outputMode` (type: `string`):

Choose whether the dataset includes cleaned rows, detailed issue rows, or only the summary.

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

Hard cap on input records analyzed in one run.

## `maxComparisons` (type: `integer`):

Hard compute cap; exact duplicate detection continues after the cap.

## Actor input object example

```json
{
  "records": [
    {
      "name": " Acme  ",
      "url": "https://example.com/product/?utm_source=demo",
      "email": "info@example.com"
    },
    {
      "name": "acme",
      "url": "https://example.com/product/",
      "email": "info@example.com"
    }
  ],
  "keyFields": [],
  "ignoreFields": [
    "scrapedAt"
  ],
  "fuzzyThreshold": 0.9,
  "normalizeCase": true,
  "trimWhitespace": true,
  "normalizeUrls": true,
  "removeEmptyStrings": false,
  "validateEmailFormat": true,
  "outputMode": "cleaned_and_issues",
  "maxRows": 5000,
  "maxComparisons": 100000
}
```

# Actor output Schema

## `results` (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 = {
    "records": [
        {
            "name": " Acme  ",
            "url": "https://example.com/product/?utm_source=demo",
            "email": "info@example.com"
        },
        {
            "name": "acme",
            "url": "https://example.com/product/",
            "email": "info@example.com"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("egeusta/dataset-quality-deduplication-engine").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": [
        {
            "name": " Acme  ",
            "url": "https://example.com/product/?utm_source=demo",
            "email": "info@example.com",
        },
        {
            "name": "acme",
            "url": "https://example.com/product/",
            "email": "info@example.com",
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("egeusta/dataset-quality-deduplication-engine").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 '{
  "records": [
    {
      "name": " Acme  ",
      "url": "https://example.com/product/?utm_source=demo",
      "email": "info@example.com"
    },
    {
      "name": "acme",
      "url": "https://example.com/product/",
      "email": "info@example.com"
    }
  ]
}' |
apify call egeusta/dataset-quality-deduplication-engine --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,egeusta/dataset-quality-deduplication-engine"
        }
    }
}

```

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/MfQ092RZzhZ4hhnKX/builds/eGXDxKehMaoOxMuxF/openapi.json
