Exemplo n.º 1
0
def country_data(country):
    conn = scp_data.get_conn()
    cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)
    cursor.execute(
        "select date_format(stat_date,'%c-%d') as dateTime,sum(active) active,sum(Recovered) Recovered,sum(Deaths) Deaths,sum(Confirmed)  Confirmed from data where country = '" + country + "' group by date_format(stat_date,'%c-%d')")
    data = cursor.fetchall()
    print(data)
    return jsonify(data)
Exemplo n.º 2
0
def alll(time):
    print('get country data')
    conn = scp_data.get_conn()
    cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)
    cursor.execute("select *  from data where stat_date=str_to_date('" + time + "','%Y-%m-%d')")
    data = cursor.fetchall()
    print(data)
    return jsonify(data)
Exemplo n.º 3
0
def getTime():
    print('get getTime data')
    conn = scp_data.get_conn()
    cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)
    cursor.execute("select distinct date_format(stat_date,'%Y-%m-%d') as stat_date from data")
    data = cursor.fetchall()
    print(data)
    return jsonify(data)
Exemplo n.º 4
0
def country():
    print('get country data')
    conn = scp_data.get_conn()
    cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)
    cursor.execute("select distinct country  from data")
    data = cursor.fetchall()
    print(data)
    return jsonify(data)
Exemplo n.º 5
0
def getTime():
    print('get getTime data')
    conn = scp_data.get_conn()
    cursor = get_cursor(conn)
    cursor.execute("select distinct strftime('%Y-%m-%d',stat_date) as stat_date from data")
    data = cursor.fetchall()
    print(data)
    return jsonify(data)
Exemplo n.º 6
0
def alll(time):
    print('get country data')
    conn = scp_data.get_conn()
    cursor = get_cursor(conn)
    cursor.execute("select *  from data where stat_date=datetime('" + time + "')")
    data = cursor.fetchall()
    print(data)
    return jsonify(data)
Exemplo n.º 7
0
def country():
    print('get country data')
    conn = scp_data.get_conn()
    cursor = get_cursor(conn)
    cursor.execute("select distinct country  from data")
    data = cursor.fetchall()
    print(data)
    return jsonify(data)
Exemplo n.º 8
0
def country_data(country):
    conn = scp_data.get_conn()
    cursor = get_cursor(conn)
    cursor.execute(
        "select strftime('%m-%d',stat_date) as dateTime,sum(active) active,sum(Recovered) Recovered,sum(Deaths) Deaths,sum(Confirmed)  Confirmed from data where country = '" + country + "' group by strftime('%m-%d',stat_date)")
    data = cursor.fetchall()
    print(data)
    return jsonify(data)
Exemplo n.º 9
0
def top10_time(time):
    print('get top10  data')
    conn = scp_data.get_conn()
    cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)
    cursor.execute(
        "select country,sum(active) active,sum(Recovered) Recovered,sum(Deaths) Deaths,sum(Confirmed) Confirmed  from data where stat_date=str_to_date('" + time + "','%Y-%m-%d')  group by country order by sum(Confirmed) desc limit 10")
    data = cursor.fetchall()
    print(data)
    return jsonify(data)
Exemplo n.º 10
0
def top10_time(time):
    print('get top10  data')
    conn = scp_data.get_conn()
    cursor = get_cursor(conn)
    sql = "select country,sum(active) active,sum(Recovered) Recovered,sum(Deaths) Deaths,sum(Confirmed) Confirmed  from data where stat_date=datetime('" + time + "')  group by country order by sum(Confirmed) desc limit 10"
    print(sql)
    cursor.execute(sql)
    data = cursor.fetchall()
    print(data)
    return jsonify(data)