Updates black cherry demo, fixes parsing bug
diff --git a/asterix-examples/src/main/resources/black-cherry/README.md b/asterix-examples/src/main/resources/black-cherry/README.md
old mode 100644
new mode 100755
diff --git a/asterix-examples/src/main/resources/black-cherry/black_cherry_bootstrap.py b/asterix-examples/src/main/resources/black-cherry/black_cherry_bootstrap.py
old mode 100644
new mode 100755
diff --git a/asterix-examples/src/main/resources/black-cherry/bottle.py b/asterix-examples/src/main/resources/black-cherry/bottle.py
old mode 100644
new mode 100755
diff --git a/asterix-examples/src/main/resources/black-cherry/proxy.py b/asterix-examples/src/main/resources/black-cherry/proxy.py
old mode 100644
new mode 100755
diff --git a/asterix-examples/src/main/resources/black-cherry/run_black_cherry.py b/asterix-examples/src/main/resources/black-cherry/run_black_cherry.py
old mode 100644
new mode 100755
index 8c8df9b..682339e
--- a/asterix-examples/src/main/resources/black-cherry/run_black_cherry.py
+++ b/asterix-examples/src/main/resources/black-cherry/run_black_cherry.py
@@ -2,7 +2,7 @@
import requests
from bottle import route, run, template, get, debug, static_file, request, response
-debug(True)
+debug(False)
http_header = { "content-type": "application/json" }
# Core Routing
@@ -43,4 +43,4 @@
return (build_response("update", dict(request.query)))
res = black_cherry_bootstrap.bootstrap()
-run(host='localhost', port=8080, reloader=True)
+run(host='localhost', port=8080)
diff --git a/asterix-examples/src/main/resources/black-cherry/static/data/query.txt b/asterix-examples/src/main/resources/black-cherry/static/data/query.txt
old mode 100644
new mode 100755
diff --git a/asterix-examples/src/main/resources/black-cherry/static/data/twm.adm b/asterix-examples/src/main/resources/black-cherry/static/data/twm.adm
old mode 100644
new mode 100755
Binary files differ
diff --git a/asterix-examples/src/main/resources/black-cherry/static/img/finalasterixlogo.png b/asterix-examples/src/main/resources/black-cherry/static/img/finalasterixlogo.png
old mode 100644
new mode 100755
Binary files differ
diff --git a/asterix-examples/src/main/resources/black-cherry/static/img/hyrax.png b/asterix-examples/src/main/resources/black-cherry/static/img/hyrax.png
old mode 100644
new mode 100755
Binary files differ
diff --git a/asterix-examples/src/main/resources/black-cherry/static/js/asterix-sdk-stable.js b/asterix-examples/src/main/resources/black-cherry/static/js/asterix-sdk-stable.js
old mode 100644
new mode 100755
diff --git a/asterix-examples/src/main/resources/black-cherry/static/js/cherry.js b/asterix-examples/src/main/resources/black-cherry/static/js/cherry.js
index 40aaac2..83c5ab2 100755
--- a/asterix-examples/src/main/resources/black-cherry/static/js/cherry.js
+++ b/asterix-examples/src/main/resources/black-cherry/static/js/cherry.js
@@ -539,7 +539,7 @@
param_placeholder = {
"query_string" : "use dataverse twitter;\n" + df.val(),
- "marker_path" : "../img/mobile2.png",
+ "marker_path" : "static/img/mobile2.png",
"on_click_marker" : onClickTweetbookMapMarker,
"on_clean_result" : onCleanTweetbookDrilldown,
"payload" : zoneData
@@ -759,7 +759,7 @@
param_placeholder = {
"query_string" : "use dataverse twitter;\n" + plotTweetQuery.val(),
- "marker_path" : "../img/mobile_green2.png",
+ "marker_path" : "static/img/mobile_green2.png",
"on_click_marker" : onClickTweetbookMapMarker,
"on_clean_result" : onCleanPlotTweetbook,
};
@@ -835,12 +835,19 @@
function onCleanPlotTweetbook(records) {
var toPlot = [];
+
+ // An entry looks like this:
+ // { "tweetId": "273589", "tweetText": " like verizon the network is amazing", "tweetLoc": { point: [37.78, 82.27]}, "tweetCom": "hooray comments" }
+
for (var entry in records) {
+
+ var points = records[entry].split("point:")[1].match(/[-+]?[0-9]*\.?[0-9]+/g);
+
var tweetbook_element = {
"tweetEntryId" : parseInt(records[entry].split(",")[0].split(":")[1].split('"')[1]),
"tweetText" : records[entry].split("tweetText\": \"")[1].split("\", \"tweetLoc\":")[0],
- "tweetLat" : parseFloat(records[entry].split("tweetLoc\": point(\"")[1].split(",")[0]),
- "tweetLng" : parseFloat(records[entry].split("tweetLoc\": point(\"")[1].split(",")[1].split("\"")[0]),
+ "tweetLat" : parseFloat(points[0]),
+ "tweetLng" : parseFloat(points[1]),
"tweetComment" : records[entry].split("tweetCom\": \"")[1].split("\"")[0]
};
toPlot.push(tweetbook_element);
@@ -854,12 +861,16 @@
var drilldown_cleaned = [];
for (var entry = 0; entry < rec.length; entry++) {
-
+
+ // An entry looks like this:
+ // { "tweetId": "105491", "tweetText": " hate verizon its platform is OMG", "tweetLoc": { point: [30.55, 71.44]} }
+ var points = rec[entry].split("point:")[1].match(/[-+]?[0-9]*\.?[0-9]+/g);
+
var drill_element = {
- "tweetEntryId" : parseInt(rec[entry].split(",")[0].split(":")[1].split('"')[1]),
+ "tweetEntryId" : parseInt(rec[entry].split(",")[0].split(":")[1].replace('"', '')),
"tweetText" : rec[entry].split("tweetText\": \"")[1].split("\", \"tweetLoc\":")[0],
- "tweetLat" : parseFloat(rec[entry].split("tweetLoc\": point(\"")[1].split(",")[0]),
- "tweetLng" : parseFloat(rec[entry].split("tweetLoc\": point(\"")[1].split(",")[1].split("\"")[0])
+ "tweetLat" : parseFloat(points[0]),
+ "tweetLng" : parseFloat(points[1])
};
drilldown_cleaned.push(drill_element);
}