feat: расширение корпуса — .gge(ДВ)/.gsfx/.arp(ОСНБЖ) в ext-индекс (#2-#5)
Три глубоких парсера (Fable): merge_gge (РИМ .gge регион ДВ/цены 2025), gsfx_deep (ресурсы+ состав работ+НР/СП+источник цены из 555 .gsfx), arp_deep (ОСНБЖ ж/д: Кнр/Ксп/Кизв+ресурсы, объём f26 численно верифицирован, сверка с парной .xls). Анти-отравление: каждая запись несёт norm_base+price_level, БИМ-сметы 2001 и ценовые выбросы 5× → карантин, обезличено corpus_anon (0 утечек). Сведено в ОТДЕЛЬНЫЙ estimates_ext_index.json (1891 расценка+1703 мат+1114 КА) — живой ВСЖМ-индекс не тронут; _load_estimates/_load_ka грузят оба; find_in_real_estimates отдаёт norm_base/price_level; _search_corpus предупреждает «не смешивай базы/уровни цен». Попутно: gge_deep KA-регион fallback, corpus_anon +паттерн ИНН в underscore. Все тесты (юнит mutation-safe + real-data) зелёные, регресс ВСЖМ цел. APP_VERSION→2026-07-16a. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+11
-1
@@ -67,6 +67,13 @@ def _load_estimates() -> dict:
|
||||
p = _DATA / "estimates_index.json"
|
||||
_est_cache = json.loads(p.read_text(encoding="utf-8")) if p.exists() else {"items": []}
|
||||
items = _est_cache["items"]
|
||||
# Ext-индекс (новые домены: .gge ДВ / .gsfx / .arp ОСНБЖ) — ОТДЕЛЬНЫЙ файл,
|
||||
# живой ВСЖМ-индекс не трогаем. Каждая ext-запись несёт norm_base/price_level.
|
||||
ext_p = _DATA / "estimates_ext_index.json"
|
||||
if ext_p.exists():
|
||||
ext = json.loads(ext_p.read_text(encoding="utf-8"))
|
||||
items.extend(ext.get("items", []))
|
||||
_est_cache.setdefault("materials", []).extend(ext.get("materials", []))
|
||||
df: dict[str, int] = {}
|
||||
for it in items:
|
||||
it["_terms"] = _terms(it["name"])
|
||||
@@ -108,6 +115,9 @@ def _load_ka() -> dict:
|
||||
if _ka_cache is None:
|
||||
p = _DATA / "ka_index.json"
|
||||
_ka_cache = json.loads(p.read_text(encoding="utf-8")) if p.exists() else {"items": []}
|
||||
ext_p = _DATA / "estimates_ext_index.json"
|
||||
if ext_p.exists():
|
||||
_ka_cache["items"].extend(json.loads(ext_p.read_text(encoding="utf-8")).get("ka", []))
|
||||
df: dict[str, int] = {}
|
||||
for it in _ka_cache["items"]:
|
||||
it["_terms"] = _terms(it["name"])
|
||||
@@ -162,7 +172,7 @@ def find_in_real_estimates(query: str, top_k: int = 5) -> list[dict]:
|
||||
keys = ("code", "name", "unit", "prefix", "kind", "freq", "norm_sets", "regions",
|
||||
"qty", "comment", "unit_cost_cur", "fot_unit", "cost_structure", "labor_ch",
|
||||
"machinist_ch", "price_base", "price_cur", "overhead", "profit",
|
||||
"coef_applications", "resources", "examples")
|
||||
"coef_applications", "resources", "examples", "norm_base", "price_level")
|
||||
out = []
|
||||
for _, _, it in results[:top_k]:
|
||||
d = {k: it.get(k) for k in keys}
|
||||
|
||||
Reference in New Issue
Block a user