Commit 8c7eb591 authored by litaolemo's avatar litaolemo

update

parent 9f83f7c2
......@@ -3,6 +3,7 @@
# @File : portary_div_exposure.py
# @email : litao@igengmei.com
# @author : litao
import datetime
import json
import traceback
......@@ -10,6 +11,7 @@ import redis
import pymysql
from elasticsearch import Elasticsearch
from meta_base_code.utils.func_get_pv_card_id import get_card_id
import pandas as pd
redis_client = redis.StrictRedis.from_url("redis://:ReDis!GmTx*0aN6@172.16.40.133:6379")
redis_client2 = redis.StrictRedis.from_url("redis://:ReDis!GmTx*0aN9@172.16.40.173:6379")
......@@ -27,6 +29,7 @@ es = Elasticsearch([
def user_portrait_scan_info():
res_dict = {}
try:
round = 0
all_count = 0
......@@ -52,7 +55,11 @@ def user_portrait_scan_info():
# just_projects_count += 1
# user_portrait_get_empty_candidates(device_id)
yield get_user_portrait_tag3_from_redis(device_id)
res_dic = get_user_portrait_tag3_from_redis(device_id)
print(res_dic)
# for data_list in res_dic:
# for data in data_list:
print("all count: " + str(all_count))
print("empty portrait: " + str(empty_count))
......@@ -447,7 +454,7 @@ def from_id_get_tag(card_id_dict):
doc_type = 'tractate'
for card_id in card_id_dict[card_type]:
res = es.get_source(index,doc_type,card_id)
print(res)
# print(res)
first_demands = res.get("first_demands") if res.get("first_demands") else []
second_demands = res.get("second_demands") if res.get("second_demands") else []
first_solutions = res.get("first_solutions") if res.get("first_solutions") else []
......@@ -464,19 +471,32 @@ def from_id_get_tag(card_id_dict):
return query_count
# def save_data_to_csv(all_tags, word_count_exposure):
# all_data = []
#
# data = pd.DataFrame(all_dic)
# s = datetime.datetime.now()
# ss = str(s)[0:19].replace(' ', '-').replace(':', '-')
# data.to_csv('%s%sall_s2.csv' % (d, monthly_doc_type_name), encoding='gb18030',
# # columns=columns
# )
def parse_data():
demands_num = {}
# 获取画像数
user_portrait_scan_info()
# 获取全部标签
all_tags = get_channel_tags_info()
print(all_tags)
# 获取标签对应的日记帖子回答数
article_num_dict = get_es_article_num(all_tags)
# article_num_dict = get_es_article_num(all_tags)
# 获取曝光的id
card_id_dict = get_card_id()
print(card_id_dict)
# 获取曝光id对应的标签
word_count_exposure = from_id_get_tag(card_id_dict)
print(word_count_exposure)
save_data_to_csv(all_tags, word_count_exposure)
if __name__ == "__main__":
parse_data()
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