Dev (#2962)
* feat(chalice): autocomplete return top 10 with stats * fix(chalice): fixed autocomplete top 10 meta-filters * feat(chalice): new user journey: optimized post-processing + fixed DROP value
This commit is contained in:
parent
c26c235f2f
commit
6559fe27ee
1 changed files with 4 additions and 6 deletions
|
|
@ -12,22 +12,18 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
def __transform_journey(rows, reverse_path=False):
|
||||
total_100p = 0
|
||||
number_of_step1 = 0
|
||||
for r in rows:
|
||||
if r["event_number_in_session"] > 1:
|
||||
break
|
||||
number_of_step1 += 1
|
||||
total_100p += r["sessions_count"]
|
||||
|
||||
for i in range(len(rows)):
|
||||
rows[i]["value"] = rows[i]["sessions_count"] * 100 / total_100p
|
||||
|
||||
nodes = []
|
||||
nodes_values = []
|
||||
links = []
|
||||
drops = []
|
||||
max_depth = 0
|
||||
for r in rows:
|
||||
r["value"] = r["sessions_count"] * 100 / total_100p
|
||||
source = f"{r['event_number_in_session'] - 1}_{r['event_type']}_{r['e_value']}"
|
||||
if source not in nodes:
|
||||
nodes.append(source)
|
||||
|
|
@ -79,7 +75,9 @@ def __transform_journey(rows, reverse_path=False):
|
|||
"eventType": "DROP"})
|
||||
tg_idx = len(nodes) - 1
|
||||
|
||||
link = {"eventType": "DROP", "sessionsCount": drops[i]["sessions_count"], "value": None}
|
||||
link = {"eventType": "DROP",
|
||||
"sessionsCount": drops[i]["sessions_count"],
|
||||
"value": drops[i]["sessions_count"] * 100 / total_100p}
|
||||
if not reverse_path:
|
||||
link["source"] = sr_idx
|
||||
link["target"] = tg_idx
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue