コード例 #1
0
ファイル: queryClickLog.py プロジェクト: eox03y/works
	def __init__(self, myname=''):
		try:
			sys.setdefaultencoding('utf8')
		except:
			import site
			#site.setencoding('utf8')
		self.qcD = {}
		self.imD = handolUtil.AddValueDict("Input Method") 
		self.keywordD = handolUtil.AddValueDict("Keywords")
		self.shopkeywordD = handolUtil.AddValueDict("Keyword and Shop")
		self.shopD = handolUtil.AddValueDict("MCC")
		self.osshopD = handolUtil.AddValueDict("OS_MCC")
		self.dosD = handolUtil.AddValueDict("Device OS")
		self.dmD = handolUtil.AddValueDict("Device Model")
		self.devtypeD = handolUtil.AddValueDict("Device Type")
		self.zeroD = handolUtil.AddValueDict("No Res Keywords")
		self.zeroshopkeywordD = handolUtil.AddValueDict("No Res By MCC * Keyword")
		#self.diffsecD = handolUtil.AddValueDict("Seconds to Click")

		self.shopD.set_order('key')
		self.shopkeywordD.set_order('key')
		self.osshopD.set_order('key')
		#self.diffsecD.set_order('key')

		self.cnt_qc_match = 0
		self.cnt_c_only = 0
		self.errcnt_q = 0	
		self.errcnt_c = 0	
		self.myname = myname
コード例 #2
0
    def __init__(self, svcname='', myname=''):
        '''
		svcname must be one of "HUB", "APPS".
		'''
        self.SVC = svcname
        self.myname = myname
        self.FLD_NAMES = ['dt', 'dos', 'im', 'shp']
        self.statD = [None] * len(self.FLD_NAMES)
        for i, fld in enumerate(self.FLD_NAMES):
            self.statD[i] = handolUtil.AddValueDict(fld)
コード例 #3
0
ファイル: queryKeywordRank.py プロジェクト: eox03y/works
	def get_stats(self):
		""" calculate statistics and store into self.statD
		"""
		self.statD = {}
		for v in self.srcList:
			keyword = v[1].strip().lower()
			ctry = v[2]
			tot = v[3]
			if tot==0: nores = 1
			else: nores = 0
			if self.SVC=="APPS": svc = "APPS"
			else: svc = v[4]

			SVC_CTRY = "%s-%s" % (svc, ctry)
			kdict = self.statD.get(SVC_CTRY, None) # dict by Keywords
			if not kdict:
				kdict = handolUtil.AddValueDict(SVC_CTRY)
				self.statD[SVC_CTRY] = kdict

			kdict.add(keyword, [1, tot, nores])
コード例 #4
0
import pymongo
import handolUtil
#c = pymongo.MongoClient('localhost', 27018)
c = pymongo.Connection('localhost', 27018)
print c
db = c['qclog2013']
print db

print db.keywords
print db.days
coll = db['keywords']
coll = db['test']
print coll


d = handolUtil.AddValueDict()
d.add('iqry', [1, 0])
d.add('iqry', [1, 1])
d.add('iqry', [1, 0])
d.add('ac', [1, 1])
d.add('ac', [1, 1])
d.add('', [1, 0])

day='20130131'

#coll.insert({"_id":day, "vals": d})


dd = dict(d)
dd["_id"] = day
coll.insert(dd)