Skip to content

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

PropertyTypeRequiredNotes
sweep_codestringyesStable identifier / natural key for idempotent seeding.
source_entitystringyes
filter_fieldstringOptional single-column equality pre-filter.
filter_valuestring
when_status_instringOptional comma-separated status filter.
status_fieldstring
date_fieldstringOptional date pre-filter column.
date_compare_opstringone of: lte, lt, gte, gt
day_offsetinteger
aggregationstringyesone of: count, sum, avg, min, max
agg_fieldstringRequired for sum/avg/min/max; the numeric column to fold.
group_by_fieldstringOptional; one result bucket per distinct value.
target_entitystringyes
target_key_fieldstringyesColumn 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_prefixstringPrepended to the bucket key when writing (so multiple configs can share one summary entity without collisions).
result_keystringUsed as the bucket key when group_by_field is blank; defaults to sweep_code.
target_value_fieldstringyes
target_timestamp_fieldstringOptional; now written here on each run.
target_extra_jsonobjectOptional static fields set only when a target row is first created.
seeded_bystring
activebooleanyes