# DeltaLote — Dataset Diff & Change Detector (`proficient_rockpool/deltalote-dataset-diff`) Actor

Compare two snapshots from JSON, CSV or Apify datasets. Detect added and missing records and field-level changes using your chosen keys. Get before/after values, a JSON report and a CSV of changes. Useful for tracking catalogs, prices and stock.

- **URL**: https://apify.com/proficient_rockpool/deltalote-dataset-diff.md
- **Developed by:** [JESUS ARIAS](https://apify.com/proficient_rockpool) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 comparison 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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## DeltaLote — Dataset Diff & Change Detector

Compare two snapshots and get a precise report of added, removed and changed records. Designed for catalog monitoring, recurring data exports and automation workflows that need to process only what changed.

Match by a product SKU, listing ID or a composite key. Input order does not matter. Every reported field change includes its previous value, current value and presence flags.

### What it does

- Accepts inline JSON records, CSV text or two explicitly selected Apify datasets.
- Detects additions, absences and field-level changes; reports unchanged counts.
- Ignores selected timestamp/noise fields or compares only selected fields.
- Optionally normalizes plain decimal strings, including comma decimals, without rounding them through floating-point arithmetic.
- Produces one JSON report in the default dataset and two downloadable records: `OUTPUT` and `CHANGES.csv`.
- Rejects duplicate/missing identifiers, incomplete dataset reads and oversized inputs instead of silently truncating them.

### Quick example

```json
{
  "format": "json",
  "keyFields": ["sku"],
  "previous": [{"sku":"A-1","price":"19.90","inStock":true}],
  "current": [{"sku":"A-1","price":"17.90","inStock":false}],
  "numericFields": ["price"]
}
```

This produces one changed record with two changed fields. Change detection uses the supplied snapshots; it does not visit a store to verify prices or availability.

### Input modes

**JSON:** pass `previous` and `current` arrays of objects. An empty previous array is a valid first baseline. An empty current array is blocked when previous has records, unless `allowEmptyCurrent` is deliberately enabled.

**CSV:** set `format` to `csv`, provide `previousCsv` and `currentCsv`, and select `delimiter`: comma, semicolon or tab. Both texts need unique, non-empty headers. Quoted delimiters, escaped quotes, embedded newlines, BOM and CRLF are supported. CSV cells remain strings, preserving identifiers such as `0012`.

**Apify datasets:** set `format` to `datasets` and select `previousDatasetId` and `currentDatasetId` in the input form. Read-only permission is requested for these two resources. Use datasets from completed upstream runs. The loader checks counts and modification timestamps before/after reading; it cannot provide a database transaction across two independently mutable sources.

### Comparison rules

`keyFields` must uniquely identify every row. Composite keys are supported. Keys remain exact, including type and whitespace: numeric `1` and string `"1"` are different identifiers.

`compareFields`, `ignoreFields` and `numericFields` refer to literal top-level names. A field named `product.price` is not interpreted as a nested path. Nested objects are compared as complete values, ignoring property order. Array order remains significant. Missing fields, null, empty strings and zero remain distinct.

`trimStrings` and `ignoreCase` are optional, off by default, and affect compared values only. `numericFields` accepts plain decimal strings/numbers or null, with the chosen decimal separator. Currency symbols, exponent notation, blank numeric strings and thousands grouping are rejected. Encode identifiers or numbers outside the safe JSON number range as strings. Rules are included in the report.

All input fields belonging to inactive formats are ignored. Remove example `ignoreFields`/`numericFields` when your data uses different names. Misspelled selected fields produce a clear input error.

### Output and limits

Each successful run produces **one report**, including `summary`, `changes`, `rules`, `notices`, source metadata and generation time. `CHANGES.csv` has one row per changed field, or one row per added/absent record. Spreadsheet formula-like cells are prefixed with an apostrophe; JSON retains original values.

Limits: 5,000 records per snapshot; 2 MiB combined normalized JSON; 100 top-level fields per record; nesting depth 32. Larger inputs fail clearly. Split large datasets into complete, stable key ranges; do not split them by unrelated row positions.

“Removed” means absent from the supplied current snapshot. It does **not** prove deletion from an external website. Validate upstream crawl completeness before taking action. DeltaLote neither deletes source records nor contacts customers. It compares inputs only.

### Pricing

**$0.02 per completed comparison report**, plus **$0.00005 per Actor start** at 256 MB. Platform usage is included.

Each successful run produces one report, including when no changes are found. Invalid input does not produce a report; the start charge may still apply. Set the run budget to at least **$0.02005**.

### Data handling and integration

The Actor reads only its input and the two Apify datasets explicitly selected by its user, using limited permissions. It writes results to its own run storage. No external AI service, arbitrary URL fetch, proxy or telemetry is used by our application code. Apify hosts input, output and logs under its own platform policies. Do not include passwords or unrelated personal data in your snapshots.

A pipeline can run an upstream collection, wait for completion, then pass its current and previous dataset IDs to DeltaLote. Read the report's `changes` array for downstream work. Retain the new baseline only after the upstream collection and comparison both succeed. Scheduling and notifications belong to that user's own workflow; they are not configured by this package.

### Support

Use the Actor's Issues tab after publication. Include a minimal anonymized example, input rules and error code. Never post API tokens or private production records. Processing is automatic; maintenance, platform changes and support can still require intervention.

# Actor input Schema

## `format` (type: `string`):

Supply both snapshots in the selected format. Inactive-format fields are ignored.

## `previous` (type: `array`):

Baseline records. Each row must be an object; maximum 5,000 rows.

## `current` (type: `array`):

Latest records. Maximum 5,000 rows. Empty current requires explicit permission.

## `previousCsv` (type: `string`):

CSV text including one unique header row. Used only in CSV mode.

## `currentCsv` (type: `string`):

Current CSV text including a header. Used only in CSV mode.

## `delimiter` (type: `string`):

CSV column separator. Comma is the default; select semicolon for many European exports.

## `previousDatasetId` (type: `string`):

Select a stable dataset from a completed run. Read-only access to this selected resource.

## `currentDatasetId` (type: `string`):

Select the newer completed dataset. Sources are never modified.

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

Top-level field names. Combine fields for composite keys. Keys must be unique; types and whitespace are exact.

## `compareFields` (type: `array`):

Empty = all top-level fields except keys and ignored fields. Dot characters are literal, not nested paths.

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

Optional noise fields such as crawl timestamps. A misspelled field fails validation.

## `numericFields` (type: `array`):

Optional exact decimal comparison. Plain decimals only; no currency signs or thousands grouping. Keys cannot be normalized.

## `decimalSeparator` (type: `string`):

Applies only to selected numeric fields. Thousands separators are not accepted.

## `trimStrings` (type: `boolean`):

Applies to compared values, never to identifiers. Original values remain in reports.

## `ignoreCase` (type: `boolean`):

Optional Unicode lowercase comparison. Identifiers remain exact.

## `allowEmptyCurrent` (type: `boolean`):

Keep off to protect against a failed upstream crawl looking like a complete disappearance.

## Actor input object example

```json
{
  "format": "json",
  "previous": [
    {
      "sku": "L-01",
      "producto": "Lámpara Alba",
      "precio": "34.90",
      "stock": true,
      "capturado": "2026-09-21"
    },
    {
      "sku": "C-02",
      "producto": "Cuaderno Mar",
      "precio": "17.50",
      "stock": true,
      "capturado": "2026-09-21"
    },
    {
      "sku": "T-03",
      "producto": "Taza Niebla",
      "precio": "9.00",
      "stock": false,
      "capturado": "2026-09-21"
    },
    {
      "sku": "B-04",
      "producto": "Bolsa Campo",
      "precio": "26.00",
      "stock": true,
      "capturado": "2026-09-21"
    }
  ],
  "current": [
    {
      "sku": "B-04",
      "producto": "Bolsa Campo",
      "precio": "26.00",
      "stock": true,
      "capturado": "2026-09-22"
    },
    {
      "sku": "L-01",
      "producto": "Lámpara Alba",
      "precio": "29.90",
      "stock": true,
      "capturado": "2026-09-22"
    },
    {
      "sku": "C-02",
      "producto": "Cuaderno Mar",
      "precio": "17.50",
      "stock": false,
      "capturado": "2026-09-22"
    },
    {
      "sku": "J-05",
      "producto": "Jarrón Bruma",
      "precio": "12.00",
      "stock": true,
      "capturado": "2026-09-22"
    }
  ],
  "delimiter": ",",
  "keyFields": [
    "sku"
  ],
  "compareFields": [],
  "ignoreFields": [
    "capturado"
  ],
  "numericFields": [
    "precio"
  ],
  "decimalSeparator": ".",
  "trimStrings": false,
  "ignoreCase": false,
  "allowEmptyCurrent": false
}
```

# Actor output Schema

## `report` (type: `string`):

No description

## `json` (type: `string`):

No description

## `csv` (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 = {
    "previous": [
        {
            "sku": "L-01",
            "producto": "Lámpara Alba",
            "precio": "34.90",
            "stock": true,
            "capturado": "2026-09-21"
        },
        {
            "sku": "C-02",
            "producto": "Cuaderno Mar",
            "precio": "17.50",
            "stock": true,
            "capturado": "2026-09-21"
        },
        {
            "sku": "T-03",
            "producto": "Taza Niebla",
            "precio": "9.00",
            "stock": false,
            "capturado": "2026-09-21"
        },
        {
            "sku": "B-04",
            "producto": "Bolsa Campo",
            "precio": "26.00",
            "stock": true,
            "capturado": "2026-09-21"
        }
    ],
    "current": [
        {
            "sku": "B-04",
            "producto": "Bolsa Campo",
            "precio": "26.00",
            "stock": true,
            "capturado": "2026-09-22"
        },
        {
            "sku": "L-01",
            "producto": "Lámpara Alba",
            "precio": "29.90",
            "stock": true,
            "capturado": "2026-09-22"
        },
        {
            "sku": "C-02",
            "producto": "Cuaderno Mar",
            "precio": "17.50",
            "stock": false,
            "capturado": "2026-09-22"
        },
        {
            "sku": "J-05",
            "producto": "Jarrón Bruma",
            "precio": "12.00",
            "stock": true,
            "capturado": "2026-09-22"
        }
    ],
    "ignoreFields": [
        "capturado"
    ],
    "numericFields": [
        "precio"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("proficient_rockpool/deltalote-dataset-diff").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 = {
    "previous": [
        {
            "sku": "L-01",
            "producto": "Lámpara Alba",
            "precio": "34.90",
            "stock": True,
            "capturado": "2026-09-21",
        },
        {
            "sku": "C-02",
            "producto": "Cuaderno Mar",
            "precio": "17.50",
            "stock": True,
            "capturado": "2026-09-21",
        },
        {
            "sku": "T-03",
            "producto": "Taza Niebla",
            "precio": "9.00",
            "stock": False,
            "capturado": "2026-09-21",
        },
        {
            "sku": "B-04",
            "producto": "Bolsa Campo",
            "precio": "26.00",
            "stock": True,
            "capturado": "2026-09-21",
        },
    ],
    "current": [
        {
            "sku": "B-04",
            "producto": "Bolsa Campo",
            "precio": "26.00",
            "stock": True,
            "capturado": "2026-09-22",
        },
        {
            "sku": "L-01",
            "producto": "Lámpara Alba",
            "precio": "29.90",
            "stock": True,
            "capturado": "2026-09-22",
        },
        {
            "sku": "C-02",
            "producto": "Cuaderno Mar",
            "precio": "17.50",
            "stock": False,
            "capturado": "2026-09-22",
        },
        {
            "sku": "J-05",
            "producto": "Jarrón Bruma",
            "precio": "12.00",
            "stock": True,
            "capturado": "2026-09-22",
        },
    ],
    "ignoreFields": ["capturado"],
    "numericFields": ["precio"],
}

# Run the Actor and wait for it to finish
run = client.actor("proficient_rockpool/deltalote-dataset-diff").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 '{
  "previous": [
    {
      "sku": "L-01",
      "producto": "Lámpara Alba",
      "precio": "34.90",
      "stock": true,
      "capturado": "2026-09-21"
    },
    {
      "sku": "C-02",
      "producto": "Cuaderno Mar",
      "precio": "17.50",
      "stock": true,
      "capturado": "2026-09-21"
    },
    {
      "sku": "T-03",
      "producto": "Taza Niebla",
      "precio": "9.00",
      "stock": false,
      "capturado": "2026-09-21"
    },
    {
      "sku": "B-04",
      "producto": "Bolsa Campo",
      "precio": "26.00",
      "stock": true,
      "capturado": "2026-09-21"
    }
  ],
  "current": [
    {
      "sku": "B-04",
      "producto": "Bolsa Campo",
      "precio": "26.00",
      "stock": true,
      "capturado": "2026-09-22"
    },
    {
      "sku": "L-01",
      "producto": "Lámpara Alba",
      "precio": "29.90",
      "stock": true,
      "capturado": "2026-09-22"
    },
    {
      "sku": "C-02",
      "producto": "Cuaderno Mar",
      "precio": "17.50",
      "stock": false,
      "capturado": "2026-09-22"
    },
    {
      "sku": "J-05",
      "producto": "Jarrón Bruma",
      "precio": "12.00",
      "stock": true,
      "capturado": "2026-09-22"
    }
  ],
  "ignoreFields": [
    "capturado"
  ],
  "numericFields": [
    "precio"
  ]
}' |
apify call proficient_rockpool/deltalote-dataset-diff --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,proficient_rockpool/deltalote-dataset-diff"
        }
    }
}
```

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/9Bdt9t8e1wSmyCcFQ/builds/b0d7Mjs6GO1FyJKOQ/openapi.json
