1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "listings": [
12 {
13 "placeId": "a1",
14 "category": "Cafe",
15 "postalCode": "100-0001",
16 "rating": 4.4
17 },
18 {
19 "placeId": "a2",
20 "category": "Cafe",
21 "postalCode": "100-0002",
22 "rating": 4.1
23 },
24 {
25 "placeId": "a3",
26 "category": "Cafe",
27 "postalCode": "100-0003",
28 "rating": 4.6
29 },
30 {
31 "placeId": "a4",
32 "category": "Gym",
33 "postalCode": "100-0004",
34 "rating": 4.2
35 },
36 {
37 "placeId": "a5",
38 "category": "Gym",
39 "postalCode": "100-0005",
40 "rating": 3.9
41 },
42 {
43 "placeId": "b1",
44 "category": "Cafe",
45 "postalCode": "200-0001",
46 "rating": 4
47 },
48 {
49 "placeId": "b2",
50 "category": "Cafe",
51 "postalCode": "200-0002",
52 "rating": 4.3
53 },
54 {
55 "placeId": "b3",
56 "category": "Cafe",
57 "postalCode": "200-0003",
58 "rating": 4.5
59 },
60 {
61 "placeId": "b4",
62 "category": "Gym",
63 "postalCode": "200-0004",
64 "rating": 4
65 },
66 {
67 "placeId": "b5",
68 "category": "Gym",
69 "postalCode": "200-0005",
70 "rating": 4.4
71 },
72 {
73 "placeId": "c1",
74 "category": "Cafe",
75 "postalCode": "300-0001",
76 "rating": 4.2
77 },
78 {
79 "placeId": "c2",
80 "category": "Cafe",
81 "postalCode": "300-0002",
82 "rating": 4
83 },
84 {
85 "placeId": "c3",
86 "category": "Cafe",
87 "postalCode": "300-0003",
88 "rating": 4.7
89 }
90 ],
91 "minCategoryListings": 1,
92 "minExpectedListings": 0.5,
93 "minDeficit": 0.5
94};
95
96
97const run = await client.actor("practical_ai_lab_jp/pal-maps-business-coverage-gaps").call(input);
98
99
100console.log('Results from dataset');
101console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
102const { items } = await client.dataset(run.defaultDatasetId).listItems();
103items.forEach((item) => {
104 console.dir(item);
105});
106
107