# Dataset Deduplication & Merge Planner (`quanmatrix/dataset-deduplication-merge-planner`) Actor

Find duplicate groups in Apify datasets, quantify duplicate risk, and generate deterministic merge recommendations without mutating the source.

- **URL**: https://apify.com/quanmatrix/dataset-deduplication-merge-planner.md
- **Developed by:** [Rafael Barreto Haddad](https://apify.com/quanmatrix) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.80 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Deduplication & Merge Planner

Find duplicate groups in Apify datasets, quantify duplicate risk, and generate deterministic merge recommendations without mutating the source.

### Why use this Actor

Duplicate rows propagate into CRMs, warehouses, lead lists, and AI datasets, while automatic deletion can be too risky without explainable grouping. This Actor is designed for repeatable automation rather than a one-off demo. It produces structured, machine-readable evidence that can be scheduled, called through the API, saved as an Apify Task, or inserted into a larger Actor-to-Actor workflow. The goal is to make the result useful to both humans and automated agents without hiding the decision behind an opaque score.

### Key features

- multi-field composite keys.
- duplicate group evidence with masked samples.
- first/last/non-null merge recommendation.
- READ-only source safety with no destructive mutation.
- Structured output designed for downstream automation and monitoring.
- Deterministic behavior suitable for regression tests and scheduled Tasks.
- No external paid AI service is required for the core result.

### Input

Use the Actor input form or API. Dataset-oriented products accept inline test data and, where applicable, an Apify dataset selected through a READ-scoped resource picker. Monitor-oriented products accept a current state plus a previous baseline. The input schema documents every field so Apify AI and other agents can select and populate the Actor without guessing what a parameter means.

### Output

The default dataset contains a structured report with explicit status fields, counts, fingerprints, changes, and issue codes appropriate to this product. Fingerprints are deterministic for the normalized input state, which makes them useful for recurring comparisons. The source data is not silently mutated. When a fail-run option is enabled, the Actor writes the diagnostic report first and then fails the run so an upstream scheduler or integration can stop downstream processing.

### Example

Create a Task using the provided default input, replace the example values with your own dataset or baseline, run it once to establish evidence, and save the resulting fingerprint or report as the next comparison baseline. For scheduled workflows, run the same Task hourly, daily, or weekly according to how quickly the underlying data can change.

### Use cases

- CRM ingestion workflows.
- RAG ingestion workflows.
- e-commerce catalog workflows.
- job feed workflows.
- lead enrichment workflows.
- real-estate feed workflows.
- analytics warehouse workflows.
- financial feed workflows.
- review aggregation workflows.
- social metrics workflows.

### Pricing

The planned pricing is pay-per-event with one clear primary event for one completed structured report. The current planned event price is $0.0040. The design intentionally avoids artificial premium events. If future versions add an independently valuable enrichment or action, pricing will be reviewed against real usage and platform costs before any change.

### Limitations

This Actor evaluates the configured input and does not promise semantic truth beyond observable data. Very large datasets are capped by the configured maximum-item limit. Nested object semantics are intentionally conservative unless the product explicitly reports them. Baselines supplied by the user remain the user's responsibility. A PASS means the configured rules passed, not that every possible business or compliance requirement has been satisfied.

### Integration and automation

Use Apify Tasks for reusable presets and Schedules for recurring checks. Dataset-oriented variants are designed around least-privilege access so a selected dataset can be read without granting unrestricted access to unrelated storage. The structured output can be consumed by another Actor, webhook receiver, database loader, alerting layer, CI system, or AI agent.

# Actor input Schema

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

Optional Apify dataset selected with least-privilege READ access.

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

Optional inline JSON objects for tests or small manual runs.

## `maxItems` (type: `integer`):

Maximum dataset rows to evaluate.

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

Composite fields that define duplicate identity.

## `mergeStrategy` (type: `string`):

first, last, or non\_null.

## Actor input object example

```json
{
  "maxItems": 10000,
  "keyFields": [
    "id"
  ],
  "mergeStrategy": "first"
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("quanmatrix/dataset-deduplication-merge-planner").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("quanmatrix/dataset-deduplication-merge-planner").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 quanmatrix/dataset-deduplication-merge-planner --silent --output-dataset

```

## MCP server setup

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

```

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/eKMSP02mnSLrBU0Ut/builds/qaAUklVFLG0RuHSsK/openapi.json
