fs-lawrisk/tools/inspect_mismatches.py

42 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import json
import os
from lawrisk.utils.env_loader import load_env
def inspect_files():
base_dir = r"市级初版-20251219\许可风险提示"
targets = [
"10 风险提示表(公众聚集场所投入使用、营业前消防安全检查(告知承诺件)),消防部门)(1)_转自XLS.json",
"72 风险提示表(烟草专卖零售许可证核发,烟草专卖部门).json",
"46 风险提示表烟花爆竹经营零售许可证核发应急部门市、区汇总_转自XLS.json",
"81风险提示表“《卫星地面接收设施安装服务许可证》换发审批”“《卫星地面接收设施安装服务许可证》申领审批”,文广旅体部门_转自XLS.json"
]
for fname in targets:
fpath = os.path.join(base_dir, fname)
if not os.path.exists(fpath):
# Try fuzzy match if exact name fails
candidates = [f for f in os.listdir(base_dir) if fname[:10] in f]
if candidates:
fpath = os.path.join(base_dir, candidates[0])
else:
print(f"File not found: {fname}")
continue
print(f"\nScanning: {os.path.basename(fpath)}")
try:
with open(fpath, 'r', encoding='utf-8') as f:
data = json.load(f)
sheets = data.get("sheets", {})
for sname, sdata in sheets.items():
rows = sdata.get("rows", [])
print(f" Sheet: '{sname}' - Rows: {len(rows)}")
if rows:
print(f" Sample Permit: {rows[0].get('permit_name')}")
except Exception as e:
print(f" Error: {e}")
if __name__ == "__main__":
inspect_files()