How to use `ESDataFlowEvent`


I found this type, but couldn’t find any documentation or examples. How is it supposed to be used.

I am trying to see if I can use it for my use case: Triggering analytic based on a condition being met.


@rohit.sureka or @JohnCoker Do you know anything about this type?


Yeah. This needs more documentation. It is for triggering analytic when condition defined on ESDataFlowEvent is met for the given source. here is sample of test case we have to give you an idea.

 entity type TestFacility mixes MetricEvaluatable schema name 'ACTEST_FACILITY'

     condition='meters.meterEvents.timestamp >= date($start) && meters.meterEvents.timestamp < date($end)')
type FacilityThirtyDayAllEvents mixes ESDataFlowEvent<TestFacility>

@DFE(period='30d', interval='hour', frequency='day')
type FacilityThirtyDayHourlyElectricConsumptionAndEvents mixes mixes CompoundDataFlowEvent<TestFacility> {

  electric: FacilityThirtyDayHourlyElectricConsumption
  events: FacilityThirtyDayAllEvents

type TestAppAnalytic mixes Analytic<FacilityThirtyDayHourlyElectricConsumptionAndEvents, Result> {
  process:     ~ js server
  loadContext: ~ js server
TestAppAnalytic.js {@
function loadContext(source) {
   return Double.make({ value: 2 + Math.random() });

function process(input, context) {
   if (!input.source || !input.source.type().isA('TestFacility')) {
       throw new Error("compound DFE 'beta' missing/invalid source");
   if (!input.electric || ! {
       throw new Error("compound DFE 'beta' missing embedded DFE object(s)");

   // construct the analytic result
   var beta = context.value;
   return TestAppBetaAnalyticResult.make({
      beta : beta,
      details: 'β = ' + beta.toFixed(3)