code: def parse_actions(datapath, valid_sku_raw_ids):
      user_clicks = {}
      with open(datapath, "r") as f:
          f.readline()
          # raw_id -> new_id and new_id -> raw_id
          sku_encoder, sku_decoder = {}, []
          sku_id = -1
          for line in f:
              line = line.replace("\n", "")
              fields = line.split(",")
              action_type = fields[-1]
              # actually, all types in the dataset is "1"
              if action_type == "1":
                  user_id = fields[0]
                  sku_raw_id = fields[1]
                  if sku_raw_id in valid_sku_raw_ids:
                      action_time = fields[2]
                      # encode sku_id
                      sku_id = encode_id(
                          sku_encoder, sku_decoder, sku_raw_id, sku_id
                      )
  
                      # add to user clicks
                      try:
                          user_clicks[user_id].append(
                              (sku_id, action_time)
                          )
                      except KeyError:
                          user_clicks[user_id] = [(sku_id, action_time)]
  
      return user_clicks, sku_encoder, sku_decoder
  
file_path: dgl/examples/pytorch/eges/utils.py
imports: import argparse
  import random
  from datetime import datetime
  import dgl
  import networkx
  import numpy
  import torch
label_desc: Use image node_id 5 for calling a global function with example usage: parse_actions(datapath, valid_sku_raw_ids) and returns: user_clicks,  sku_encoder,  sku_decoder