-
Notifications
You must be signed in to change notification settings - Fork 0
/
Deployment Code For Node Red Flow.txt
1 lines (1 loc) · 8.1 KB
/
Deployment Code For Node Red Flow.txt
1
[{"id":"83a20e3c.99281","type":"http request","z":"3e34d2a6.b8daae","name":"","method":"POST","ret":"obj","paytoqs":false,"url":"https://eu-gb.ml.cloud.ibm.com/v3/wml_instances/6e8faab2-af48-49b4-ab5e-e35bab5ccd09/deployments/95183cf2-36c5-4949-bda4-4ebe8df158c8/online","tls":"","proxy":"","authType":"","x":553.4000091552734,"y":39.79995536804199,"wires":[["dd3ec22d.7ab8d"]]},{"id":"9e4c978a.d96558","type":"function","z":"3e34d2a6.b8daae","name":"prediction","func":"var token=msg.payload.token;\nvar Age=global.get(\"Age\");\nvar Gender=global.get(\"Gender\");\nvar Total_Bilirubin=global.get(\"Total_Bilirubin\");\nvar Direct_Bilirubin=global.get(\"Direct_Bilirubin\");\nvar Alkaline_Phosphotase=global.get(\"Alkaline_Phosphotase\");\nvar Alamine_Aminotransferase=global.get(\"Alamine_Aminotransferase\");\nvar Aspartate_Aminotransferase=global.get(\"Aspartate_Aminotransferase\");\nvar Total_Protiens=global.get(\"Total_Protiens\");\nvar Albumin=global.get(\"Albumin\");\nvar Albumin_and_Globulin_Ratio=global.get(\"Albumin_and_Globulin_Ratio\");\nvar Dataset=global.get(\"Dataset\");\nmsg.payload={\"fields\":[\"Age\",\"Gender\",\"Total_Bilirubin\",\"Direct_Bilirubin\",\"Alkaline_Phosphotase\",\"Alamine_Aminotransferase\",\"Aspartate_Aminotransferase\",\"Total_Protiens\",\"Albumin\",\"Albumin_and_Globulin_Ratio\",\"Dataset\"],\n\"values\":[[Age,EstimatedSalary,Gender,Total_Bilirubin,Direct_Bilirubin,Alkaline_Phosphotase,Alamine_Aminotransferase,Aspartate_Aminotransferase,Total_Protiens,Albumin,Albumin_and_Globulin_Ratio,Dataset]]};\nmsg.headers={\"Authorization\":\"Bearer \"+token}\nreturn msg;","outputs":1,"noerr":0,"x":315,"y":39.00000190734863,"wires":[["83a20e3c.99281"]]},{"id":"f40e61d3.cddf","type":"debug","z":"3e34d2a6.b8daae","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1033.0000114440918,"y":40.00000190734863,"wires":[]},{"id":"492d7047.96389","type":"http request","z":"3e34d2a6.b8daae","name":"","method":"GET","ret":"obj","paytoqs":false,"url":"https://eu-gb.ml.cloud.ibm.com/v3/identity/token","tls":"","proxy":"","authType":"","x":558.0000076293945,"y":254.00000476837158,"wires":[["fb3025b5.bae488","9e4c978a.d96558"]]},{"id":"3740a115.909b5e","type":"inject","z":"3e34d2a6.b8daae","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":103,"y":178.00000190734863,"wires":[["fcd5fd05.7350d"]]},{"id":"fcd5fd05.7350d","type":"function","z":"3e34d2a6.b8daae","name":"token generation","func":"var Base64={_keyStr:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",encode:function(e){var t=\"\";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t=\"\";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/++[++^A-Za-z0-9+/=]/g,\"\");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\\r\\n/g,\"n\");var t=\"\";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r)}else if(r>127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t=\"\";var n=0;var r=c1=c2=0;while(n<e.length){r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r);n++}else if(r>191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}};\nvar username=\"8ea30595-5f4a-4cbf-8f23-db459dc64d4c\"\nvar password=\"04b5a9e0-8e53-4a71-bd4b-eed4ae23a9f6\";\nvar encodedString = Base64.encode(username+':'+password);\nmsg.headers = {\"Authorization\":\"Basic \"+ encodedString};\nglobal.set(\"Age\",msg.payload.Age)\nglobal.set(\"Total_Bilirubin\",msg.payload.Total_Bilirubin)\nglobal.set(\"Direct_Bilirubin\",msg.payload.Direct_Bilirubin)\nglobal.set(\"Alkaline_Phosphotase\",msg.payload.Alkaline_Phosphotase)\nglobal.set(\"Alamine_Aminotransferase\",msg.payload.Alamine_Aminotransferase)\nglobal.set(\"Aspartate_Aminotransferase\",msg.payload.Aspartate_Aminotransferase)\nglobal.set(\"Total_Protiens\",msg.payload.Total_Protiens)\nglobal.set(\"Albumin\",msg.payload.Albumin)\nglobal.set(\"Albumin_and_Globulin_Ratio\",msg.payload.Albumin_and_Globulin_Ratio)\nreturn msg;","outputs":1,"noerr":0,"x":327,"y":255.00000381469727,"wires":[["492d7047.96389"]]},{"id":"dd3ec22d.7ab8d","type":"function","z":"3e34d2a6.b8daae","name":"o/p parsing","func":"msg.payload=msg.payload.values[0][0]\nreturn msg;","outputs":1,"noerr":0,"x":792.0000076293945,"y":41.000003814697266,"wires":[["f40e61d3.cddf","bcf7ccdd.72bd"]]},{"id":"fb3025b5.bae488","type":"debug","z":"3e34d2a6.b8daae","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":818.0000152587891,"y":254.00000381469727,"wires":[]},{"id":"cc0929d4.43b1b8","type":"ui_form","z":"3e34d2a6.b8daae","name":"","label":"","group":"4579491a.ba4cc8","order":0,"width":0,"height":0,"options":[{"label":"Age","value":"Age","type":"number","required":true},{"label":"Total_Bilirubin\t","value":"Total_Bilirubin\t","type":"number","required":true},{"label":"Direct_Bilirubin","value":"Direct_Bilirubin","type":"number","required":true},{"label":"Alkaline_Phosphotase","value":"Alkaline_Phosphotase","type":"number","required":true},{"label":"Alamine_Aminotransferase","value":"Alamine_Aminotransferase","type":"number","required":true},{"label":"Aspartate_Aminotransferase","value":"Aspartate_Aminotransferase","type":"number","required":true},{"label":"Total_Protiens","value":"Total_Protiens","type":"number","required":true},{"label":"Albumin","value":"Albumin","type":"number","required":true},{"label":"Albumin_and_Globulin_Ratio","value":"Albumin_and_Globulin_Ratio","type":"number","required":true}],"formValue":{"Age":"","Total_Bilirubin\t":"","Direct_Bilirubin":"","Alkaline_Phosphotase":"","Alamine_Aminotransferase":"","Aspartate_Aminotransferase":"","Total_Protiens":"","Albumin":"","Albumin_and_Globulin_Ratio":""},"payload":"","submit":"submit","cancel":"cancel","topic":"","x":107.00000381469727,"y":323.0000057220459,"wires":[["fcd5fd05.7350d"]]},{"id":"bcf7ccdd.72bd","type":"ui_text","z":"3e34d2a6.b8daae","group":"4579491a.ba4cc8","order":0,"width":0,"height":0,"name":"","label":"Prediction","format":"{{msg.payload}}","layout":"row-spread","x":1031.0000114440918,"y":113.00000381469727,"wires":[]},{"id":"12b298d3.d1dc87","type":"ui_dropdown","z":"3e34d2a6.b8daae","name":"","label":"","tooltip":"","place":"Select Gender","group":"4579491a.ba4cc8","order":3,"width":0,"height":0,"passthru":true,"options":[{"label":"Male","value":"Male","type":"str"},{"label":"Female","value":"Female","type":"str"},{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":358,"y":433.0000066757202,"wires":[["5f597fd6.f3d35"]]},{"id":"5f597fd6.f3d35","type":"function","z":"3e34d2a6.b8daae","name":"","func":"if(msg.payload==\"Male\"){\n global.set(\"Gender\",1);\n}\nelse if(msg.payload==\"Female\"){\n global.set(\"Gender\",0);\n}\nreturn msg;","outputs":1,"noerr":0,"x":581,"y":431.8000068664551,"wires":[["7d816629.683ee8"]]},{"id":"7d816629.683ee8","type":"debug","z":"3e34d2a6.b8daae","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":825.6000518798828,"y":431.00000762939453,"wires":[]},{"id":"4579491a.ba4cc8","type":"ui_group","z":"","name":"Prediction","tab":"d8d56cd4.63ec7","disp":true,"width":"6","collapse":false},{"id":"d8d56cd4.63ec7","type":"ui_tab","z":"","name":"ml model","icon":"dashboard","disabled":false,"hidden":false}]