Beispiel #1
0
Datei: ced.py Projekt: xialei/poc
    
    new_indicators = db['ced_indicator_data_new']

    newlist = []
    for row in resultset:
        yd = {}
        v = row.get("v", "")
        for k in v.keys():
            y = k[0:4]
            m = k[4:6]
            if y not in yd:
                md = {}
                yd[y] = md
            else:
                md = yd[y]
           
            md[m] = v[k]
            yd[y] = md
        row['v'] = yd
        newlist.append(row)
        if len(newlist) % 5000 == 0 :
            new_indicators.insert(newlist)
            del newlist[:]
    if len(newlist) > 0 :
        new_indicators.insert(newlist)
    
if __name__ == "__main__":
    changeCEDToTimeSeries(mongoclient.get_db())


Beispiel #2
0
    resultset = indicators.find()

    new_indicators = db['ced_indicator_data_new']

    newlist = []
    for row in resultset:
        yd = {}
        v = row.get("v", "")
        for k in v.keys():
            y = k[0:4]
            m = k[4:6]
            if y not in yd:
                md = {}
                yd[y] = md
            else:
                md = yd[y]

            md[m] = v[k]
            yd[y] = md
        row['v'] = yd
        newlist.append(row)
        if len(newlist) % 5000 == 0:
            new_indicators.insert(newlist)
            del newlist[:]
    if len(newlist) > 0:
        new_indicators.insert(newlist)


if __name__ == "__main__":
    changeCEDToTimeSeries(mongoclient.get_db())
Beispiel #3
0
        doclist.append(document)
        
    if len(doclist) > 0 :
        tags = db['tags']
        tags.insert(doclist)
                
def test():
    data = xlrd.open_workbook('../raw/yhyc.xlsx')
    table = data.sheets()[0]
    print table.row_values(1)
    print type(table.cell(1, 1).value)
    print long(table.cell(1, 1).value)
    print map(int, [100, 110])
    print str(100)
    print '10;'.split(';')
    print ''.split(';')
    print [''] == ['']
    print [''][0] == ''
    
if __name__ == "__main__":
    db = mongoclient.get_db()
    importUsers(db)
#     importTags(db)
#     importShequ(db)
#     importWorkshops(db)
#     importProducts(db)
#     importItems(db)
#     test()


Beispiel #4
0
        doclist.append(document)

    if len(doclist) > 0:
        tags = db['tags']
        tags.insert(doclist)


def test():
    data = xlrd.open_workbook('../raw/yhyc.xlsx')
    table = data.sheets()[0]
    print table.row_values(1)
    print type(table.cell(1, 1).value)
    print long(table.cell(1, 1).value)
    print map(int, [100, 110])
    print str(100)
    print '10;'.split(';')
    print ''.split(';')
    print[''] == ['']
    print[''][0] == ''


if __name__ == "__main__":
    db = mongoclient.get_db()
    importUsers(db)
#     importTags(db)
#     importShequ(db)
#     importWorkshops(db)
#     importProducts(db)
#     importItems(db)
#     test()
Beispiel #5
0
miui="MiuiBrowser"
uc="UCBrowser"
qq="QQ"
micro="MicroMessenger"

huawei=["HUAWEI"]
samsung=["SAMSUNG","SM-G","SCH-I","GT-I"]
htc=["HTC"]
xiaomi=["MI","XiaoMi"]
sony=["L39h"]
mx=["M040"]

android="/app/log/android_t.sh"
ios="/app/log/iphone_t.sh"

def downloadstats(db):

    stats = db['appdownload']
    
    #android
    a,b = commands.getstatusoutput('ls') # a:status; b:result
    
    
    
    
if __name__ == "__main__":
    downloadstats(mongoclient.get_db())


Beispiel #6
0
import commands
from tools import mongoclient

miui = "MiuiBrowser"
uc = "UCBrowser"
qq = "QQ"
micro = "MicroMessenger"

huawei = ["HUAWEI"]
samsung = ["SAMSUNG", "SM-G", "SCH-I", "GT-I"]
htc = ["HTC"]
xiaomi = ["MI", "XiaoMi"]
sony = ["L39h"]
mx = ["M040"]

android = "/app/log/android_t.sh"
ios = "/app/log/iphone_t.sh"


def downloadstats(db):

    stats = db['appdownload']

    #android
    a, b = commands.getstatusoutput('ls')  # a:status; b:result


if __name__ == "__main__":
    downloadstats(mongoclient.get_db())