[COMBINE] Строгое разделение VCS/телефония, solution_class/sales_scope, прототип analog engine
This commit is contained in:
1 parent
9c2d8f0d7f
commit
78f0ee3ff5
8 files changed
+1501
-1
No files matched your search
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Прототип analog engine: аналоги только внутри domain + solution_class.
|
||||
|
||||
SIP не является доменом. Для VCS-бара нельзя вернуть SIP-телефон.
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
P = "/root/buryan-infra/ops/combine/catalog-p0-2026-11-18.yaml"
|
||||
D = yaml.safe_load(open(P, encoding="utf-8"))["devices"]
|
||||
|
||||
|
||||
def score(target, x):
|
||||
s = 0
|
||||
why = []
|
||||
if x["domain"] == target["domain"]:
|
||||
s += 20
|
||||
if x["solution_class"] == target["solution_class"]:
|
||||
s += 50
|
||||
why.append("same solution_class")
|
||||
if x.get("form_factor") == target.get("form_factor"):
|
||||
s += 10
|
||||
why.append("same form_factor")
|
||||
tp = {p.upper() for p in target.get("protocols") or []}
|
||||
xp = {p.upper() for p in x.get("protocols") or []}
|
||||
if tp and xp & tp:
|
||||
s += 10
|
||||
why.append("protocol overlap")
|
||||
if x.get("sales_scope") == "alternative":
|
||||
s += 5
|
||||
why.append("alternative vendor")
|
||||
return s, why
|
||||
|
||||
|
||||
def find(model):
|
||||
q = model.lower().strip()
|
||||
for x in D:
|
||||
if x["model"].lower() == q or x.get("id", "").lower() == q:
|
||||
return x
|
||||
for x in D:
|
||||
if q in x["model"].lower():
|
||||
return x
|
||||
return None
|
||||
|
||||
|
||||
def analogs(model, limit=8):
|
||||
t = find(model)
|
||||
if not t:
|
||||
return {"error": "not_found", "query": model}
|
||||
cand = []
|
||||
for x in D:
|
||||
if x is t or x["vendor"] == t["vendor"]:
|
||||
continue
|
||||
# строгий барьер: только тот же домен и тот же класс
|
||||
if x["domain"] != t["domain"] or x["solution_class"] != t["solution_class"]:
|
||||
continue
|
||||
s, why = score(t, x)
|
||||
cand.append({"id": x["id"], "vendor": x["vendor"], "model": x["model"],
|
||||
"solution_class": x["solution_class"], "sales_scope": x.get("sales_scope"),
|
||||
"protocols": x.get("protocols") or [], "score": s,
|
||||
"why": why})
|
||||
cand.sort(key=lambda z: (-z["score"], z["vendor"], z["model"]))
|
||||
return {"target": {"id": t["id"], "vendor": t["vendor"], "model": t["model"],
|
||||
"domain": t["domain"], "solution_class": t["solution_class"],
|
||||
"sales_scope": t.get("sales_scope"), "protocols": t.get("protocols") or []},
|
||||
"alternatives": cand[:limit],
|
||||
"note": "Аналоги только внутри domain+solution_class; телефония не предлагается для VCS."}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("model")
|
||||
ap.add_argument("--json", action="store_true")
|
||||
a = ap.parse_args()
|
||||
r = analogs(a.model)
|
||||
if a.json:
|
||||
print(json.dumps(r, ensure_ascii=False, indent=2))
|
||||
else:
|
||||
if "error" in r:
|
||||
print("не найдено:", a.model)
|
||||
sys.exit(2)
|
||||
t = r["target"]
|
||||
print("Цель: %s — %s (%s, %s, %s)" % (t["vendor"], t["model"], t["domain"], t["solution_class"], t["sales_scope"]))
|
||||
print("Аналоги:")
|
||||
for x in r["alternatives"]:
|
||||
print("- %-10s %-32s score=%d %s" % (x["vendor"], x["model"], x["score"], ", ".join(x["why"])))
|
||||
if not r["alternatives"]:
|
||||
print("- нет альтернатив в базе")
|
||||
@@ -14,6 +14,7 @@ FILES = [
|
||||
("P0.5 применено", "/root/buryan-infra/ops/combine/P0-APPLIED-ATTRS-2026-11-18.md"),
|
||||
("P0.6 retry-очередь", "/root/buryan-infra/ops/combine/P0-RETRY-QUEUE-2026-11-18.md"),
|
||||
("Модели других вендоров", "/root/buryan-infra/ops/combine/VENDORS-OTHER-REPORT-2026-11-18.md"),
|
||||
("Стратегия аналогов", "/root/buryan-infra/ops/combine/COMBINE-ANALOGS-STRATEGY.md"),
|
||||
("P0.7 мусорные факты", "/root/buryan-infra/ops/combine/P0-JUNK-REPORT-2026-11-18.md"),
|
||||
("Нормализация каталога", "/root/buryan-infra/ops/combine/NORMALIZATION-REPORT-2026-11-18.md"),
|
||||
("Стратегия Комбайна", "/root/buryan-infra/ops/combine/STRATEGY-2026-11-18.md"),
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Разметка stage: domain / solution_class / sales_scope / sip_context.
|
||||
|
||||
SIP — протокол. Домен определяет сценарий:
|
||||
vcs — переговорная/commercial video
|
||||
telephony — SIP-телефоны, DECT, гарнитуры (reference, не наш sales line)
|
||||
"""
|
||||
import re
|
||||
import yaml
|
||||
from collections import Counter
|
||||
|
||||
P = "/root/buryan-infra/ops/combine/catalog-p0-2026-11-18.yaml"
|
||||
R = "/root/buryan-infra/ops/combine/P0-SOLUTION-CLASSES-2026-11-18.md"
|
||||
d = yaml.safe_load(open(P, encoding="utf-8"))
|
||||
devs = d["devices"]
|
||||
|
||||
|
||||
def cls(x):
|
||||
n = (x.get("model") or "").lower()
|
||||
dom = x.get("domain") or "vcs"
|
||||
grp = x.get("group") or ""
|
||||
role = x.get("role") or ""
|
||||
if dom == "telephony":
|
||||
if n.startswith(("sip-t", "t3", "t4", "t5", "t7", "t8", "vp", "mp")):
|
||||
return "telephony.sip.desk"
|
||||
if n.startswith("cp"):
|
||||
return "telephony.sip.conference"
|
||||
if any(k in n for k in ("w70", "w80", "dect", "w53", "w56", "w57", "w59", "w73", "w76", "w77", "w78", "w79")):
|
||||
return "telephony.dect"
|
||||
if any(k in n for k in ("uh", "bh", "ehs", "wh", "yhs")):
|
||||
return "telephony.headset"
|
||||
return "telephony.accessory"
|
||||
if any(k in n for k in ("uvc", "smartvision", "mb-cam", "cam50")):
|
||||
return "vcs.camera.ptz" if "ptz" in n else "vcs.camera.usb"
|
||||
if grp == "A_integration_terminals":
|
||||
if n.startswith("mvc"):
|
||||
return "vcs.kit.room"
|
||||
if any(k in n for k in ("mini-pc", "room compute", "conferencing pc")):
|
||||
return "vcs.pc"
|
||||
return "vcs.terminal.room"
|
||||
if grp == "B_video_bars":
|
||||
if "meetingboard" in n or "hiboard" in n:
|
||||
return "vcs.board"
|
||||
if any(k in n for k in ("a10", "a20", "a25", "v12", "p15", "bcc950", "connect")):
|
||||
return "vcs.bar.compact"
|
||||
return "vcs.bar.room"
|
||||
if grp == "D_usb_byod":
|
||||
if any(k in n for k in ("ptz", "e60", "rally camera", "sight", "scribe")):
|
||||
return "vcs.camera.ptz" if "ptz" in n else "vcs.camera.usb"
|
||||
if any(k in n for k in ("vch", "wpp", "swytch", "byod")):
|
||||
return "vcs.sharing"
|
||||
if "camera" in role or any(k in n for k in ("uvc", "xc", "uc3", "uc4", "uc5", "cam")):
|
||||
return "vcs.camera.usb"
|
||||
return "vcs.accessory"
|
||||
if grp == "E_audio":
|
||||
return "vcs.audio"
|
||||
if grp == "E_control":
|
||||
return "vcs.control.touch"
|
||||
if grp == "E_display":
|
||||
return "passive.display"
|
||||
if grp == "E_mount":
|
||||
return "passive.mount"
|
||||
if grp == "E_power":
|
||||
return "passive.power"
|
||||
if grp == "E_infra":
|
||||
return "infrastructure.network"
|
||||
return "vcs.accessory"
|
||||
|
||||
|
||||
for x in devs:
|
||||
x["solution_class"] = cls(x)
|
||||
x["analog_group"] = x["solution_class"]
|
||||
if x.get("domain") == "telephony":
|
||||
x["sales_scope"] = "reference"
|
||||
elif x.get("vendor") == "yealink":
|
||||
x["sales_scope"] = "own"
|
||||
else:
|
||||
x["sales_scope"] = "alternative"
|
||||
prots = [p.upper() for p in (x.get("protocols") or [])]
|
||||
if "SIP" in prots:
|
||||
x["sip_context"] = "telephony_endpoint" if x.get("domain") == "telephony" else "vcs_endpoint"
|
||||
else:
|
||||
x["sip_context"] = "none"
|
||||
|
||||
yaml.safe_dump(d, open(P, "w", encoding="utf-8"), allow_unicode=True, sort_keys=False)
|
||||
c = Counter(x["solution_class"] for x in devs)
|
||||
s = Counter(x["sales_scope"] for x in devs)
|
||||
lines = ["# P0 — solution_class / sales_scope", "",
|
||||
"SIP — протокол, не домен. `domain` и `solution_class` строго разделяют VCS и телефонию.", "",
|
||||
"| solution_class | Кол-во |", "|---|---|"]
|
||||
for k, n in c.most_common():
|
||||
lines.append("| %s | %d |" % (k, n))
|
||||
lines += ["", "| sales_scope | Кол-во |", "|---|---|"]
|
||||
for k, n in s.most_common():
|
||||
lines.append("| %s | %d |" % (k, n))
|
||||
lines += ["", "`own` — Yealink VCS; `alternative` — другие VCS-вендоры; `reference` — телефония (не наш sales line)."]
|
||||
open(R, "w", encoding="utf-8").write("\n".join(lines) + "\n")
|
||||
print("classified", len(devs), "classes", len(c), "scopes", dict(s))
|
||||
Reference in new issue
Block a user