Commit 3a567ba0 authored by 张彦钊's avatar 张彦钊

change test file

parent 7651ce0f
......@@ -104,15 +104,15 @@ def feature_engineer():
unique_values = []
db = pymysql.connect(host='172.16.40.158', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_test')
sql = "select distinct stat_date from esmm_train_data_dwell_share_test"
sql = "select distinct stat_date from esmm_train_data_dwell"
unique_values.extend(get_unique(db,sql))
db = pymysql.connect(host='172.16.40.158', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_test')
sql = "select distinct ucity_id from esmm_train_data_dwell_share_test"
sql = "select distinct ucity_id from esmm_train_data_dwell"
unique_values.extend(get_unique(db, sql))
db = pymysql.connect(host='172.16.40.158', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_test')
sql = "select distinct ccity_name from esmm_train_data_dwell_share_test"
sql = "select distinct ccity_name from esmm_train_data_dwell"
unique_values.extend(get_unique(db, sql))
db = pymysql.connect(host='172.16.40.158', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_test')
......@@ -162,7 +162,7 @@ def feature_engineer():
# unique_values.append("video")
db = pymysql.connect(host='172.16.40.158', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_test')
sql = "select max(stat_date) from esmm_train_data_dwell_share_test"
sql = "select max(stat_date) from esmm_train_data_dwell"
validate_date = con_sql(db, sql)[0].values.tolist()[0]
print("validate_date:" + validate_date)
temp = datetime.datetime.strptime(validate_date, "%Y-%m-%d")
......@@ -170,7 +170,7 @@ def feature_engineer():
print(start)
db = pymysql.connect(host='172.16.40.158', port=4000, user='root', passwd='3SYz54LS9#^9sBvC')
sql = "select distinct doctor.hospital_id from jerry_test.esmm_train_data_dwell_share_test e " \
sql = "select distinct doctor.hospital_id from jerry_test.esmm_train_data_dwell e " \
"left join eagle.src_zhengxing_api_service service on e.diary_service_id = service.id " \
"left join eagle.src_zhengxing_api_doctor doctor on service.doctor_id = doctor.id " \
"where e.stat_date >= '{}'".format(start)
......@@ -196,7 +196,7 @@ def feature_engineer():
"ot.tag as tag5,sixin.tag as tag6,cart.tag as tag7,doris.search_tag2,doris.search_tag3," \
"k.treatment_method,k.price_min,k.price_max,k.treatment_time,k.maintain_time,k.recover_time," \
"e.device_id,e.cid_id " \
"from jerry_test.esmm_train_data_dwell_share_test e left join jerry_test.user_feature u on e.device_id = u.device_id " \
"from jerry_test.esmm_train_data_dwell e left join jerry_test.user_feature u on e.device_id = u.device_id " \
"left join jerry_test.cid_type_top c on e.device_id = c.device_id " \
"left join jerry_test.cid_time_cut cut on e.cid_id = cut.cid " \
"left join jerry_test.device_app_list dl on e.device_id = dl.device_id " \
......@@ -261,7 +261,7 @@ def feature_engineer():
print("训练集样本总量:")
print(rdd.count())
# get_pre_number()
get_pre_number()
test = rdd.filter(lambda x: x[0] == validate_date).map(
lambda x: (x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9],
......@@ -301,8 +301,7 @@ def get_predict(date,value_map,app_list_map,leve2_map,leve3_map):
"left join jerry_test.sixin_tag sixin on e.device_id = sixin.device_id " \
"left join jerry_test.cart_tag cart on e.device_id = cart.device_id " \
"left join jerry_test.knowledge k on feat.level2 = k.level2_id " \
"left join jerry_test.search_doris doris on e.device_id = doris.device_id and e.stat_date = doris.get_date " \
"where e.device_id = 'C33E2C8E-86E9-4C91-8458-526FB81E4C78'"
"left join jerry_test.search_doris doris on e.device_id = doris.device_id and e.stat_date = doris.get_date"
features = ["ucity_id", "ccity_name", "device_type", "manufacturer",
"channel", "top", "time", "hospital_id",
......
......@@ -18,28 +18,13 @@ city = "beijing" # beijing
s = requests.session()
def get_d():
url = "https://backend.igengmei.com/api/tractate/list?t=1565668444141&version=7.12.6&hybrid=true&channel=App%20Store&current_city_id={}&device_id={}&idfa=B6712382-69D5-4B12-9810-5F266411C4CF&idfv=E6937620-F372-434B-9084-9A9580573838&lat=40.00190424107359&lng=116.4871480941339&platform=iPhone&os_version=11.4.1&json=&tractate_id=42124&start_num=0&from=&data_type=user_post".format(city, device_IOS)
url = "https://backend.igengmei.com/hybrid/answer_detail/_data?count=10&id=684331&t=1565678678155&version=7.12.6&hybrid=true&channel=App%20Store&current_city_id={}&device_id={}&idfa=B6712382-69D5-4B12-9810-5F266411C4CF&idfv=E6937620-F372-434B-9084-9A9580573838&lat=40.00460770016659&lng=116.4882663515051&platform=iPhone&os_version=11.4.1".format(
city, device_IOS)
a = s.get(url, verify=False)
aa = a.json()
return aa
def mysql(device_Android):
db = pymysql.connect(host='172.16.30.136', port=3306, user='doris', passwd='o5gbA27hXHHm', db='doris_prod')
sql = "select queue from device_user_topic_queue where device_id = '{}'".format(device_Android)
cursor = db.cursor()
cursor.execute(sql)
result = cursor.fetchone()
db.close()
l = result[0].split(",")
print(l)
return l
def get_chapter(id):
"""
topic 帖子
......@@ -168,7 +153,7 @@ def get_chapter(id):
def get_opreaton():
db = pymysql.connect(host='172.16.30.143', port=3306, user='work', passwd='BJQaT9VzDcuPBqkd', db='zhengxing')
sql = "SELECT GROUP_CONCAT(distinct card_id) from api_feedoperatev2 " \
"where card_type = 19 and is_online = 1 and end_time >= '2019-08-13' and start_time <='2019-08-13'"
"where card_type = 26 and is_online = 1 and end_time >= '2019-08-13' and start_time <='2019-08-13'"
cursor = db.cursor()
cursor.execute(sql)
result = cursor.fetchone()
......@@ -178,6 +163,16 @@ def get_opreaton():
print(l)
return l
def mysql(device_Android):
db = pymysql.connect(host='172.16.30.136', port=3306, user='doris', passwd='o5gbA27hXHHm', db='doris_prod')
sql = "select queue from device_qa_queue where device_id = '{}'".format(device_Android)
cursor = db.cursor()
cursor.execute(sql)
result = cursor.fetchone()
db.close()
l = result[0].split(",")
print(l)
return l
if __name__ == '__main__':
get_d()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment