|
|
@@ -35,7 +35,14 @@ def build_recommend_report(recommend_data, recommend_cust_infos):
|
|
|
recommend_data = pd.DataFrame(recommend_data)
|
|
|
|
|
|
cust_ids = recommend_cust_infos.set_index("cust_code")
|
|
|
+ before_join = set(recommend_data["cust_code"])
|
|
|
recommend_data = recommend_data.join(cust_ids, on="cust_code", how="inner")
|
|
|
+ missing = before_join - set(recommend_data["cust_code"])
|
|
|
+ if missing:
|
|
|
+ import logging
|
|
|
+ logging.getLogger("utils.report").warning(
|
|
|
+ f"build_recommend_report: {len(missing)} cust_codes not found in customer master and dropped from report: {missing}"
|
|
|
+ )
|
|
|
recommend_data = recommend_data[["cust_code", "cust_name", "recommend_score"]]
|
|
|
recommend_data = recommend_data.reset_index(drop=True)
|
|
|
recommend_data.index = recommend_data.index + 1
|