-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode-red-flow.json
1 lines (1 loc) · 5.85 KB
/
node-red-flow.json
1
[{"id":"fc3e1573.1da558","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"24889cde.3077c4","type":"ui_form","z":"fc3e1573.1da558","name":"","label":"","group":"53329c69.6f02d4","order":0,"width":0,"height":0,"options":[{"label":"Status","value":"a","type":"number","required":true,"rows":null},{"label":"Adult Mortality","value":"b","type":"number","required":true,"rows":null},{"label":"infant deaths","value":"c","type":"number","required":true,"rows":null},{"label":"Alcohol","value":"d","type":"number","required":true,"rows":null},{"label":"percentage expenditure","value":"e","type":"number","required":true,"rows":null},{"label":"Hepatitis B","value":"f","type":"number","required":true,"rows":null},{"label":"Measles","value":"g","type":"number","required":true,"rows":null},{"label":"BMI","value":"h","type":"number","required":true,"rows":null},{"label":"under-five deaths","value":"i","type":"number","required":true,"rows":null},{"label":"Polio","value":"j","type":"number","required":true,"rows":null},{"label":"Total expenditure","value":"k","type":"number","required":true,"rows":null},{"label":"Diphtheria","value":"l","type":"number","required":true,"rows":null},{"label":"HIV/AIDS","value":"m","type":"number","required":true,"rows":null},{"label":"GDP","value":"n","type":"number","required":true,"rows":null},{"label":"Population","value":"o","type":"number","required":true,"rows":null},{"label":"thinness 1-19 years","value":"p","type":"number","required":true,"rows":null},{"label":"thinness 5-9 years","value":"q","type":"number","required":true,"rows":null},{"label":"Income composition of resources","value":"r","type":"number","required":true,"rows":null},{"label":"Schooling","value":"s","type":"number","required":true,"rows":null}],"formValue":{"a":"","b":"","c":"","d":"","e":"","f":"","g":"","h":"","i":"","j":"","k":"","l":"","m":"","n":"","o":"","p":"","q":"","r":"","s":""},"payload":"","submit":"submit","cancel":"cancel","topic":"","x":90,"y":339,"wires":[["fe01ebdc.e1654"]],"l":false},{"id":"fe01ebdc.e1654","type":"function","z":"fc3e1573.1da558","name":"pre-token","func":"global.set(\"a\",msg.payload.a);\nglobal.set(\"b\",msg.payload.b);\nglobal.set(\"c\",msg.payload.c);\nglobal.set(\"d\",msg.payload.d);\nglobal.set(\"e\",msg.payload.e);\nglobal.set(\"f\",msg.payload.f);\nglobal.set(\"g\",msg.payload.g);\nglobal.set(\"h\",msg.payload.h);\nglobal.set(\"i\",msg.payload.i);\nglobal.set(\"j\",msg.payload.j);\nglobal.set(\"k\",msg.payload.k);\nglobal.set(\"l\",msg.payload.l);\nglobal.set(\"m\",msg.payload.m);\nglobal.set(\"n\",msg.payload.n);\nglobal.set(\"o\",msg.payload.o);\nglobal.set(\"p\",msg.payload.p);\nglobal.set(\"q\",msg.payload.q);\nglobal.set(\"r\",msg.payload.r);\nglobal.set(\"s\",msg.payload.s);\n\nvar apikey=\"NG82plxgI8G5obwSF-t7X4Npo2ReoOoha2iS2aS-pDNX\";\nmsg.headers={\"content-type\":\"application/x-www-form-urlencoded\"};\nmsg.payload={\"grant_type\":\"urn:ibm:params:oauth:grant-type:apikey\",\"apikey\":apikey};\nreturn msg;","outputs":1,"noerr":0,"x":161,"y":226,"wires":[["48dda523.af7a44"]],"l":false},{"id":"48dda523.af7a44","type":"http request","z":"fc3e1573.1da558","name":"","method":"POST","ret":"obj","paytoqs":false,"url":"https://iam.cloud.ibm.com/identity/token","tls":"","persist":false,"proxy":"","authType":"basic","x":236,"y":133,"wires":[["5c88f121.bfca78"]],"l":false},{"id":"5c88f121.bfca78","type":"function","z":"fc3e1573.1da558","name":"","func":"var token=msg.payload.access_token;\nvar instance_id=\"466a9b47-1657-4009-a824-fcce122b8f28\"\nmsg.headers={'Content-Type': 'application/json',\"Authorization\":\"Bearer \"+token,\"ML-Instance-ID\":instance_id}\n\n//get variables that are set earlier\nvar a = global.get(\"a\");\nvar b = global.get(\"b\");\nvar c = global.get(\"c\");\nvar d = global.get(\"d\");\nvar e = global.get(\"e\");\nvar f = global.get(\"f\");\nvar g = global.get(\"g\");\nvar h = global.get(\"h\");\nvar i = global.get(\"i\");\nvar j = global.get(\"j\");\nvar k = global.get(\"k\");\nvar l = global.get(\"l\");\nvar m = global.get(\"m\");\nvar n = global.get(\"n\");\nvar o = global.get(\"o\");\nvar p = global.get(\"p\");\nvar q = global.get(\"q\");\nvar r = global.get(\"r\");\nvar s = global.get(\"s\");\n\n\n//send the user values to service endpoint\nmsg.payload = \n{\"fields\":[\"Status\", \"Adult Mortality\", \"infant deaths\", \"Alcohol\", \"percentage expenditure\", \"Hepatitis B\", \"Measles\", \"BMI\", \"under-five deaths\", \"Polio\", \"Total expenditure\", \"Diphtheria\", \"HIV/AIDS\", \"GDP\", \"Population\", \"thinness 10-19 years\", \"thinness 5-9 years\", \"Income composition of resources\", \"Schooling\"],\n \"values\":[[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]]};\n \nreturn msg;","outputs":1,"noerr":0,"x":307,"y":277,"wires":[["ca0e7470.5ba0c"]],"l":false},{"id":"3cfb24a1.b04fac","type":"function","z":"fc3e1573.1da558","name":"getFrom Endpoint","func":"msg.payload=msg.payload.values[0][0];\n\n//msg.payload=msg.payload.predictions[0].values[0][0];\nreturn msg;","outputs":1,"noerr":0,"x":512,"y":179,"wires":[["ad19a4d8.bed06"]],"l":false},{"id":"ad19a4d8.bed06","type":"ui_text","z":"fc3e1573.1da558","group":"53329c69.6f02d4","order":1,"width":0,"height":0,"name":"","label":"Prediction","format":"{{msg.payload}}","layout":"row-spread","x":575,"y":260,"wires":[],"l":false},{"id":"ca0e7470.5ba0c","type":"http request","z":"fc3e1573.1da558","name":"","method":"POST","ret":"obj","paytoqs":false,"url":"https://us-south.ml.cloud.ibm.com/v3/wml_instances/466a9b47-1657-4009-a824-fcce122b8f28/deployments/bf6fa95f-0d3b-41ee-9c72-0c16c18650de/online","tls":"","persist":false,"proxy":"","authType":"","x":415,"y":220,"wires":[["3cfb24a1.b04fac"]],"l":false},{"id":"53329c69.6f02d4","type":"ui_group","z":"","name":"Default","tab":"1980f79f.97dd6","order":1,"disp":true,"width":"6","collapse":false},{"id":"1980f79f.97dd6","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]