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

66 lines
2.3 KiB
Python

import json
import sys
import re
from pathlib import Path
sys.stdout.reconfigure(encoding='utf-8')
# 1. Load coef_2026.json
coef_path = Path('resources/data_cost_input_value/coef_2026.json')
with open(coef_path, 'r', encoding='utf-8') as f:
coef = json.load(f)
# 2. Check soil conversion factors in MD (Table F0004, Line 709~727)
# MD Table 4 has: 종별, L, C
with open('resources/data_cost_input_value/pum_forest_2026.json', 'r', encoding='utf-8') as f:
pum = json.load(f)
pum_tables = {t['table_id']: t for t in pum.get('variables', {}).get('pum', {}).get('tables', [])}
print("=== 기초값 대조: 토량환산계수 L, C (F0004) ===")
f0004 = pum_tables.get('F0004')
if f0004:
print(f"F0004 headers: {f0004['headers']}")
print("F0004 rows count:", len(f0004['rows']))
for r in f0004['rows'][:5]:
print(" ", r)
coef_vars = coef.get('variables', {})
soil_L = coef_vars.get('coef_soil_L', {})
soil_C = coef_vars.get('coef_soil_C', {})
print(f"coef_2026 soil_L entries: {len(soil_L)}, soil_C entries: {len(soil_C)}")
for k in list(soil_L.keys())[:5]:
print(f" Soil: {k} -> L={soil_L.get(k)}, C={soil_C.get(k)}")
# Check discrepancies between F0004 rows and coef_soil_L/C
soil_mismatches = []
for r in f0004['rows']:
name = r[0].strip()
l_val_str = r[1].strip()
c_val_str = r[2].strip()
# Try match with soil_L
matched_l = None
for k, v in soil_L.items():
if k in name or name in k:
matched_l = v
break
# print diff if any
print(f"MD [{name}]: L={l_val_str}, C={c_val_str} | coef_2026 match: {matched_l}")
print("\n=== 기초값 대조: 자재할증률 (F0008, F0009, F0010, F0011, F0012, F0013) ===")
mat_surcharges = coef_vars.get('surcharge_mat', {})
print(f"coef_2026 surcharge_mat count: {len(mat_surcharges)}")
for k, v in list(mat_surcharges.items())[:10]:
print(f" {k}: {v}")
print("\n=== 기초값 대조: 공구손료 및 경장비 (rate_tool) ===")
rate_tool = coef_vars.get('rate_tool', {})
print(f"coef_2026 rate_tool: {rate_tool}")
print("\n=== 기초값 대조: 노임할증 (surcharge_labor) ===")
surcharge_labor = coef_vars.get('surcharge_labor', {})
print(f"coef_2026 surcharge_labor entries: {len(surcharge_labor)}")
for k, v in list(surcharge_labor.items())[:10]:
print(f" {k}: {v}")