fix(1c): harden company telemetry rollout
This commit is contained in:
@@ -131,6 +131,7 @@ python ai/company_intelligence_api.py --host 127.0.0.1 --port 8710
|
||||
|
||||
- выгрузки 1С по документам;
|
||||
- выгрузки движений/проводок;
|
||||
- read-only `companies` snapshot по файловым базам;
|
||||
- журнал регистрации 1С;
|
||||
- audit/export критичных изменений;
|
||||
- host telemetry с Windows/RDP host.
|
||||
@@ -138,6 +139,18 @@ python ai/company_intelligence_api.py --host 127.0.0.1 --port 8710
|
||||
наполняется read-only telemetry слоем как `counterparty = infobase`, а
|
||||
`amount` используется как интегральный `activity score`.
|
||||
|
||||
Отдельно:
|
||||
|
||||
- `companies` хранит текущую карту файловых баз:
|
||||
- `owner_user`
|
||||
- `base_path`
|
||||
- `db_size_bytes`
|
||||
- `reglog_size_bytes`
|
||||
- `active_locks`
|
||||
- `temp_db_present`
|
||||
- `scheduler_touched`
|
||||
- `activity_score`
|
||||
|
||||
## Границы
|
||||
|
||||
- AI Investigator не пишет в 1С;
|
||||
|
||||
@@ -122,7 +122,7 @@ def company_summary(counterparty: str, infobase: str | None = None) -> dict[str,
|
||||
SELECT *
|
||||
FROM analytics_1c.v_company_portfolio_overview
|
||||
WHERE {' AND '.join(filters)}
|
||||
ORDER BY amount_30d DESC
|
||||
ORDER BY last_company_snapshot_at DESC, amount_30d DESC
|
||||
LIMIT 1
|
||||
"""
|
||||
rows = rows_to_dict(client.query(sql))
|
||||
@@ -144,10 +144,11 @@ def company_summary(counterparty: str, infobase: str | None = None) -> dict[str,
|
||||
ORDER BY score DESC, generated_at DESC
|
||||
"""
|
||||
timeline_sql = f"""
|
||||
SELECT ts, infobase, company_name, owner_user, current_status, db_size_bytes, reglog_size_bytes, active_locks, current_activity_score
|
||||
SELECT last_company_snapshot_at AS ts, infobase, company_name, owner_user, current_status, db_size_bytes, reglog_size_bytes, active_locks, current_activity_score
|
||||
FROM analytics_1c.v_company_portfolio_overview
|
||||
WHERE counterparty = {q(counterparty)}
|
||||
{"AND infobase = " + q(infobase) if infobase else ""}
|
||||
ORDER BY ts DESC
|
||||
LIMIT 1
|
||||
"""
|
||||
forecasts = rows_to_dict(client.query(forecast_sql))
|
||||
|
||||
Reference in New Issue
Block a user