1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "sources": [{
10 "id": "crm",
11 "format": "records",
12 "records": [
13 {
14 "Customer ID": "C-100",
15 "Name": "Ada Lovelace",
16 "Email": "ADA@example.com",
17 "Company": "Engines Ltd",
18 },
19 {
20 "Customer ID": "C-100",
21 "Name": "Ada Lovelace",
22 "Email": "ada@example.com",
23 "Company": "Analytical Engines Limited",
24 },
25 {
26 "Customer ID": "C-102",
27 "Name": "Grace Hopper",
28 "Email": "grace@example.com",
29 "Company": "Compiler Systems",
30 },
31 ],
32 }],
33 "identityFields": [
34 {
35 "field": "email",
36 "matchType": "email",
37 "weight": 3,
38 },
39 {
40 "field": "name",
41 "matchType": "fuzzy",
42 "weight": 1,
43 },
44 ],
45 "blockingFields": ["email"],
46 "neverMergeFields": ["customer_id"],
47 "survivorship": { "company": "longest" },
48}
49
50
51run = client.actor("first_watch/duplicate-record-detection-and-merging").call(run_input=run_input)
52
53
54print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
55for item in client.dataset(run.default_dataset_id).iterate_items():
56 print(item)
57
58