From f535870811aff8f56e49cea30fadca036f2605e8 Mon Sep 17 00:00:00 2001 From: Kraiem Taha Yassine Date: Tue, 21 Jan 2025 16:19:30 +0100 Subject: [PATCH] Dev (#2967) feat(chalice): new user journey: add ids to nodes --- api/chalicelib/core/metrics/product_analytics.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/api/chalicelib/core/metrics/product_analytics.py b/api/chalicelib/core/metrics/product_analytics.py index 60858ad56..1205b9c07 100644 --- a/api/chalicelib/core/metrics/product_analytics.py +++ b/api/chalicelib/core/metrics/product_analytics.py @@ -29,14 +29,16 @@ def __transform_journey(rows, reverse_path=False): nodes.append(source) nodes_values.append({"depth": r['event_number_in_session'] - 1, "name": r['e_value'], - "eventType": r['event_type']}) + "eventType": r['event_type'], + "id": len(nodes_values)}) target = f"{r['event_number_in_session']}_{r['next_type']}_{r['next_value']}" if target not in nodes: nodes.append(target) nodes_values.append({"depth": r['event_number_in_session'], "name": r['next_value'], - "eventType": r['next_type']}) + "eventType": r['next_type'], + "id": len(nodes_values)}) sr_idx = nodes.index(source) tg_idx = nodes.index(target) @@ -72,7 +74,8 @@ def __transform_journey(rows, reverse_path=False): nodes.append(target) nodes_values.append({"depth": drops[i]["depth"] + 1, "name": None, - "eventType": "DROP"}) + "eventType": "DROP", + "id": len(nodes_values)}) tg_idx = len(nodes) - 1 link = {"eventType": "DROP",