analytics/context/01_DATA_RULES.md
2026-02-18 14:36:38 +03:00

19 lines
931 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Data Rules
## Идентификаторы 1С (схема analytics)
- **`*_1c_id`** — бинарный ключ 1С (`BINARY(16)`), ссылка на `_IDRRef` справочника/документа.
- **`*_id`** — строковый id (GUID в формате `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`) для API, поиска, отображения.
Пример: `contractor_1c_id` (binary) в таблице, `contractor_id` (nvarchar) в представлении для выдачи во внешние системы.
---
- Stock quantity = field 'quantity' only.
- Never use 'sellable_stock' in stock calculations.
- Marketplace (MP) stock is calculated separately and added if needed.
- Orders with statuses:
'В пути', 'В производстве', 'Выгружен на складе', 'Согласован'
are treated as incoming stock.
- Use date intervals as [start, end) when aggregating.