feat(etl): извлечение прайсов по форматам (xlsx/xls/docx/pdf) и распознавание сложных страниц через Gemini Vision

This commit is contained in:
2026-06-26 15:10:00 +05:00
parent 3834e4811d
commit 26283d5432
8 changed files with 849 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
"""Прогон извлечения по всему архиву: сколько позиций берёт каждый формат."""
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(REPO))
from etl.extractors import extract
files = sorted((REPO / "data/raw").glob("*"))
total = 0
for path in files:
doc = extract(str(path))
total += len(doc.rows)
tiers = sorted({t for row in doc.rows for t in row.prices})
print(f"\n{'=' * 68}")
print(
f"{path.name} [{doc.file_format}] партнёр='{doc.partner_name}' дата={doc.effective_date}"
)
print(f" позиций: {len(doc.rows)} | тарифы: {tiers}")
if doc.parse_log:
print(f" лог: {doc.parse_log[:2]}")
for row in doc.rows[:3]:
print(
f" код={row.service_code_source!r} «{row.service_name_raw[:40]}» {row.prices} секц={row.section!r}"
)
print(f"\n{'=' * 68}\nИТОГО позиций по архиву: {total}")