Files
Aislo/resources/tester/scratch/inspect_data.py
T

35 lines
1.5 KiB
Python

import json
from pathlib import Path
pum_forest_path = Path('resources/data_cost_input_value/pum_forest_2026.json')
with open(pum_forest_path, 'r', encoding='utf-8') as f:
p = json.load(f)
pum_var = p.get('variables', {}).get('pum', {})
print("pum_var keys:", list(pum_var.keys()))
for k, v in pum_var.items():
if isinstance(v, dict):
print(f" {k}: dict with {len(v)} keys (sample: {list(v.keys())[:5]})")
elif isinstance(v, list):
print(f" {k}: list with {len(v)} items")
else:
print(f" {k}: {type(v)}")
# Check work_item_master structure details
master_path = Path('resources/data_work_item_master/work_item_master_2026-01-01.json')
with open(master_path, 'r', encoding='utf-8') as f:
w = json.load(f)
print("\n--- Work Item Sample ---")
wi_with_tables = [wi for wi in w['work_items'] if wi.get('tables')][:2]
for wi in wi_with_tables:
print(f"WI: {wi['work_item_code']} / {wi['name']} / level {wi['level']}")
for tbl in wi['tables']:
print(f" Table: {tbl.get('pum_table_id')} / {tbl.get('section')} / basis: {tbl.get('basis_quantity')} {tbl.get('basis_unit')} / form: {tbl.get('pum_form')}")
if 'raw_markdown' in tbl:
print(f" raw_markdown lines: {len(tbl['raw_markdown'].splitlines())}")
print(f"\nOrphan tables count: {len(w.get('orphan_tables', []))}")
for ot in w.get('orphan_tables', [])[:5]:
print(f" Orphan Table: {ot.get('pum_table_id')} / {ot.get('section')} / basis: {ot.get('basis_quantity')} {ot.get('basis_unit')}")