| KPI | A named, instance-scoped business metric. Has a stable key, multilingual labels, a unit, and a value type. |
key | Stable snake_case identifier. Used in URLs and as the lookup id from KPI cards. Never rename — it would break consumers. |
labels | {"de": "…", "en": "…"} map. en is required. |
unit | Display unit string: count, EUR, %, days, etc. Free-form. |
value_type | Format hint for renderers: number, currency, percent, duration. |
group | Optional grouping label (e.g. customer_service, finance). |
active | Visibility flag. Inactive KPIs are filtered out of default lists but stay readable by key. |
current.value | The latest value written. |
current.previous_value | Previous-period value for Co-Pilot KPIs with trend (value_source != push + output_shape=value_with_trend). Enables Δ% display in the KPI card. |
current.as_of | The business timestamp the value refers to (defaults to write time). |
current.updated_at | The write timestamp itself. |
value_source | Where the value comes from: push (manual / agent), live (Co-Pilot SQL, every read hits the ERP) or cached (cached, TTL via cache_ttl_seconds). Default push. |
report_id | Linked Xentral analytics report (only for non-push sources). Cleaned up automatically on delete. |
prompt / sql_string | Audit fields on Co-Pilot KPIs: the original natural-language prompt + the SQL it generated. |
track_history | Bool, only meaningful on derived KPIs. Default false (no timeline). When true the live resolver appends a row on every value change — push KPIs ignore the flag because they already write history on every set_value. |
| history | Append-only log of values written, sharded by YYYY-MM. Push KPIs: every set_value call. Derived KPIs: only when track_history=true AND the newly resolved value differs from the last entry (dedup against spammy reads). Otherwise empty — the value is computed at read time from the report with no timeline. |