Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data model V1 #128

Merged
merged 12 commits into from
Jul 15, 2016
29 changes: 29 additions & 0 deletions zion/src/main/resources/ddl/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[
{
"dataset": "twitter.ds_tweet",
"dimension": [
{
"field": "A",
"type": "datetime"
},
{
"field": "H",
"type" : "hierarchy",
"level" : [
{
"state": "H.state",
"county": "H.county",
"city": "H.city"
}
],
"innerType": "number"
}
],
"measurement": [
{
"field": "X",
"type" : "int"
}
]
}
]
83 changes: 83 additions & 0 deletions zion/src/main/resources/ddl/twitterSchema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[
{
"dataset": "twitter.ds_tweet",
"dimension": [
{
"field": "create_at",
"type": "datetime"
},
{
"field": "id",
"type": "number"
},
{
"field": "coordinate",
"type": "point"
},
{
"field": "lang",
"type": "string"
},
{
"field": "is_retweet",
"type": "boolean"
},
{
"field": "hashtag",
"type": "bag",
"innerType": "string"
},
{
"field": "user_mentions",
"type": "bag",
"innerType": "number"
},
{
"field": "user.id",
"type": "number"
},
{
"field": "geo",
"type": "hierarchy",
"level": [
{
"state": "geo_tag.stateID"
},
{
"county": "geo_tag.countyID"
},
{
"city": "geo_tag.cityID"
}
],
"innerType": "number"
}
],
"measurement": [
{
"field": "text",
"type": "text"
},
{
"field": "in_reply_to_status",
"type": "number"
},
{
"field": "in_reply_to_user",
"type": "number"
},
{
"field": "favorite_count",
"type": "number"
},
{
"field": "retweet_count",
"type": "number"
},
{
"field": "user.status_count",
"type": "number"
}
]
}
]
63 changes: 63 additions & 0 deletions zion/src/main/resources/request/fullRequest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"dataset": "dataset.name",
"lookup": [
{
"sourceKey": [
"keyName"
],
"dataset": "name",
"lookupKey": [
"keyName"
],
"select": [
"outputKeyName"
],
"as": [
"asName"
]
}
],
"filter": [
{
"field": "fieldP",
"apply": "func",
"relation": "==|<|>|<=|>=|isTrue|isFalse|in|contains|inRange",
"value": [
"x"
]
}
],
"group": {
"by": [
{
"field": "fieldA",
"apply": "function",
"groupNum": 1000,
"as": "outputString"
}
],
"aggregate": [
{
"field": "fieldB|*",
"apply": {
"name": "topK",
"args": {
"k": 10
}
},
"as": "outputFieldName"
}
]
},
"select": {
"order": [
"fields"
],
"offset": 0,
"limit": 100,
"field": [
"fieldA",
"fieldB"
]
}
}
41 changes: 41 additions & 0 deletions zion/src/main/resources/request/hashtag.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"dataset" : "twitter.ds_tweet",
"filter": [
{
"field" : "geo_tag.stateID",
"relation" : "in",
"value" : [1,2,3,31]
},
{
"field" : "create_at",
"relation" : "inRange",
"value" : ["2012", "2016"]
},
{
"field" : "text",
"relation" : "contains",
"value" : ["zika", "virus"]
}
],
"group": {
"by": [
{
"field": "hashTags",
"apply": "unnest",
"as" : "hashTag"
}
],
"aggregate": [
{
"field" : "hashTag",
"apply" : "count",
"as" : "count"
}
]
},
"select" : {
"order" : [ "-count"],
"limit": 100,
"offset" : 0
}
}
71 changes: 71 additions & 0 deletions zion/src/main/resources/request/mapTimeCube.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"dataset": "twitter.ds_tweet",
"filter": [
{
"field": "geo_tag.stateID",
"relation": "in",
"values": [
1,
3
]
},
{
"field": "create_at",
"relation": "inRange",
"values": [
"2012",
"2016"
]
},
{
"field": "text",
"relation": "contains",
"values": [
"zika",
"virus"
]
}
],
"group": {
"by": [
{
"field": "geo",
"apply": "state",
"as": "state"
},
{
"field": "create_at",
"apply": "hour",
"as": "hour"
}
],
"aggregate": [
{
"field": "*",
"apply": "count",
"as": "count"
},
{
"field": "hashTags",
"apply": {
"name": "topK",
"args": {
"k" : 10
}
},
"as": "top10_hash"
},
{
"field": "lang",
"apply": {
"name": "topK",
"args": {
"k" : 10
}
},
"as": "top10_lang"
}
]
}
}

26 changes: 26 additions & 0 deletions zion/src/main/resources/request/sampleTweets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"dataset" : "twitter.ds_tweet",
"filter": [
{
"field" : "geo.stateID",
"relation" : "in",
"value" : [1,2,3,31]
},
{
"field" : "create_at",
"relation" : "inRange",
"value" : ["2012", "2016"]
},
{
"field" : "text",
"relation" : "contains",
"value" : ["zika", "virus"]
}
],
"select" : {
"order" : [ "-create_at"],
"limit": 100,
"offset" : 0,
"field": ["id", "user", "create_at"]
}
}
5 changes: 5 additions & 0 deletions zion/src/main/resources/response/fullResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"status" : 0,
"result" : {},
"reason" : {}
}
10 changes: 10 additions & 0 deletions zion/src/main/resources/response/hashtag.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"status" : 0,
"result" : {
"data" : [
{"hashtag": "zika", "count" : 235},
{"hashtag": "virus", "count": 400}
]
}

}
53 changes: 53 additions & 0 deletions zion/src/main/resources/response/mapTimeCube.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"status": 0,
"result": {
"scale": {
"hour": "hour",
"state": "state"
},
"data": [
{
"hour": "2016010101",
"state": 15,
"count": 235,
"top10_hash": [
{
"zika": 25
},
{
"virus": 15
}
],
"top10_lang": [
{
"en": 100
},
{
"fr": 80
}
]
},
{
"hour": "2016010115",
"state": 15,
"count": 242,
"top10_hash": [
{
"zika": 255
},
{
"virus": 150
}
],
"top10_lang": [
{
"en": 1000
},
{
"fr": 800
}
]
}
]
}
}
Loading