Commit c91d1fa0 authored by 张彦钊's avatar 张彦钊

add

parent 96c0590d
......@@ -3,19 +3,12 @@ import json
import requests
# url="http://127.0.0.1:4050/v1/once"
url="http://doris.paas.test/v1/once"
url = "http://doctor.paas.env/v1/once"
# 如果在生产环境doris 01上执行,把url改成"http://127.0.0.1:4050/v1/once"
header_dict={'Content-Type': 'application/x-www-form-urlencoded'}
param_dict={}
# param_dict["method"]="doris/search/doctor_officer"
# param_detail = {"device_id": 'xx',"size": 10,"offset":0, "query": "双眼皮","user_city_tag_id": 328,
# "is_officer":False,"filters":{}}
# param_dict["method"]="doris/search/bangdan"
# param_detail = {"device_id": '2',"size": 10,"offset":0, "user_city_tag_id": -1,"is_officer":False,"unit_ids":[]}
diary_list = [9462756,9462737,9462730,9462719]
param_dict["method"]="doris/search/diary_score"
# param_dict["method"]="doris/search/diary_score"
param_detail = {"diary_list": diary_list}
......
......@@ -12,6 +12,7 @@ def get_yesterday_date():
print(yesterday)
return yesterday
def ctr_all():
db = pymysql.connect(host='10.66.157.22', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_prod')
cursor = db.cursor()
......
......@@ -4,7 +4,6 @@ import pandas as pd
def hospital():
date_str = "20200101"
sql = "select api.id," \
"h.hospital_id,h.hospital_exposure_pv_30,h.service_exposure_pv_30,h.expert_exposure_pv_30," \
"h.service_ctr_30,h.hospital_ctr_30,h.expert_ctr_30,b.merchant_id," \
......@@ -57,9 +56,9 @@ def hospital():
df.loc[df["all_exposure"] <= 3000, ["ctr"]] = 0.01
df.loc[df["ctr"] < 0.01, ["ctr"]] = 0.01
df.loc[df["ctr"] > 0.2, ["ctr"]] = 0.2
df.loc[df["cpt"] > 10, ["cpt"]] = 10
df.loc[df["cpt"] > 3, ["cpt"]] = 3
df.loc[df["cpt"] < 0.01, ["cpt"]] = 0.01
df.loc[df["commission"] > 10, ["commission"]] = 10
df.loc[df["commission"] > 3, ["commission"]] = 3
df.loc[df["commission"] < 0.01, ["commission"]] = 0.01
df["score"] = df["ctr"] ** 0.5 * (df["commission"] + df["cpt"])
......@@ -74,11 +73,10 @@ def hospital():
data = data.drop_duplicates()
print(data.shape)
data.to_csv('/tmp/26_hospital.csv',index=False)
data.to_csv('/tmp/30_hospital.csv',index=False)
def new_doctor():
date_str = "20200101"
sql = "select d.doctor_id,d.service_exposure_pv_30,d.service_ctr_30,d.expert_exposure_pv_30," \
"d.expert_pv_30,b.merchant_id,m.doctor_discount_30_days,m.expand_rechange_amount_30," \
"m.service_pv_30,m.expert_pv_30,m.organization_pv_30 from statistic_doctor_rank_factor d " \
......@@ -125,9 +123,9 @@ def new_doctor():
df.loc[df["all_exposure"] <= 3000, ["ctr"]] = 0.01
df.loc[df["ctr"] < 0.01, ["ctr"]] = 0.01
df.loc[df["ctr"] > 0.2, ["ctr"]] = 0.2
df.loc[df["commission"] > 10, ["commission"]] = 10
df.loc[df["commission"] > 3, ["commission"]] = 3
df.loc[df["commission"] < 0.01, ["commission"]] = 0.01
df.loc[df["pv_ad"] > 10, ["pv_ad"]] = 10
df.loc[df["pv_ad"] > 3, ["pv_ad"]] = 3
df.loc[df["pv_ad"] < 0.01, ["pv_ad"]] = 0.01
df["score"] = df["ctr"] ** 0.5 * (df["commission"] + df["pv_ad"])
......@@ -141,11 +139,12 @@ def new_doctor():
data = data.drop_duplicates()
print(data.shape)
data.to_csv('/tmp/26_doctor.csv',index=False)
data.to_csv('/tmp/30_doctor.csv',index=False)
print("doctor end")
if __name__ == "__main__":
date_str = "20200310"
new_doctor()
hospital()
......
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