forked from CUBigDataClass/Disaster-Analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetCountDataForThePastOneMonthAndStoreInDatabase.py
More file actions
42 lines (30 loc) · 1.08 KB
/
getCountDataForThePastOneMonthAndStoreInDatabase.py
File metadata and controls
42 lines (30 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import pymongo
import datetime
from pymongo import MongoClient
client = MongoClient('localhost',27017)
db = client['disaster']
Tweets = db['Tweets']
dateFromMarch = datetime.datetime(2016, 3, 24, 0, 0 , 0)
currentDate = datetime.datetime.utcnow()
TweetsGatheredPerDay = Tweets.find({"created_at" : { '$gt' : dateFromMarch , '$lt': currentDate }}).count()
print TweetsGatheredPerDay
#print content
#for issue in count.keys():
# if issue in content['text']:
# #print "Happening: " , issue
# count[issue] += 1
#print count
#break
#monthly = db['monthly']
#result = db.monthly.insert_one({"date": dateFromMarch , "count": count})
#dateFromMarch += differenceOf24Hours
#print "Before Collapse:" , count
#for content in afterCollapseTweets:
# for issue in count.keys():
# if issue in content['text']:
# count[issue] += 1
#print "After Collapse:" , count
#result = db.overView.insert_one({"date": dateNow , "count": count} )
#print "Output: " , result
#print count
#print content['text']