DB_JOB/작업파일/_스크립트/_verify_seosan.py
hehihoho3 df16c98366 백업: DB수집 전체 스냅샷 (공공기관2 정리 전)
공공기관2 작업 중. _temp 몽타주(재생성가능)는 제외.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 18:15:40 +09:00

21 lines
1.4 KiB
Python

import sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
import openpyxl, importlib.util
from collections import Counter
P=r'D:\01.프로젝트\DB수집\작업파일\광역_사이트맵\충청남도\8.서산시\충청남도_서산시.xlsx'
spec=importlib.util.spec_from_file_location('chk', r'D:\01.프로젝트\DB수집\작업파일\광역_사이트맵\_검수체크.py')
chk=importlib.util.module_from_spec(spec); spec.loader.exec_module(chk)
n,issues=chk.inspect(P)
print(f'=== 구조검수: {"PASS" if not issues else "FAIL "+str(len(issues))+""} ({n}행) ===')
for x in issues: print(' X', x)
ws=openpyxl.load_workbook(P).active
data=[r for r in range(3,ws.max_row+1) if ws.cell(r,2).value not in (None,'')]
print('\n정렬 분포:')
for c,nm in [(4,'D'),(5,'E'),(6,'F'),(7,'G'),(11,'K')]:
cnt=Counter((ws.cell(r,c).alignment.horizontal,ws.cell(r,c).alignment.vertical,ws.cell(r,c).alignment.wrap_text) for r in data)
print(f' {nm}: {dict(cnt)}')
print('행높이:', dict(Counter(ws.row_dimensions[r].height for r in range(1,ws.max_row+1))))
print('헤더병합:', [h for h in ('B1:R1','S1:W1','Y1:AA1') if h in {str(m) for m in ws.merged_cells.ranges}],'총병합', len(ws.merged_cells.ranges))
bad=sum(1 for r in data if ws.cell(r,11).value and str(ws.cell(r,11).value).startswith('http') and (not ws.cell(r,11).hyperlink or ws.cell(r,11).hyperlink.target!=ws.cell(r,11).value))
print('K 하이퍼링크 불일치:', bad)