Aller au contenu principal

Aggregator

Category: Control
Node id: aggregator

Performs aggregation operations on arrays: count, sum, average, min, max, group, distinct

What it does​

  • Seven aggregation types: count, sum, average, min, max, group, distinct
  • Group-by with per-group counts and unique value tracking
  • Min/max with full item retrieval (not just the value)
  • Distinct value extraction with deduplication

Use cases​

  • Summarize patient encounter counts by department
  • Calculate average lab values across a cohort
  • Group FHIR resources by type for batch processing

Runtime​

  • Performance tier: fast

Input ports​

NameTypeRequiredDescription
datajsonYesArray of objects to aggregate

Output ports​

NameTypeRequiredDescription
resultjsonNoAggregation result: count, sum, average, min/max with item, groups, or distinct values depending on aggregation_type
successbooleanNoWhether the aggregation completed without error

Settings​

Basic​

SettingNameTypeRequiredDefaultAllowed valuesDescription
Aggregation Typeaggregation_typeenumNocountcount, sum, average, avg, min, max, group, distinctType of aggregation to perform
FieldfieldstringNoField to aggregate (required for sum, average, min, max, distinct)
Group Bygroup_bystringNoField to group by (required for group aggregation)

Errors​

CodeDescription
MISSING_FIELDField config is required for sum, average, min, max, and distinct aggregations
INVALID_DATAInput data is not an array of objects
UNSUPPORTED_AGGREGATIONThe specified aggregation_type is not recognized

Runtime notes​

  • The result shape changes entirely based on aggregation_type — count returns {count}, sum returns {sum,field,count}, group returns {groups,group_counts,...}, etc.
  • For min/max, result includes min_item/max_item containing the FULL original object, not just the field value.
  • Items with missing or non-numeric field values are silently skipped in sum/average/min/max — check result.count to see how many were actually aggregated.
  • For an empty input array, the node returns {count:0} regardless of aggregation_type.

See Build any workflow for how to put nodes together and Ports, types and data flow for how port types connect.

Quelque chose n'est pas clair ? Envoyez vos commentaires sur la documentation par courriel.