배희수

Merge branch 'algorithm' into 'developing'

merge 'algorithm' to 'developing'



See merge request !3
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
23 "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.6.1.tgz", 23 "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.6.1.tgz",
24 "integrity": "sha512-ZoJjft5B+EJBjUyu9C9Hc0OZyPZSSlOF+plzouTrg6UlA8f+e/n8NIgBFG/9tppJtpPWfthHakK7juJdNDODww==", 24 "integrity": "sha512-ZoJjft5B+EJBjUyu9C9Hc0OZyPZSSlOF+plzouTrg6UlA8f+e/n8NIgBFG/9tppJtpPWfthHakK7juJdNDODww==",
25 "requires": { 25 "requires": {
26 - "fast-deep-equal": "2.0.1", 26 + "fast-deep-equal": "^2.0.1",
27 - "fast-json-stable-stringify": "2.0.0", 27 + "fast-json-stable-stringify": "^2.0.0",
28 - "json-schema-traverse": "0.4.1", 28 + "json-schema-traverse": "^0.4.1",
29 - "uri-js": "4.2.2" 29 + "uri-js": "^4.2.2"
30 } 30 }
31 }, 31 },
32 "array-flatten": { 32 "array-flatten": {
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
44 "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", 44 "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
45 "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", 45 "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
46 "requires": { 46 "requires": {
47 - "safer-buffer": "2.1.2" 47 + "safer-buffer": "~2.1.0"
48 } 48 }
49 }, 49 },
50 "assert-plus": { 50 "assert-plus": {
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
100 "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", 100 "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
101 "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", 101 "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
102 "requires": { 102 "requires": {
103 - "tweetnacl": "0.14.5" 103 + "tweetnacl": "^0.14.3"
104 } 104 }
105 }, 105 },
106 "better-assert": { 106 "better-assert": {
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
163 "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", 163 "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz",
164 "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", 164 "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==",
165 "requires": { 165 "requires": {
166 - "delayed-stream": "1.0.0" 166 + "delayed-stream": "~1.0.0"
167 } 167 }
168 }, 168 },
169 "component-bind": { 169 "component-bind": {
...@@ -247,7 +247,7 @@ ...@@ -247,7 +247,7 @@
247 "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", 247 "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
248 "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", 248 "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
249 "requires": { 249 "requires": {
250 - "assert-plus": "1.0.0" 250 + "assert-plus": "^1.0.0"
251 } 251 }
252 }, 252 },
253 "dasherize": { 253 "dasherize": {
...@@ -255,6 +255,11 @@ ...@@ -255,6 +255,11 @@
255 "resolved": "https://registry.npmjs.org/dasherize/-/dasherize-2.0.0.tgz", 255 "resolved": "https://registry.npmjs.org/dasherize/-/dasherize-2.0.0.tgz",
256 "integrity": "sha1-bYCcnNDPe7iVLYD8hPoT1H3bEwg=" 256 "integrity": "sha1-bYCcnNDPe7iVLYD8hPoT1H3bEwg="
257 }, 257 },
258 + "date-utils": {
259 + "version": "1.2.21",
260 + "resolved": "https://registry.npmjs.org/date-utils/-/date-utils-1.2.21.tgz",
261 + "integrity": "sha1-YfsWzcEnSzyayq/+n8ad+HIKK2Q="
262 + },
258 "debug": { 263 "debug": {
259 "version": "2.6.9", 264 "version": "2.6.9",
260 "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 265 "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
...@@ -293,8 +298,8 @@ ...@@ -293,8 +298,8 @@
293 "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", 298 "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
294 "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", 299 "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
295 "requires": { 300 "requires": {
296 - "jsbn": "0.1.1", 301 + "jsbn": "~0.1.0",
297 - "safer-buffer": "2.1.2" 302 + "safer-buffer": "^2.1.0"
298 } 303 }
299 }, 304 },
300 "ee-first": { 305 "ee-first": {
...@@ -490,9 +495,9 @@ ...@@ -490,9 +495,9 @@
490 "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", 495 "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
491 "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", 496 "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
492 "requires": { 497 "requires": {
493 - "asynckit": "0.4.0", 498 + "asynckit": "^0.4.0",
494 - "combined-stream": "1.0.7", 499 + "combined-stream": "^1.0.6",
495 - "mime-types": "2.1.21" 500 + "mime-types": "^2.1.12"
496 } 501 }
497 }, 502 },
498 "forwarded": { 503 "forwarded": {
...@@ -515,7 +520,7 @@ ...@@ -515,7 +520,7 @@
515 "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", 520 "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
516 "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", 521 "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
517 "requires": { 522 "requires": {
518 - "assert-plus": "1.0.0" 523 + "assert-plus": "^1.0.0"
519 } 524 }
520 }, 525 },
521 "har-schema": { 526 "har-schema": {
...@@ -528,8 +533,8 @@ ...@@ -528,8 +533,8 @@
528 "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", 533 "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz",
529 "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", 534 "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==",
530 "requires": { 535 "requires": {
531 - "ajv": "6.6.1", 536 + "ajv": "^6.5.5",
532 - "har-schema": "2.0.0" 537 + "har-schema": "^2.0.0"
533 } 538 }
534 }, 539 },
535 "has-binary2": { 540 "has-binary2": {
...@@ -613,9 +618,9 @@ ...@@ -613,9 +618,9 @@
613 "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", 618 "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
614 "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", 619 "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
615 "requires": { 620 "requires": {
616 - "assert-plus": "1.0.0", 621 + "assert-plus": "^1.0.0",
617 - "jsprim": "1.4.1", 622 + "jsprim": "^1.2.2",
618 - "sshpk": "1.15.2" 623 + "sshpk": "^1.7.0"
619 } 624 }
620 }, 625 },
621 "iconv-lite": { 626 "iconv-lite": {
...@@ -898,26 +903,26 @@ ...@@ -898,26 +903,26 @@
898 "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", 903 "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
899 "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", 904 "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
900 "requires": { 905 "requires": {
901 - "aws-sign2": "0.7.0", 906 + "aws-sign2": "~0.7.0",
902 - "aws4": "1.8.0", 907 + "aws4": "^1.8.0",
903 - "caseless": "0.12.0", 908 + "caseless": "~0.12.0",
904 - "combined-stream": "1.0.7", 909 + "combined-stream": "~1.0.6",
905 - "extend": "3.0.2", 910 + "extend": "~3.0.2",
906 - "forever-agent": "0.6.1", 911 + "forever-agent": "~0.6.1",
907 - "form-data": "2.3.3", 912 + "form-data": "~2.3.2",
908 - "har-validator": "5.1.3", 913 + "har-validator": "~5.1.0",
909 - "http-signature": "1.2.0", 914 + "http-signature": "~1.2.0",
910 - "is-typedarray": "1.0.0", 915 + "is-typedarray": "~1.0.0",
911 - "isstream": "0.1.2", 916 + "isstream": "~0.1.2",
912 - "json-stringify-safe": "5.0.1", 917 + "json-stringify-safe": "~5.0.1",
913 - "mime-types": "2.1.21", 918 + "mime-types": "~2.1.19",
914 - "oauth-sign": "0.9.0", 919 + "oauth-sign": "~0.9.0",
915 - "performance-now": "2.1.0", 920 + "performance-now": "^2.1.0",
916 - "qs": "6.5.2", 921 + "qs": "~6.5.2",
917 - "safe-buffer": "5.1.2", 922 + "safe-buffer": "^5.1.2",
918 - "tough-cookie": "2.4.3", 923 + "tough-cookie": "~2.4.3",
919 - "tunnel-agent": "0.6.0", 924 + "tunnel-agent": "^0.6.0",
920 - "uuid": "3.3.2" 925 + "uuid": "^3.3.2"
921 } 926 }
922 }, 927 },
923 "safe-buffer": { 928 "safe-buffer": {
...@@ -1057,27 +1062,27 @@ ...@@ -1057,27 +1062,27 @@
1057 } 1062 }
1058 } 1063 }
1059 }, 1064 },
1065 + "sqlstring": {
1066 + "version": "2.3.1",
1067 + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
1068 + "integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A="
1069 + },
1060 "sshpk": { 1070 "sshpk": {
1061 "version": "1.15.2", 1071 "version": "1.15.2",
1062 "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.2.tgz", 1072 "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.2.tgz",
1063 "integrity": "sha512-Ra/OXQtuh0/enyl4ETZAfTaeksa6BXks5ZcjpSUNrjBr0DvrJKX+1fsKDPpT9TBXgHAFsa4510aNVgI8g/+SzA==", 1073 "integrity": "sha512-Ra/OXQtuh0/enyl4ETZAfTaeksa6BXks5ZcjpSUNrjBr0DvrJKX+1fsKDPpT9TBXgHAFsa4510aNVgI8g/+SzA==",
1064 "requires": { 1074 "requires": {
1065 - "asn1": "0.2.4", 1075 + "asn1": "~0.2.3",
1066 - "assert-plus": "1.0.0", 1076 + "assert-plus": "^1.0.0",
1067 - "bcrypt-pbkdf": "1.0.2", 1077 + "bcrypt-pbkdf": "^1.0.0",
1068 - "dashdash": "1.14.1", 1078 + "dashdash": "^1.12.0",
1069 - "ecc-jsbn": "0.1.2", 1079 + "ecc-jsbn": "~0.1.1",
1070 - "getpass": "0.1.7", 1080 + "getpass": "^0.1.1",
1071 - "jsbn": "0.1.1", 1081 + "jsbn": "~0.1.0",
1072 - "safer-buffer": "2.1.2", 1082 + "safer-buffer": "^2.0.2",
1073 - "tweetnacl": "0.14.5" 1083 + "tweetnacl": "~0.14.0"
1074 } 1084 }
1075 }, 1085 },
1076 - "sqlstring": {
1077 - "version": "2.3.1",
1078 - "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
1079 - "integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A="
1080 - },
1081 "statuses": { 1086 "statuses": {
1082 "version": "1.5.0", 1087 "version": "1.5.0",
1083 "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 1088 "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
...@@ -1101,8 +1106,8 @@ ...@@ -1101,8 +1106,8 @@
1101 "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", 1106 "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
1102 "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", 1107 "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==",
1103 "requires": { 1108 "requires": {
1104 - "psl": "1.1.29", 1109 + "psl": "^1.1.24",
1105 - "punycode": "1.4.1" 1110 + "punycode": "^1.4.1"
1106 }, 1111 },
1107 "dependencies": { 1112 "dependencies": {
1108 "punycode": { 1113 "punycode": {
...@@ -1117,7 +1122,7 @@ ...@@ -1117,7 +1122,7 @@
1117 "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", 1122 "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
1118 "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", 1123 "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
1119 "requires": { 1124 "requires": {
1120 - "safe-buffer": "5.1.2" 1125 + "safe-buffer": "^5.0.1"
1121 } 1126 }
1122 }, 1127 },
1123 "tweetnacl": { 1128 "tweetnacl": {
...@@ -1144,7 +1149,7 @@ ...@@ -1144,7 +1149,7 @@
1144 "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", 1149 "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
1145 "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", 1150 "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
1146 "requires": { 1151 "requires": {
1147 - "punycode": "2.1.1" 1152 + "punycode": "^2.1.0"
1148 } 1153 }
1149 }, 1154 },
1150 "util-deprecate": { 1155 "util-deprecate": {
...@@ -1172,9 +1177,9 @@ ...@@ -1172,9 +1177,9 @@
1172 "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", 1177 "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
1173 "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", 1178 "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
1174 "requires": { 1179 "requires": {
1175 - "assert-plus": "1.0.0", 1180 + "assert-plus": "^1.0.0",
1176 "core-util-is": "1.0.2", 1181 "core-util-is": "1.0.2",
1177 - "extsprintf": "1.3.0" 1182 + "extsprintf": "^1.2.0"
1178 } 1183 }
1179 }, 1184 },
1180 "ws": { 1185 "ws": {
......
...@@ -9,14 +9,15 @@ ...@@ -9,14 +9,15 @@
9 "body-parser": "^1.18.3", 9 "body-parser": "^1.18.3",
10 "compression": "^1.7.3", 10 "compression": "^1.7.3",
11 "cookie-parser": "~1.4.3", 11 "cookie-parser": "~1.4.3",
12 + "date-utils": "^1.2.21",
12 "debug": "~2.6.9", 13 "debug": "~2.6.9",
13 "ejs": "~2.5.7", 14 "ejs": "~2.5.7",
14 "express": "~4.16.0", 15 "express": "~4.16.0",
15 "helmet": "^3.13.0", 16 "helmet": "^3.13.0",
16 "http-errors": "~1.6.2", 17 "http-errors": "~1.6.2",
17 "morgan": "~1.9.0", 18 "morgan": "~1.9.0",
18 - "request": "^2.88.0",
19 "mysql": "^2.16.0", 19 "mysql": "^2.16.0",
20 + "request": "^2.88.0",
20 "socket.io": "^2.1.1" 21 "socket.io": "^2.1.1"
21 } 22 }
22 } 23 }
......
1 var express = require('express'); 1 var express = require('express');
2 var router = express.Router(); 2 var router = express.Router();
3 -var db = require('../lib/db') 3 +var db = require('../lib/db');
4 4
5 /* GET home page. */ 5 /* GET home page. */
6 router.get('/', function(req, res, next) { 6 router.get('/', function(req, res, next) {
7 - // 자외선지수, 불쾌지수, 열지수, 체감 온도, 바람속도, 현재기온, 하늘 상태, 강우량, 태풍, 낙뢰 7 + // 자외선지수, 불쾌지수, 열지수, 체감 온도, 바람속도, 현재기온, 하늘 상태, 강우량, 태풍, 낙뢰, 특보, 현재 시간
8 - var uvr, discomfort, heat, sensibleTem, windSpeed, presentTem, skyState, rainfall, typhoon, lightning; 8 + var uvr, discomfort, heat, sensibleTem, windSpeed, presentTem, skyState, rainfall, typhoon, lightning, alert, time;
9 - // 사망 확률
10 - var deathProb;
11 9
12 // 쿼리문 10 // 쿼리문
13 - var sql = 'SELECT * FROM kkonzi_test.weatherInfo'; 11 + var sql = 'SELECT * FROM kkonzi_test.weatherInfo WHERE kkonzi_test.time > DATE_FORMAT(DATE_ADD(now(), INTERVAL -1 MINUTE), "%Y-%m-%d %H:%i:%s")'';
14 db.query(sql, function(err, rows, fields){ 12 db.query(sql, function(err, rows, fields){
15 if (err) { 13 if (err) {
16 console.log(err); 14 console.log(err);
17 } else { 15 } else {
16 + if (rows.length == 0){
17 +
18 + }
19 + else {
20 +
21 + }
18 var tmp = rows.length - 1; 22 var tmp = rows.length - 1;
19 - uvr = rows[temp].uvr; 23 + time = rows[temp].time;
24 + uvr = rows[temp].UV;
20 discomfort = rows[temp].discomfort; 25 discomfort = rows[temp].discomfort;
21 heat = rows[temp].heat; 26 heat = rows[temp].heat;
22 - sensibleTem = rows[temp].sensibleTem; 27 + sensibleTem = rows[temp].SensibleT;
23 - windSpeed = rows[temp].windSpeed; 28 + windSpeed = rows[temp].wspd;
24 - presentTem = rows[temp].presentTem; 29 + presentTem = rows[temp].CurrentT;
25 - skyState = rows[temp].skyState; 30 + skyState = rows[temp].sky;
26 - rainfall = rows[temp].rainfall; 31 + rainfall = rows[temp].rain;
27 typhoon = rows[temp].typhoon; 32 typhoon = rows[temp].typhoon;
28 lightning = rows[temp].lightning; 33 lightning = rows[temp].lightning;
29 - } 34 + alert = rows[temp].alert;
30 - })
31 -
32 - deathProb = uvr + discomfort + heat + sensibleTem + windSpeed + presentTem + skyState + rainfall + typhoon + lightning;
33 -
34 - sql = 'INSERT INTO kkonzi_test.deathProb (prob) VALUES (?)';
35 - var params = deathProb;
36 -
37 - db.query(sql, function(err, rows, fields){
38 - if (err) {
39 - console.log(err);
40 - } else {
41 - console.log('Success!');
42 - }
43 } 35 }
44 }) 36 })
45 37
......