# Maps Duplicate Places Audit and Merge Review (`practical_ai_lab_jp/pal-maps-duplicate-places-audit`) Actor

Identify duplicate location records and review merge evidence before CRM/import operations. For Location database maintainers and data stewards. Check the live Pricing tab and input limits.

- **URL**: https://apify.com/practical_ai_lab_jp/pal-maps-duplicate-places-audit.md
- **Developed by:** [Practical AI Lab](https://apify.com/practical_ai_lab_jp) (community)
- **Categories:** Lead generation, SEO tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 duplicate group revieweds

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

## Maps Duplicate Places Audit and Merge Review

Analyze a places or business dataset you already have and get a reviewable list of likely duplicates, with a suggested keep row and a suggested merged record for each group.

**This Actor does not scrape Google Maps or any other website.** It makes no web requests. It only reads rows you give it: either pasted JSON or a dataset you already own on Apify.

### What it does

- Groups rows that share a **place ID**.
- Groups rows that are within a **distance tolerance** and have a **similar normalized title** (case, accents, punctuation and words such as "The", "LLC" and "Inc" are ignored).
- Groups rows with an **identical normalized title** plus a matching phone number or address.
- Treats a shared website as weak evidence only (chains share sites) and never auto-merges on it.
- Builds groups transitively (A matches B, B matches C, so A, B and C form one group).
- Labels each group `auto_merge` or `needs_review`, lists the evidence and any conflicts, and suggests which row to keep and which empty fields can be filled from the other rows.

It never deletes or edits your source data. You apply the decisions yourself.

### Input

| Field | Meaning |
| --- | --- |
| `datasetId` | An existing dataset ID. Takes priority over `items`. |
| `items` | Inline JSON rows (the prefilled sample works as is). |
| `coordinateToleranceMeters` | Maximum distance for a location match. Default 75. |
| `minTitleSimilarity` | Minimum title score for a candidate. Default 0.85. |
| `autoMergeTitleSimilarity` | Score at or above which a nearby match is `auto_merge`. Default 0.95. |
| `fieldMapping` | Optional field-name overrides, for example `{"title": "businessName", "latitude": "gps.lat"}`. |
| `maxRows` | Row cap to protect memory. Default 20000. |
| `maxPairChecks` | Comparison budget. Default 2,000,000. |

Fields are auto-detected from common names: `placeId`, `title` or `name`, `latitude`/`longitude` or `lat`/`lng` or `location.lat`/`location.lng`, `address`, `phone`, `website`, `categoryName`, `reviewsCount`. Use `fieldMapping` if yours differ.

#### Example input

```json
{
  "items": [
    {"placeId": "a1", "title": "Blue Door Bakery", "location": {"lat": 40.7128, "lng": -74.006}},
    {"title": "The Blue Door Bakery", "location": {"lat": 40.71283, "lng": -74.00601}}
  ],
  "coordinateToleranceMeters": 75
}
```

### Output

One dataset item per duplicate group:

- `groupId`, `decision` (`auto_merge` or `needs_review`), `memberCount`
- `evidence`: rules that matched, such as `same_place_id` or `nearby_coordinates_similar_title`
- `conflicts`: for example `same_place_id_different_title`, `differing_phone`, `member_spread_large`
- `keepRowIndex` and `members` (zero-based `rowIndex` into your input, title similarity and distance to the keep row)
- `suggestedMerge` and `filledFields` (which row each filled value came from)

A `SUMMARY` record in the key-value store holds row counts, group counts, the estimated row count after auto-merge, and warnings.

Rows without any title or place ID are skipped and counted. Rows with missing or invalid coordinates (including 0,0) are matched without location, which lowers confidence.

### Pricing

The code emits one pay-per-event charge named `duplicate-group-reviewed` for each duplicate group saved. Current pay-per-event prices are shown in the Store Pricing tab. Invalid input and failed runs save nothing and charge nothing. Runs that find no duplicates charge nothing.

### Limitations and caveats

- Results are heuristics, not ground truth. Always review `needs_review` groups, and spot-check `auto_merge` groups before deleting anything.
- Quality depends on your data. Sparse rows (title only) give weak evidence, and very small datasets say little about how the rules behave on yours. No accuracy figure is claimed here.
- Two different businesses at the same address with similar names (for example clinics in one building) can be wrongly flagged. Two entries of the same business with very different names or far-apart coordinates will be missed.
- Titles in non-Latin scripts are compared as plain text without transliteration or word segmentation, so matching is less reliable.
- Longitudes near ±180° are not matched across the date line.
- If the comparison budget is reached, the summary says so and some duplicates may be missing. Very large clusters of identical titles are only partly compared.
- Source data must be lawfully obtained by you. Respect the terms and privacy rules that apply to it.

### Local checks

`python -m unittest discover -s tests` runs the offline tests.

# Actor input Schema

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

ID of an Apify dataset you already own that holds place rows. If set, the 'Inline rows' field is ignored.

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

Place rows pasted as JSON. Useful for small tests. Clear this field when you use a dataset ID.

## `coordinateToleranceMeters` (type: `integer`):

Two rows can match by location only if they are at most this far apart. Lower it in dense city centers.

## `minTitleSimilarity` (type: `string`):

Nearby rows are candidates only if their normalized titles score at least this value (0.5 to 1). Enter a decimal such as 0.85.

## `autoMergeTitleSimilarity` (type: `string`):

Nearby rows with a title score at or above this value are marked auto_merge; lower scores need review (0.5 to 1). Enter a decimal such as 0.95.

## `fieldMapping` (type: `object`):

Override auto-detected field names. Keys: placeId, title, latitude, longitude, address, phone, website, category, reviewsCount. Values are field names or dotted paths such as gps.lat.

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

Rows beyond this limit are not analysed. Keeps memory use low.

## `maxPairChecks` (type: `integer`):

Safety budget for comparisons. If it is reached, the summary warns that some duplicates may be missing.

## Actor input object example

```json
{
  "items": [
    {
      "placeId": "sample-place-001",
      "title": "Blue Door Bakery",
      "address": "12 Market Street, Springfield",
      "location": {
        "lat": 40.7128,
        "lng": -74.006
      },
      "phone": "+1 555 0100 111",
      "website": "https://bluedoorbakery.example",
      "categoryName": "Bakery",
      "reviewsCount": 120
    },
    {
      "placeId": "sample-place-001",
      "title": "Blue Door Bakery & Cafe",
      "address": "12 Market St, Springfield",
      "location": {
        "lat": 40.7128,
        "lng": -74.006
      }
    },
    {
      "title": "The Blue Door Bakery",
      "location": {
        "lat": 40.71283,
        "lng": -74.00601
      },
      "phone": "(555) 010-0111"
    },
    {
      "placeId": "sample-place-002",
      "title": "Harbor Dental Clinic",
      "address": "400 Pier Road, Springfield",
      "location": {
        "lat": 40.72,
        "lng": -74.01
      },
      "phone": "+1 555 0100 222"
    },
    {
      "title": "Harbor Dental Clinic LLC",
      "phone": "555-010-0222"
    },
    {
      "placeId": "sample-place-003",
      "title": "Greenleaf Market",
      "location": {
        "lat": 40.7,
        "lng": -74
      },
      "website": "https://greenleafmarket.example"
    },
    {
      "placeId": "sample-place-004",
      "title": "Greenleaf Market",
      "location": {
        "lat": 40.76,
        "lng": -73.95
      },
      "website": "https://greenleafmarket.example"
    }
  ],
  "coordinateToleranceMeters": 75,
  "minTitleSimilarity": "0.85",
  "autoMergeTitleSimilarity": "0.95",
  "fieldMapping": {},
  "maxRows": 20000,
  "maxPairChecks": 2000000
}
```

# Actor output Schema

## `results` (type: `string`):

Download rows from the latest run in JSON/CSV.

# 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 = {
    "items": [
        {
            "placeId": "sample-place-001",
            "title": "Blue Door Bakery",
            "address": "12 Market Street, Springfield",
            "location": {
                "lat": 40.7128,
                "lng": -74.006
            },
            "phone": "+1 555 0100 111",
            "website": "https://bluedoorbakery.example",
            "categoryName": "Bakery",
            "reviewsCount": 120
        },
        {
            "placeId": "sample-place-001",
            "title": "Blue Door Bakery & Cafe",
            "address": "12 Market St, Springfield",
            "location": {
                "lat": 40.7128,
                "lng": -74.006
            }
        },
        {
            "title": "The Blue Door Bakery",
            "location": {
                "lat": 40.71283,
                "lng": -74.00601
            },
            "phone": "(555) 010-0111"
        },
        {
            "placeId": "sample-place-002",
            "title": "Harbor Dental Clinic",
            "address": "400 Pier Road, Springfield",
            "location": {
                "lat": 40.72,
                "lng": -74.01
            },
            "phone": "+1 555 0100 222"
        },
        {
            "title": "Harbor Dental Clinic LLC",
            "phone": "555-010-0222"
        },
        {
            "placeId": "sample-place-003",
            "title": "Greenleaf Market",
            "location": {
                "lat": 40.7,
                "lng": -74
            },
            "website": "https://greenleafmarket.example"
        },
        {
            "placeId": "sample-place-004",
            "title": "Greenleaf Market",
            "location": {
                "lat": 40.76,
                "lng": -73.95
            },
            "website": "https://greenleafmarket.example"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("practical_ai_lab_jp/pal-maps-duplicate-places-audit").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 = { "items": [
        {
            "placeId": "sample-place-001",
            "title": "Blue Door Bakery",
            "address": "12 Market Street, Springfield",
            "location": {
                "lat": 40.7128,
                "lng": -74.006,
            },
            "phone": "+1 555 0100 111",
            "website": "https://bluedoorbakery.example",
            "categoryName": "Bakery",
            "reviewsCount": 120,
        },
        {
            "placeId": "sample-place-001",
            "title": "Blue Door Bakery & Cafe",
            "address": "12 Market St, Springfield",
            "location": {
                "lat": 40.7128,
                "lng": -74.006,
            },
        },
        {
            "title": "The Blue Door Bakery",
            "location": {
                "lat": 40.71283,
                "lng": -74.00601,
            },
            "phone": "(555) 010-0111",
        },
        {
            "placeId": "sample-place-002",
            "title": "Harbor Dental Clinic",
            "address": "400 Pier Road, Springfield",
            "location": {
                "lat": 40.72,
                "lng": -74.01,
            },
            "phone": "+1 555 0100 222",
        },
        {
            "title": "Harbor Dental Clinic LLC",
            "phone": "555-010-0222",
        },
        {
            "placeId": "sample-place-003",
            "title": "Greenleaf Market",
            "location": {
                "lat": 40.7,
                "lng": -74,
            },
            "website": "https://greenleafmarket.example",
        },
        {
            "placeId": "sample-place-004",
            "title": "Greenleaf Market",
            "location": {
                "lat": 40.76,
                "lng": -73.95,
            },
            "website": "https://greenleafmarket.example",
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("practical_ai_lab_jp/pal-maps-duplicate-places-audit").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 '{
  "items": [
    {
      "placeId": "sample-place-001",
      "title": "Blue Door Bakery",
      "address": "12 Market Street, Springfield",
      "location": {
        "lat": 40.7128,
        "lng": -74.006
      },
      "phone": "+1 555 0100 111",
      "website": "https://bluedoorbakery.example",
      "categoryName": "Bakery",
      "reviewsCount": 120
    },
    {
      "placeId": "sample-place-001",
      "title": "Blue Door Bakery & Cafe",
      "address": "12 Market St, Springfield",
      "location": {
        "lat": 40.7128,
        "lng": -74.006
      }
    },
    {
      "title": "The Blue Door Bakery",
      "location": {
        "lat": 40.71283,
        "lng": -74.00601
      },
      "phone": "(555) 010-0111"
    },
    {
      "placeId": "sample-place-002",
      "title": "Harbor Dental Clinic",
      "address": "400 Pier Road, Springfield",
      "location": {
        "lat": 40.72,
        "lng": -74.01
      },
      "phone": "+1 555 0100 222"
    },
    {
      "title": "Harbor Dental Clinic LLC",
      "phone": "555-010-0222"
    },
    {
      "placeId": "sample-place-003",
      "title": "Greenleaf Market",
      "location": {
        "lat": 40.7,
        "lng": -74
      },
      "website": "https://greenleafmarket.example"
    },
    {
      "placeId": "sample-place-004",
      "title": "Greenleaf Market",
      "location": {
        "lat": 40.76,
        "lng": -73.95
      },
      "website": "https://greenleafmarket.example"
    }
  ]
}' |
apify call practical_ai_lab_jp/pal-maps-duplicate-places-audit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,practical_ai_lab_jp/pal-maps-duplicate-places-audit"
        }
    }
}
```

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/gdYcvBj3c3PKT8Pve/builds/CXi8d9SuhX3ESlse9/openapi.json
