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

46 lines
1.8 KiB
Python

import json
import sys
import re
import subprocess
from pathlib import Path
sys.stdout.reconfigure(encoding='utf-8')
# Run git diff for const_work_item_master_2026-01-01.json in commit 32c4c5cf
cmd = ["git", "diff", "32c4c5cf~1", "32c4c5cf", "--", "resources/data_work_item_master/const_work_item_master_2026-01-01.json"]
res = subprocess.run(cmd, capture_output=True, text=True, encoding='utf-8')
diff_lines = res.stdout.splitlines()
print(f"Total diff lines in const master: {len(diff_lines)}")
# Extract lines starting with '-' (removed lines) inside "notes": [...]
removed_notes = []
current_section = "미식별"
for l in diff_lines:
if '"section":' in l:
current_section = l.strip()
if l.startswith('-') and not l.startswith('---'):
cleaned = l[1:].strip()
if cleaned.startswith('"') and cleaned.endswith('",'):
cleaned = cleaned[1:-2]
elif cleaned.startswith('"') and cleaned.endswith('"'):
cleaned = cleaned[1:-1]
if cleaned and cleaned not in ['notes": [', ']']:
removed_notes.append((current_section, cleaned))
print(f"Total removed notes lines: {len(removed_notes)}")
# Filter lines that look like actual rules (containing %, 할증, 손료, 가산, 공제, etc.)
rule_keywords = ['%', '가산', '할증', '공제', '손료', '손율', '감한다', '할인', '포함한다', 'Q=', '적용한다']
removed_rules = []
for sec, line in removed_notes:
if any(k in line for k in rule_keywords):
# check if it was not just a title
if not re.match(r'^[0-9]+[\.\)]\s*[^:%]+$', line):
removed_rules.append((sec, line))
print(f"Removed lines containing pricing keywords in const master: {len(removed_rules)}")
print("\n--- Sample 20 Removed Rules in Const Master ---")
for sec, r in removed_rules[:20]:
print(f"{sec} -> {r}")