"""Generate only the original TradeRoute 13-parent/123-leaf taxonomy from frozen evidence."""
import hashlib,json
from pathlib import Path
root=Path(__file__).resolve().parents[1]
evidence=json.loads((root/'artifacts/galaxy-query-research/commodity-tree/frozen-label-references.json').read_text())
expected='5135b3d55e5239b3d11f79a76adeda954eb78be5101b6a516fd25df257affa77'
assert evidence['frozenSha256']==expected
assert len(evidence['categoryRows'])==13 and len(evidence['commodityRows'])==123
assert [row['value'] for row in evidence['categoryRows']]==list(range(13))
labels=['金属','矿物','化学制品','工业材料','武器','机械','消费品','科技','麻醉品','药物','食品','纺织品','其他']
categories=[dict(id=row['value'],name=row['name'],label=labels[index]) for index,row in enumerate(evidence['categoryRows'])]
commodities=[dict(name=row['name'],categoryId=row['category']) for row in evidence['commodityRows']]
assert len({row['name'] for row in commodities})==123
assert all(0<=row['categoryId']<13 for row in commodities)
source=root/'artifacts/galaxy-query-research/palette-resources/86ec03fba621526059fc6812faca6f10adcb63cb.indexed1'
assert hashlib.sha256(source.read_bytes()).hexdigest()==expected
result=dict(source='Original frozen GalaxyMapResources TradeRoute configuration: 13 category rows and 123 commodity rows. Labels are Chinese translations; original names and numeric category IDs are retained.',frozenSha256=expected,configuration=dict(pool=423,offset=14672,categoryField=128,commodityField=144),categories=categories,commodities=commodities)
target=root/'XFEEDToolBox.Core/Galaxy/original-trade-categories.json';target.write_text(json.dumps(result,ensure_ascii=False,indent=2)+'\n',encoding='utf-8')
print('Generated 13 original TradeRoute categories and 123 source leaves. No market prices/account data included.')
"""Generate only the original TradeRoute 13-parent/123-leaf taxonomy from frozen evidence."""
import hashlib,json
from pathlib import Path
root=Path(__file__).resolve().parents[1]
evidence=json.loads((root/'artifacts/galaxy-query-research/commodity-tree/frozen-label-references.json').read_text())
expected='5135b3d55e5239b3d11f79a76adeda954eb78be5101b6a516fd25df257affa77'
assert evidence['frozenSha256']==expected
assert len(evidence['categoryRows'])==13 and len(evidence['commodityRows'])==123
assert [row['value'] for row in evidence['categoryRows']]==list(range(13))
labels=['金属','矿物','化学制品','工业材料','武器','机械','消费品','科技','麻醉品','药物','食品','纺织品','其他']
categories=[dict(id=row['value'],name=row['name'],label=labels[index]) for index,row in enumerate(evidence['categoryRows'])]
commodities=[dict(name=row['name'],categoryId=row['category']) for row in evidence['commodityRows']]
assert len({row['name'] for row in commodities})==123
assert all(0<=row['categoryId']<13 for row in commodities)
source=root/'artifacts/galaxy-query-research/palette-resources/86ec03fba621526059fc6812faca6f10adcb63cb.indexed1'
assert hashlib.sha256(source.read_bytes()).hexdigest()==expected
result=dict(source='Original frozen GalaxyMapResources TradeRoute configuration: 13 category rows and 123 commodity rows. Labels are Chinese translations; original names and numeric category IDs are retained.',frozenSha256=expected,configuration=dict(pool=423,offset=14672,categoryField=128,commodityField=144),categories=categories,commodities=commodities)
target=root/'XFEEDToolBox.Core/Galaxy/original-trade-categories.json';target.write_text(json.dumps(result,ensure_ascii=False,indent=2)+'\n',encoding='utf-8')
print('Generated 13 original TradeRoute categories and 123 source leaves. No market prices/account data included.')