Helper function to get the parent structure code
(structure)
| 323 | |
| 324 | def list_to_tree(data): |
| 325 | def get_parent_structure(structure): |
| 326 | """Helper function to get the parent structure code""" |
| 327 | if not structure: |
| 328 | return None |
| 329 | parts = str(structure).split('.') |
| 330 | return '.'.join(parts[:-1]) if len(parts) > 1 else None |
| 331 | |
| 332 | # First pass: Create nodes and track parent-child relationships |
| 333 | nodes = {} |