The logic for adding a dataset to the deepest level of the tree (lines 179-190) involves re-navigating the tree from the root (current_nav = tree). This is inefficient and can be simplified. The current variable (or equivalent parent tracking) likely already holds the reference to the correct parent node where the dataset should be appended.
Relevant code:
https://github.com/LDFLK/datasets/blob/main/scripts/generate_data_index.py\#L178-L190