39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
import sys, json
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
|
|
with open('resources/data_work_item_link/work_item_link_2026-01-01.json', 'r', encoding='utf-8') as f:
|
|
link_data = json.load(f)
|
|
|
|
with open('resources/data_work_item_master/const_work_item_master_2026-01-01.json', 'r', encoding='utf-8') as f:
|
|
const_master = json.load(f)
|
|
|
|
items = const_master.get('work_items', [])
|
|
item_map = {it['work_item_key']: it for it in items}
|
|
|
|
linked_keys = set()
|
|
for l in link_data.get('links', []):
|
|
ck = l.get('const_key')
|
|
if ck:
|
|
linked_keys.add(ck)
|
|
|
|
print(f"Total linked keys: {len(linked_keys)}")
|
|
path_set = set()
|
|
for k in sorted(linked_keys):
|
|
it = item_map.get(k)
|
|
if it:
|
|
pn = it.get('path_name', '')
|
|
num = it.get('number', '')
|
|
name = it.get('name', '')
|
|
tables = it.get('tables', [])
|
|
print(f"{k} | {num} | {name} | {pn} | tables={len(tables)}")
|
|
# top level chapter from path_name
|
|
parts = pn.split(' > ')
|
|
if len(parts) >= 2:
|
|
path_set.add(f"{parts[0]} > {parts[1]}")
|
|
else:
|
|
path_set.add(pn)
|
|
|
|
print("\n=== Chapters/Sections involved ===")
|
|
for p in sorted(path_set):
|
|
print(p)
|