1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "data": [
12 {
13 "treatment": "A",
14 "stone_size": "small",
15 "success": 1,
16 "n": 81
17 },
18 {
19 "treatment": "A",
20 "stone_size": "small",
21 "success": 0,
22 "n": 6
23 },
24 {
25 "treatment": "A",
26 "stone_size": "large",
27 "success": 1,
28 "n": 192
29 },
30 {
31 "treatment": "A",
32 "stone_size": "large",
33 "success": 0,
34 "n": 71
35 },
36 {
37 "treatment": "B",
38 "stone_size": "small",
39 "success": 1,
40 "n": 234
41 },
42 {
43 "treatment": "B",
44 "stone_size": "small",
45 "success": 0,
46 "n": 36
47 },
48 {
49 "treatment": "B",
50 "stone_size": "large",
51 "success": 1,
52 "n": 55
53 },
54 {
55 "treatment": "B",
56 "stone_size": "large",
57 "success": 0,
58 "n": 25
59 }
60 ],
61 "countColumn": "n",
62 "treatment": "treatment",
63 "outcome": "success",
64 "covariates": [
65 "stone_size"
66 ],
67 "claim": "Treatment B causes a higher recovery rate than treatment A.",
68 "dag": {
69 "edges": [
70 {
71 "from": "stone_size",
72 "to": "treatment"
73 },
74 {
75 "from": "stone_size",
76 "to": "success"
77 },
78 {
79 "from": "treatment",
80 "to": "success"
81 }
82 ]
83 },
84 "treatedValue": "B",
85 "claimDirection": "positive"
86};
87
88
89const run = await client.actor("davidcondrey/wl-causal-referee").call(input);
90
91
92console.log('Results from dataset');
93console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
94const { items } = await client.dataset(run.defaultDatasetId).listItems();
95items.forEach((item) => {
96 console.dir(item);
97});
98
99