forked from project-flogo/ml
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cobiBikeStreamApp.json
133 lines (133 loc) · 4.13 KB
/
cobiBikeStreamApp.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
{
"name": "bcwx_demo",
"type": "flogo:app",
"version": "0.0.1",
"description": "",
"appModel": "1.1.0",
"imports": [
"github.com/project-flogo/contrib/activity/log",
"github.com/abramvandergeest/addDimension@master",
"github.com/project-flogo/contrib/function/coerce@master",
"github.com/project-flogo/stream/activity/aggregate@master",
"github.com/skothari-tibco/csvtimer@master",
"github.com/project-flogo/legacybridge",
"github.com/project-flogo/ml/activity/inference@master",
"github.com/project-flogo/contrib/trigger/channel@master",
"github.com/project-flogo/stream@master"
],
"triggers": [
{
"id": "csv_trigger_zero",
"ref": "github.com/skothari-tibco/csvtimer",
"settings": null,
"handlers": [
{
"settings": {
"filePath": "bike_data.csv",
"header": true,
"repeatInterval": "100"
},
"actions": [
{
"id": "gather",
"if": "$.data.path == \"rideService/speed\" || $.data.path == \"rideService/userPower\" || $.data.path == \"tourService/ridingDuration\" || $.data.path == \"tourService/ridingDistance\" || $.data.path == \"tourService/ascent\" || $.data.path == \"tourService/calories\" || $.data.path == \"rideService/heartRate\" || $.data.path == \"rideService/cadence\" || $.data.path == \"tourService/averageSpeed\"",
"input": {
"input": "=$.data"
}
}
]
}
]
}
],
"resources": [
{
"id": "pipeline:gather",
"data": {
"metadata": {
"input": [
{
"name": "input",
"type": "any"
}
],
"output": [
{
"name": "out",
"type": "any"
}
]
},
"stages": [
{
"ref": "#aggregate",
"settings": {
"function": "avg",
"windowType": "timeTumbling",
"windowSize": "1000",
"additionalSettings": "nameKey=path,valueKey=payload"
},
"input": {
"value": "=$.input"
},
"output": {
"result": {
"mapping": [
"=coerce.toFloat32(getValue($.result[\"rideService/speed\"], 0) / 10)",
"=coerce.toFloat32(getValue($.result[\"rideService/userPower\"], 0) / 100)",
"=coerce.toFloat32(getValue($.result[\"tourService/ridingDuration\"], 0) / 500)",
"=coerce.toFloat32(getValue($.result[\"tourService/ridingDistance\"], 0) / 2000)",
"=coerce.toFloat32(getValue($.result[\"tourService/ascent\"], 0) / 15)",
"=coerce.toFloat32(getValue($.result[\"tourService/calories\"], 0) / 50)",
"=coerce.toFloat32(getValue($.result[\"rideService/heartRate\"], 0) / 150)",
"=coerce.toFloat32(getValue($.result[\"rideService/cadence\"], 0) / 90)",
"=coerce.toFloat32(getValue($.result[\"tourService/averageSpeed\"], 0) / 8)"
]
}
}
},
{
"id": "addDim",
"ref": "#addDimension",
"input": {
"data": "=$.result"
}
},
{
"id": "inference_ml",
"ref": "#inference",
"input": {
"model": "Archive_COBI_bike_thresh_0.2.zip",
"framework": "Tensorflow",
"features": {
"mapping": [
{
"name": "inputs",
"data": "=$.output"
}
]
},
"sigDefName": "serving_default",
"tag": "serve"
}
},
{
"ref": "#log",
"input": {
"message": "=$.result"
}
}
]
}
}
],
"actions": [
{
"ref": "#stream",
"settings": {
"pipelineURI": "res://pipeline:gather"
},
"id": "gather"
}
]
}