Skip to content
Snippets Groups Projects
Commit 081ff0cd authored by xinjiel2's avatar xinjiel2
Browse files

real time

parent 072d241a
No related branches found
No related tags found
No related merge requests found
...@@ -23,14 +23,85 @@ def index(request): ...@@ -23,14 +23,85 @@ def index(request):
#GET /tweet_resutls/_design/city/_view/city-view HTTP/1.1 #GET /tweet_resutls/_design/city/_view/city-view HTTP/1.1
cityInfo = [] cityInfo = []
for doc in docs.view('city/city-view',group = True): cityTotal = []
cityPercentage = {}
for doc in docs.view('results/result-view',group = True):
print(doc.key, doc.value) print(doc.key, doc.value)
cityInfo.append(doc) cityInfo.append(doc)
print(cityInfo) for doc in docs.view('results/cityTweet-view',group = True):
#print(doc.key,doc.value)
#cityTotal.append(doc)
for data in cityInfo:
if data.key == doc.key:
number = (data.value/doc.value)*100
percentage = str(round(number,2))+"%"
#print(percentage)
cityPercentage[data.key] = percentage
#print(cityTotal)
#print(cityInfo)
context = cityPercentage
context = {'cityInfo':cityInfo} context = {'cityInfo':cityInfo}
docsNsw = SERVER['aurin_nsw']
#print(docs)
#print(docs.view('city/city-view',key = "melbourne"))
countId = []
#print(docs['f6376ce946ac201c045408615e00d502'])
for doc in docsNsw:
features = docsNsw[doc]['features']
for feature in features:
countId.append(feature["id"])
print(len(countId))
docsNswDomestic = SERVER['aurin_nsw_domestic']
for doc in docsNswDomestic.view('domesitc/new-view'):
for element in doc.value:
#print(doc.value[element])
countDomesitc += doc.value[element]
countDomesitc += len(countId)
print(countDomesitc)
context = {'NswCount':countDomesitc}
#print(docs[doc]['features'])
#GET /tweet_resutls/_design/city/_view/city-view HTTP/1.1
docsVic = SERVER['aurin_vic']
att = ['a10','a20','a50','a80']
count = 0
for doc in docsVic.view('vic/new-view'):
#print(doc.key, doc.value)
for properties in doc.value:
#print(properties)
for element in properties:
if element in att:
if properties[element] == 'lga_code_2011':
continue
elif properties[element] == None:
continue
else:
count += properties[element]
print(count)
context = {'VicCount':count}
docsSa = SERVER['aurin_sa']
countForSa = 0
for doc in docsSa.view('sa/new-view'):
for properties in doc.value:
for element in properties:
if element == 'month' or element == "id":
continue
else:
if not properties[element] == None:
#print(countForSa)
countForSa += properties[element]
print(countForSa)
context = {'SaCount':countForSa}
#context = {'file':2} #context = {'file':2}
else: else:
context = {'file':error} context = {'file':error}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment