Appearance
entity-aggregation-config schema
One config row for the generic engine-entity.aggregation-sweep job — fold count/sum/avg/min/max across a source entity and upsert the result into a target entity.
Pull the full JSON Schema: erp schema pull entity-aggregation-config · MCP: erp_get_schema {"name":"entity-aggregation-config"}
Top-level properties
| Property | Type | Required | Notes |
|---|---|---|---|
sweep_code | string | yes | Stable identifier / natural key for idempotent seeding. |
source_entity | string | yes | |
filter_field | string | Optional single-column equality pre-filter. | |
filter_value | string | ||
when_status_in | string | Optional comma-separated status filter. | |
status_field | string | ||
date_field | string | Optional date pre-filter column. | |
date_compare_op | string | one of: lte, lt, gte, gt | |
day_offset | integer | ||
aggregation | string | yes | one of: count, sum, avg, min, max |
agg_field | string | Required for sum/avg/min/max; the numeric column to fold. | |
group_by_field | string | Optional; one result bucket per distinct value. | |
target_entity | string | yes | |
target_key_field | string | yes | Column on target_entity that holds the bucket key (a declared field). Special value "id": the bucket key IS a row's own primary key — the fold is written straight back onto target_entity row #<key> (never a create). Use with group_by_field yielding the parent id (e.g. maintenance_id), target_entity = that parent entity, and a blank target_key_prefix — this is the true 'roll child lines up onto the parent record' form (MaintenanceCostSyncJob). |
target_key_prefix | string | Prepended to the bucket key when writing (so multiple configs can share one summary entity without collisions). | |
result_key | string | Used as the bucket key when group_by_field is blank; defaults to sweep_code. | |
target_value_field | string | yes | |
target_timestamp_field | string | Optional; now written here on each run. | |
target_extra_json | object | Optional static fields set only when a target row is first created. | |
seeded_by | string | ||
active | boolean | yes |