def parse_node()

in src/graph_notebook/network/opencypher/OCNetwork.py [0:0]


    def parse_node(self, node: dict, path_index: int = -2):
        """This parses the node parameter and adds the node to the network diagram

        Args:
            node (dict): The node dictionary to parse
            path_index: Position of the element in the path traversal order
        """

        depth_group = "__DEPTH-" + str(path_index//2) + "__"

        # generate placeholder tooltip from label; if not present, amalgamate node property values instead
        if LABEL_KEY in node.keys():
            if len(node[LABEL_KEY]) > 0:
                title_plc = node[LABEL_KEY][0]
                create_title_placeholder = False
            else:
                create_title_placeholder = True
        else:
            create_title_placeholder = True

        if create_title_placeholder:
            title_plc = ""
            for key in node:
                title_plc += str(node[key])

        if not isinstance(self.group_by_property, dict):  # Handle string format group_by
            try:
                if self.group_by_property == DEPTH_GRP_KEY:
                    group = depth_group
                elif self.group_by_property == DEFAULT_RAW_GRP_KEY:
                    group = str(node)
                elif self.group_by_property == LABEL_KEY and len(node[LABEL_KEY]) > 0:
                    group = node[LABEL_KEY][0]
                elif self.group_by_property == ID_KEY:
                    group = node[ID_KEY]
                elif self.group_by_property in node[PROPERTIES_KEY]:
                    group = node[PROPERTIES_KEY][self.group_by_property]
                else:
                    group = DEFAULT_GRP
            except KeyError:
                group = DEFAULT_GRP
        else:  # handle dict format group_by
            try:
                if str(node[LABEL_KEY][0]) in self.group_by_property and len(node[LABEL_KEY]) > 0:
                    key = node[LABEL_KEY][0]
                    if self.group_by_property[key] == DEPTH_GRP_KEY:
                        group = depth_group
                    elif self.group_by_property[key] == DEFAULT_RAW_GRP_KEY:
                        group = str(node)
                    elif self.group_by_property[key] == LABEL_KEY:
                        group = node[LABEL_KEY][0]
                    elif self.group_by_property[key] == ID_KEY:
                        group = node[ID_KEY]
                    else:
                        group = node[PROPERTIES_KEY][self.group_by_property[key]]
                else:
                    group = DEFAULT_GRP
            except KeyError:
                group = DEFAULT_GRP

        props = self.flatten(node)
        label = self.get_node_property_value(node, props, title_plc, self.display_property)
        if not label:
            label = node[ID_KEY]
        title, label = self.strip_and_truncate_label_and_title(label, self.label_max_length)
        if self.tooltip_property and self.tooltip_property != self.display_property:
            title, label_plc = self.strip_and_truncate_label_and_title(
                self.get_node_property_value(node, props, title_plc, self.tooltip_property))
        data = {'properties': props, 'label': label, 'title': title, 'group': group}
        if self.ignore_groups:
            data['group'] = DEFAULT_GRP
        self.add_node(node[ID_KEY], data)