1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = { "requests": [
9 "signal timing: phase 1: NB 450 vph 2 lanes, SB 380 vph 2 lanes; phase 2: EB 300 vph, WB 260 vph; phase 3: NBL 180 vph, SBL 150 vph; 45 mph, 70 ft intersection, 60 ft crosswalk",
10 "yellow and all-red for 45 mph, 3% downgrade, 80 ft intersection",
11 "critical flow ratios 0.25, 0.20, 0.15; lost time 12 s total",
12 "check: cycle 90 s, greens 40 30; NS 600 vph 2 lanes; EW 400 vph 1 lane, PHF 0.92",
13 "intersection: phase A: main street 900 vph 2 lanes; phase B: side street 350 vph, 50 km/h, 20 m wide, crosswalk 14 m",
14 {
15 "type": "timing",
16 "phases": [
17 {
18 "name": "North-south",
19 "movements": [
20 {
21 "name": "NB",
22 "volume": 620,
23 "lanes": 2,
24 },
25 {
26 "name": "SB",
27 "volume": 540,
28 "lanes": 2,
29 },
30 ],
31 },
32 {
33 "name": "East-west",
34 "movements": [
35 {
36 "name": "EB",
37 "volume": 410,
38 "lanes": 1,
39 },
40 {
41 "name": "WB",
42 "volume": 380,
43 "lanes": 1,
44 },
45 ],
46 },
47 ],
48 "saturationFlow": 1850,
49 "speed": "40 mph",
50 "width": "60 ft",
51 "maxCycle": 120,
52 },
53 ] }
54
55
56run = client.actor("jumblemog/traffic-signal-calculator").call(run_input=run_input)
57
58
59print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
60for item in client.dataset(run.default_dataset_id).iterate_items():
61 print(item)
62
63