1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "sessionId": "session-001",
12 "firstPassId": "first",
13 "recountPassId": "recount",
14 "cutOffEvidence": "comparable",
15 "baselineCoverage": "complete",
16 "baselineRows": [
17 {
18 "rowId": "b0",
19 "sessionId": "session-001",
20 "sku": "0001",
21 "locationId": "warehouse-A",
22 "lotId": "",
23 "unit": "each",
24 "quantity": "0"
25 },
26 {
27 "rowId": "b1",
28 "sessionId": "session-001",
29 "sku": "revised",
30 "locationId": "warehouse-A",
31 "lotId": "",
32 "unit": "each",
33 "quantity": "12.5"
34 },
35 {
36 "rowId": "b2",
37 "sessionId": "session-001",
38 "sku": "missing-second",
39 "locationId": "warehouse-A",
40 "lotId": "",
41 "unit": "each",
42 "quantity": "5"
43 },
44 {
45 "rowId": "b3",
46 "sessionId": "session-001",
47 "sku": "duplicate-counter",
48 "locationId": "warehouse-A",
49 "lotId": "",
50 "unit": "each",
51 "quantity": "7"
52 },
53 {
54 "rowId": "b4",
55 "sessionId": "session-001",
56 "sku": "tracked",
57 "locationId": "warehouse-A",
58 "lotId": "lot-01",
59 "unit": "each",
60 "quantity": "9"
61 },
62 {
63 "rowId": "b5",
64 "sessionId": "session-001",
65 "sku": "units",
66 "locationId": "warehouse-A",
67 "lotId": "",
68 "unit": "kg",
69 "quantity": "1.125"
70 }
71 ],
72 "countRows": [
73 {
74 "rowId": "c0",
75 "sessionId": "session-001",
76 "passId": "first",
77 "sku": "0001",
78 "locationId": "warehouse-A",
79 "lotId": "",
80 "unit": "each",
81 "countedQuantity": "0"
82 },
83 {
84 "rowId": "c1",
85 "sessionId": "session-001",
86 "passId": "recount",
87 "sku": "0001",
88 "locationId": "warehouse-A",
89 "lotId": "",
90 "unit": "each",
91 "countedQuantity": "0.000"
92 },
93 {
94 "rowId": "c2",
95 "sessionId": "session-001",
96 "passId": "first",
97 "sku": "revised",
98 "locationId": "warehouse-A",
99 "lotId": "",
100 "unit": "each",
101 "countedQuantity": "12"
102 },
103 {
104 "rowId": "c3",
105 "sessionId": "session-001",
106 "passId": "recount",
107 "sku": "revised",
108 "locationId": "warehouse-A",
109 "lotId": "",
110 "unit": "each",
111 "countedQuantity": "12.5"
112 },
113 {
114 "rowId": "c4",
115 "sessionId": "session-001",
116 "passId": "first",
117 "sku": "missing-second",
118 "locationId": "warehouse-A",
119 "lotId": "",
120 "unit": "each",
121 "countedQuantity": "5"
122 },
123 {
124 "rowId": "c5",
125 "sessionId": "session-001",
126 "passId": "first",
127 "sku": "duplicate-counter",
128 "locationId": "warehouse-A",
129 "lotId": "",
130 "unit": "each",
131 "countedQuantity": "7"
132 },
133 {
134 "rowId": "c6",
135 "sessionId": "session-001",
136 "passId": "first",
137 "sku": "duplicate-counter",
138 "locationId": "warehouse-A",
139 "lotId": "",
140 "unit": "each",
141 "countedQuantity": "7"
142 },
143 {
144 "rowId": "c7",
145 "sessionId": "session-001",
146 "passId": "recount",
147 "sku": "duplicate-counter",
148 "locationId": "warehouse-A",
149 "lotId": "",
150 "unit": "each",
151 "countedQuantity": "7"
152 },
153 {
154 "rowId": "c8",
155 "sessionId": "session-001",
156 "passId": "first",
157 "sku": "tracked",
158 "locationId": "warehouse-A",
159 "lotId": "",
160 "unit": "each",
161 "countedQuantity": "9"
162 },
163 {
164 "rowId": "c9",
165 "sessionId": "session-001",
166 "passId": "recount",
167 "sku": "tracked",
168 "locationId": "warehouse-A",
169 "lotId": "",
170 "unit": "each",
171 "countedQuantity": "9"
172 },
173 {
174 "rowId": "c10",
175 "sessionId": "session-001",
176 "passId": "first",
177 "sku": "units",
178 "locationId": "warehouse-A",
179 "lotId": "",
180 "unit": "g",
181 "countedQuantity": "1125"
182 },
183 {
184 "rowId": "c11",
185 "sessionId": "session-001",
186 "passId": "recount",
187 "sku": "units",
188 "locationId": "warehouse-A",
189 "lotId": "",
190 "unit": "g",
191 "countedQuantity": "1125"
192 },
193 {
194 "rowId": "c12",
195 "sessionId": "session-001",
196 "passId": "first",
197 "sku": "count-only",
198 "locationId": "warehouse-A",
199 "lotId": "",
200 "unit": "each",
201 "countedQuantity": "0.1"
202 },
203 {
204 "rowId": "c13",
205 "sessionId": "session-001",
206 "passId": "recount",
207 "sku": "count-only",
208 "locationId": "warehouse-A",
209 "lotId": "",
210 "unit": "each",
211 "countedQuantity": "0.2"
212 },
213 {
214 "rowId": "other-session",
215 "sessionId": "another-session",
216 "passId": "first",
217 "sku": "0001",
218 "locationId": "warehouse-A",
219 "lotId": "",
220 "unit": "each",
221 "countedQuantity": "99"
222 },
223 {
224 "rowId": "other-pass",
225 "sessionId": "session-001",
226 "passId": "ignored",
227 "sku": "0001",
228 "locationId": "warehouse-A",
229 "lotId": "",
230 "unit": "each",
231 "countedQuantity": "88"
232 }
233 ],
234 "baselineCsv": "",
235 "countsCsv": "",
236 "baselineColumns": {
237 "rowId": "rowId",
238 "sessionId": "sessionId",
239 "sku": "sku",
240 "locationId": "locationId",
241 "lotId": "lotId",
242 "unit": "unit",
243 "quantity": "quantity"
244 },
245 "countColumns": {
246 "rowId": "rowId",
247 "sessionId": "sessionId",
248 "passId": "passId",
249 "sku": "sku",
250 "locationId": "locationId",
251 "lotId": "lotId",
252 "unit": "unit",
253 "countedQuantity": "countedQuantity"
254 }
255};
256
257
258const run = await client.actor("h_murdock/count-pass-consistency-evidence").call(input);
259
260
261console.log('Results from dataset');
262console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
263const { items } = await client.dataset(run.defaultDatasetId).listItems();
264items.forEach((item) => {
265 console.dir(item);
266});
267
268