-
Notifications
You must be signed in to change notification settings - Fork 200
/
sensorAnomaly.flow
1 lines (1 loc) · 1.96 KB
/
sensorAnomaly.flow
1
[{"id":"27db8fba.af0ff8","type":"http request","z":"8e6905ee.ed8c6","name":"Login","method":"POST","ret":"txt","url":"https://awh-yp-small02.services.dal.bluemix.net:8443/console/blushiftservices/BluShiftHttp.do","x":547,"y":301,"wires":[["d8c8db7a.e04a9"]]},{"id":"4c0f2113.b7f268","type":"function","z":"8e6905ee.ed8c6","name":"R Script Payload","func":"schema = \"DASH110683\"\ntable = \"IDUGIOTDEMO\"\nseq = msg.payload.queryTS\n\nmsg.payload = \"cmd=RScriptRunScript&command=library(ibmdbR);mycon =idaConnect(\\\"BLUDB\\\", \\\"\\\", \\\"\\\");idaInit(mycon);df=as.data.frame(ida.data.frame('\\\"DASH110683\\\".\\\"TEMPERATURE\\\"')[,c('NAME', 'TEMPERATURE', 'TIMESTAMP')]);values=as.numeric(df$TEMPERATURE);globalMean=mean(values);globalSD=sd(values);paste('XXX',globalMean,'XXX',globalSD,'XXX',mean(c(\"+seq+\")),'XXX',sd(c(\"+seq+\")),'XXX');&fileName=&profileName=BLUDB&userid=\"+schema;\nmsg.headers = {\"content-type\": \"application/x-www-form-urlencoded\"}; \nreturn msg;","outputs":1,"noerr":0,"x":359,"y":302,"wires":[["27db8fba.af0ff8"]]},{"id":"50b95751.aecac8","type":"inject","z":"8e6905ee.ed8c6","name":"","topic":"","payload":"{'queryTS': '1,2,3,4,5,6,7'}","payloadType":"json","repeat":"","crontab":"","once":false,"x":136.5,"y":298.5,"wires":[["4c0f2113.b7f268"]]},{"id":"f67cea67.965778","type":"debug","z":"8e6905ee.ed8c6","name":"","active":true,"console":"false","complete":"false","x":810.5,"y":339,"wires":[]},{"id":"d8c8db7a.e04a9","type":"function","z":"8e6905ee.ed8c6","name":"","func":"ra = msg.payload.split('XXX')\nmsg.payload={'gm':ra[1],'gsd':ra[2],'qm':ra[3],'qsd':ra[4]}\nreturn msg;","outputs":1,"noerr":0,"x":601.5,"y":400.5,"wires":[["f67cea67.965778","2f0b929e.b264be"]]},{"id":"2f0b929e.b264be","type":"http response","z":"8e6905ee.ed8c6","name":"","x":743.5,"y":480,"wires":[]},{"id":"e17aaf8d.316368","type":"http in","z":"8e6905ee.ed8c6","name":"","url":"/adService","method":"get","swaggerDoc":"","x":154.5,"y":456.5,"wires":[["4c0f2113.b7f268"]]}]