Commit 06b00406 authored by Francesco Poldi's avatar Francesco Poldi

Added fields

it seams that exporting dashboard and visualization does not work, so people will have to write new ones. Pretty easy, I'll add a short tutorial.
parent de2c427f
[
{
"_id": "b82b0210-2b04-11e8-b48f-dbf856df4d4c",
"_type": "dashboard",
"_source": {
"title": "[tweep] Overview",
"hits": 0,
"description": "",
"panelsJSON": "[\n {\n \"panelIndex\": \"1\",\n \"gridData\": {\n \"x\": 6,\n \"y\": 5,\n \"w\": 6,\n \"h\": 3,\n \"i\": \"1\"\n },\n \"id\": \"fcda84d0-2afa-11e8-b48f-dbf856df4d4c\",\n \"type\": \"visualization\",\n \"version\": \"6.2.2\"\n },\n {\n \"panelIndex\": \"2\",\n \"gridData\": {\n \"x\": 0,\n \"y\": 0,\n \"w\": 12,\n \"h\": 2,\n \"i\": \"2\"\n },\n \"id\": \"81446af0-2afc-11e8-b48f-dbf856df4d4c\",\n \"type\": \"visualization\",\n \"version\": \"6.2.2\"\n },\n {\n \"panelIndex\": \"3\",\n \"gridData\": {\n \"x\": 0,\n \"y\": 5,\n \"w\": 6,\n \"h\": 3,\n \"i\": \"3\"\n },\n \"id\": \"6683d0c0-2afc-11e8-b48f-dbf856df4d4c\",\n \"type\": \"visualization\",\n \"version\": \"6.2.2\"\n },\n {\n \"panelIndex\": \"4\",\n \"gridData\": {\n \"x\": 0,\n \"y\": 2,\n \"w\": 12,\n \"h\": 3,\n \"i\": \"4\"\n },\n \"id\": \"4f4f4380-2afc-11e8-b48f-dbf856df4d4c\",\n \"type\": \"visualization\",\n \"version\": \"6.2.2\"\n },\n {\n \"panelIndex\": \"5\",\n \"gridData\": {\n \"x\": 0,\n \"y\": 8,\n \"w\": 4,\n \"h\": 3,\n \"i\": \"5\"\n },\n \"version\": \"6.2.2\",\n \"type\": \"visualization\",\n \"id\": \"38bacd30-2b04-11e8-b48f-dbf856df4d4c\"\n },\n {\n \"panelIndex\": \"6\",\n \"gridData\": {\n \"x\": 8,\n \"y\": 8,\n \"w\": 4,\n \"h\": 3,\n \"i\": \"6\"\n },\n \"version\": \"6.2.2\",\n \"type\": \"visualization\",\n \"id\": \"45a0f4c0-2b04-11e8-b48f-dbf856df4d4c\"\n },\n {\n \"panelIndex\": \"7\",\n \"gridData\": {\n \"x\": 4,\n \"y\": 8,\n \"w\": 4,\n \"h\": 3,\n \"i\": \"7\"\n },\n \"version\": \"6.2.2\",\n \"type\": \"visualization\",\n \"id\": \"50ac41d0-2b04-11e8-b48f-dbf856df4d4c\"\n }\n]",
"optionsJSON": "{\n \"darkTheme\": false,\n \"hidePanelTitles\": false,\n \"useMargins\": true\n}",
"version": 1,
"timeRestore": false,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\n \"query\": {\n \"language\": \"lucene\",\n \"query\": \"\"\n },\n \"filter\": [],\n \"highlightAll\": true,\n \"version\": true\n}"
}
}
}
]
\ No newline at end of file
...@@ -2,7 +2,7 @@ PUT tweep ...@@ -2,7 +2,7 @@ PUT tweep
{ {
"mappings" : { "mappings" : {
"items": { "items": {
"properties": { "properties": {
"tweetid": {"type": "long"}, "tweetid": {"type": "long"},
"datestamp": {"type": "date", "format": "yyyy-MM-dd HH:mm:ss"}, "datestamp": {"type": "date", "format": "yyyy-MM-dd HH:mm:ss"},
"timezone": {"type": "text"}, "timezone": {"type": "text"},
...@@ -10,7 +10,9 @@ PUT tweep ...@@ -10,7 +10,9 @@ PUT tweep
"replies": {"type": "integer"}, "replies": {"type": "integer"},
"retweets": {"type": "integer"}, "retweets": {"type": "integer"},
"likes": {"type": "integer"}, "likes": {"type": "integer"},
"username": {"type": "keyword"} "username": {"type": "keyword"},
"day": {"type": "keyword"},
"hour": {"type": "keyword"}
} }
} }
} }
......
...@@ -204,6 +204,26 @@ async def outTweet(tweet): ...@@ -204,6 +204,26 @@ async def outTweet(tweet):
except sqlite3.IntegrityError: # this happens if the tweet is already in the db except sqlite3.IntegrityError: # this happens if the tweet is already in the db
return "" return ""
day = d.strftime("%A")
if day == "Monday":
_day = 1
elif day == "Tuesday":
_day = 2
elif day == "Wednesday":
_day = 3
elif day == "Thursday":
_day = 4
elif day == "Friday":
_day = 5
elif day == "Saturday":
_day = 6
elif day == "Sunday":
_day = 7
else:
print("[x] Something is going wrong!")
sys.exit(1)
if arg.elasticsearch: if arg.elasticsearch:
jObject = { jObject = {
"tweetid": tweetid, "tweetid": tweetid,
...@@ -214,7 +234,9 @@ async def outTweet(tweet): ...@@ -214,7 +234,9 @@ async def outTweet(tweet):
"replies": replies, "replies": replies,
"retweets": retweets, "retweets": retweets,
"likes": likes, "likes": likes,
"username": username "username": username,
"day": _day,
"hour": time.split(":")[0]
} }
es = Elasticsearch(arg.elasticsearch) es = Elasticsearch(arg.elasticsearch)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment