Filtering in QPR ProcessAnalyzer Queries: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
No edit summary
 
(162 intermediate revisions by 2 users not shown)
Line 1: Line 1:
QPR ProcessAnalyzer analysis requests have parameter '''Filter''' which can be used to pass filter definition for the analysis. The filter is defined using a JSON format. This filter definition is combined with the stored filter object, which id is provided as the '''FilterId''' parameter.
QPR ProcessAnalyzer queries for models data can be ''filtered'' to include only selected cases or events to the calculation. The expression query have the parameter '''Filter''' to pass a filter definition. The Root cause analysis has also the parameter '''Comparison''' which divides the analyzed data into two groups to compare them in the analysis. The Comparison parameter has the same structure as in the Filter parameter.


nfluence analyses have also parameter '''Comparison''' which divides the analyzed data into two parts to compare them in the analysis. Comparison parameter has the same JSON syntax as in the Filter parameter.
If a filter (or comparison) refers to information that doesn't exist in the model, e.g. non-existing event type names or case attribute values, the non-existing values are ignored. Still, if the [[#Case_attribute_values|CaseAttributeValue]] or [[#Event_attribute_values|EventAttributeValue]] filter refers to an attribute name that doesn't exist, an error is given.


Filter and Comparison parameters are only supported only by the In-Memory core and server connections to servers that internally use In-Memory core.
== Filter and Comparison parameters ==
The filter definition has syntax demonstrated by the following example:


When performing analyses, different filter specifications are applied in the following order (from first to last):
# Filter rules defined by a stored filter (identified by '''FilterId''' parameter).
# Filter rules defined by the '''Filter''' parameter.
# Additional selection related parameters, such as '''SelectedActivities''' or '''SelectedTransitions'''.
== Filter parameter JSON syntax ==
The filter definition is a JSON object, which has a property '''Items'''. The Items property is an array of objects, which have '''Type''' property and possibly other properties. The type property defined, which kind of filter rule it is. All filter rule types are listed in the following chapters. Example:
<pre>
<pre>
{
{
   Items: [
   Items: [
     {
     {
       Type: "ExcludeCases",
       Type: "IncludeCases",
       Items: [
       Items: [
         {
         {
           Type: "Case",
           Type: "EventType",
           Values: ["c1", "c3"]
           Values: ["Sales Order Created", "Payment Received"]
        },
        {
          Type: "CaseAttributeValue",
          Attribute: "Region",
          Values: ["Dallas", "Austin"]
         }
         }
       ]
       ]
     },
     },
     {
     {
       Type: "ClearFilters",
       Type: "ExcludeCases",
      TargetObjectType: "Case"
    },
    {
      Type: "IncludeCases",
       Items: [
       Items: [
         {
         {
           Type: "Case",
           Type: "Case",
           Values: ["c1"]
           Values: ["Case1", "Case2", "Case3"]
        },
        {
          Type: "flow",
          Values: [
            {
              From: "Shipment",
              To: "Invoice"
            }
          ]
         }
         }
       ]
       ]
Line 42: Line 45:
</pre>
</pre>


=== Case ===
The outmost object has a property '''Items''' which is an array of object with following properties:
Filter rule type '''Case''' selects individual cases. It supports property '''Values''' which is an array of case names (strings).
* '''Type''': Specifies the type of the filtering operation with following options:
** '''IncludeCases''' / '''ExcludeCases''': Includes / excludes cases. All filter rule types can be used with this option.
** '''IncludeEvents''' / '''ExcludeEvents''': Includes / excludes events. Only ''Attribute'' filter rule types can be used with this option.
** '''IncludeEventTypes''' / '''ExcludeEventTypes''': Includes / excludes events based on the event type. Only ''Event type'' and ''Expression'' filter rule types can be used with this option.
* '''Disabled''': (boolean) Defines whether the filter rule is applied or not. This is used by the UI to temporarily disable filter rule without removing them.
 
The following chapters list different filter rule types that can be used in the above defined '''Items''' property.
 
== Filter Rule Types ==
=== Expression ===
Filter rule type '''ExpressionValue''' (for in-memory calculation) or '''SqlExpressionValue''' (for dataframe calculation) selects cases or events that match the given expression. There is property '''Configuration''' which has properties:
* '''Root''': The root expression returning objects that are used to evaluate the ''Expressions'' (see below). If not defined, all the cases in the current event log are used as root objects. The root expression should return following types of objects: (1) for case filters: cases, events, event types, flows or flow occurrences, (2) for event filters: events and (3) for event type filters: event types. The expressions are typically what can be used as chart dimension expressions.
* '''Expressions''': Array of expressions specifying the filter rules. There is the AND logic between the filter rules, so all expressions need to match for the objects to come to the filter. Properties:
** '''Expression''': When filter rule type is ''ExpressionValue'', specifies an eventlog based expression that is evaluated for each root object. When filter rule type is ''SqlExpressionValue'', specifies an SQL expression that is evaluated for each root object.
** '''Values''': Array of values to match to the expression result. Suitable only for strings, numeric and boolean values.
** '''StringifiedValues''': Array of values to match to the expression result, and the values are defined in the [[Stringified_Value_Format|stringified format]]. This has a better support for different data types than in the Values property.
** '''NumberPrecision''': Similar setting as the [[Web_API:_Expression/query#Dimensions|expression analysis dimensions]] have to round numerical type of result of the expression.
** '''DatetimeTruncation''': Similar setting as the [[Web_API:_Expression/query#Dimensions|expression analysis dimensions]] have to round date type of result of the expression.
** '''TimespanPrecision''': Similar setting as the [[Web_API:_Expression/query#Dimensions|expression analysis dimensions]] have to round timespan type of result of the expression. Supported only for expression type ''ExpressionValue''.
** '''Comparison''': Defines type of comparison operation among the following: '''equal''' (default), '''notequal''', '''greaterthan''', '''lessthan''', '''greaterthanorequal''' and '''lessthanorequal'''. When comparison is ''equal'' or ''notequal'', several values can be specified. For other comparison types, there must only be one value. The lower and greater than comparisons work with numbers, datatimes and timespans. In the lower and greater than comparisons, ''null'' values in both sides of the comparison result in a non-match. Rounding or truncation defined by the NumberPrecision, DateTimeTruncation or TimespanPrecision are done before comparison, so do not use them if comparison should be based on the original values.
** '''Columns''': For SqlExpressionValue type, additional calculated columns that can be used in the main expression. Defined as an array of objects with following properties:
*** '''Name''': Column name.
*** '''Expression''': Column expression. In the expression, it's possible to refer to the previous columns.
* '''Variables''': Object specifying key-value pairs, where each pair creates a variable into the expression context where key is the name of the variable and value is its value. The values will be converted to strings. Supported only for expression type ''ExpressionValue''.
 
Examples:


Example:
Select cases named "case1" and "case2".
<pre>
<pre>
{
{
   Type: "Case",
   Type: "ExpressionValue",
   Values: ["case1", "case2", "case3"]
   Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "Name",
        Values: ["case1", "case2"]
      }
    ]
  }
}
}
</pre>
</pre>


=== CaseAttributeTrend ===
Cases where duration is as rounded 3 or 4 days.
Filter rule type '''CaseAttributeTrend''' selects cases having given value in given case attribute at a specific time. Supports the following additional properties:
* '''Attribute''': Name of the case attribute.
* '''TimeStampType''': Specifies how timestamp is calculated for a case. Supported values are: '''CaseStartTime''' (default), '''CaseEndTime''', '''FirstEventTypeOccurrence''' and '''CaseCustomAttributeValue'''
* '''TimeStampCaseAttribute''': Name of the attribute whose value is used as the timestamp of the case.
* '''PeriodLevel''': Specifies the group granularity for the timestamps. Supported values are: '''Day''' (default), '''Week''', '''Month''', '''Quarter''', '''Year'''.
* '''StartDate''': Specifies the start date from which the indexing is started. Defaults to the current date.
* '''Trends''': Specifies the selected value+time combinations. An array of '''TrendRow''' objects.
 
Example:
<pre>
<pre>
{
{
   Type: "CaseAttributeTrend",
   Type: "ExpressionValue",
   Attribute: "Region",
   Configuration: {
  PeriodLevel: "Day",
    Root: "Cases",
  StartDate: "2012-01-01",
    Expressions: [
  TimeStampType: "CaseStartTime",
      {
  Trends: [
        Expression: "Duration.TotalDays",
    {
        NumberPrecision: 0,
      Value: "Dallas",
        StringifiedValues: ["43", "44"]
       Offsets: [1]
       }
     }
     ]
   ]
   }
}
}
</pre>
</pre>


=== CaseAttributeValue ===
Cases where duration is as rounded 3 or 4 days.
Selection item type '''CaseAttributeValue''' selects cases having given value in given case attribute. Supports the following additional properties:
* '''Attribute''': Name of the case attribute.
* '''Values''': An array of case attribute values in string format.
 
Example:
<pre>
<pre>
{
{
   Type: "CaseAttributeValue",
   Type: "ExpressionValue",
   Attribute: "Region",
   Configuration: {
  Values: ["Dallas"]
    Root: "Cases",
    Expressions: [
      {
        Expression: "Duration",
        TimespanPrecision: "day",
        StringifiedValues: ["73.00:00:00.000", "74.00:00:00.000"]
      }
    ]
  }
}
}
</pre>
</pre>


=== Duration ===
Cases that have started in October or November 2020.
 
Selection item type '''Duration''' selects cases or flows having any of the selected durations. Supports the following additional properties:
* '''Durations''': An array of duration group indexes (integers).
* '''DurationGranularity''': Number of seconds each group index represents. Defaults to one day (60 * 60 * 24).
* '''DurationMaximum''': Maximum duration group index. Any duration longer than the duration represented by the maximum index will be put into the duration group of the maximum index. Defaults to 100.
* '''FocusFlow''' If flow duration is being selected, identifies the flow whose duration is measured. A '''FlowItem''' object.
 
Example:
<pre>
<pre>
{
{
   Type: "Duration",
   Type: "ExpressionValue",
   Durations: [50],
   Configuration: {
  Granularity: 60,
    Root: "Cases",
  MaximumDuration: 50,
    Expressions: [
  FocusFlow: { From: "et1", To: "et2" }
      {
        Expression: "StartTime",
        DatetimeTruncation: "month",
        StringifiedValues: ["22020-10-01T00:00:00.000", "22020-11-01T00:00:00.000"]
      }
    ]
  }
}
}
</pre>
</pre>


=== EventAttributeTrend ===
Selects cases whose duration is longer than one day.
Selection item '''EventAttributeTrend''' selects cases having at least one event having given value in given event attribute at a specific time. Supports the following additional properties:
* '''Attribute''': Name of the event attribute.
* '''PeriodLevel''': Specifies the group granularity for the timestamps. Supported values are: '''Day''' (default), '''Week''', '''Month''', '''Quarter''', '''Year'''
* '''StartDate''': Specifies the start date from which the indexing is started. Defaults to the current date.
* '''Trends''': Specifies the selected value+time combinations. An array of '''TrendRow''' objects.
 
Example:
<pre>
<pre>
{
{
   Type: "EventAttributeTrend",
   Type: "ExpressionValue",
   Attribute: "Unit",
   Configuration: {
  PeriodLevel: "Day",
    Root: "Cases.Where(Duration.TotalDays > 1)"
  StartDate: "2012-01-01",
   }
   Trends: [
    {
      Value: "UnitA",
      Offsets: [9]
    }
  ]
}
}
</pre>
</pre>


Example selection:
Same as previous using the ''Comparison'' property:
 
Any model, any data source type:
<pre>
Selection={
  items: [
    { // Selection
      type: "includeonly",
      items: [
        { // Selection item
          type: "eventtype",
          values: ["Handling unit", "Shipment"]
        },
        {
          type: "flow",
          values: [
            {
              from: "Shipment",
              to: "Invoice"
            }
          ]
        }
      ]
    },
    {
      type: "includeonly",
      items: [
        {
          type: "caseattributevalue",
          attribute: "Region",
          values: ["Dallas"]
        }
      ]
    },
    {
      type: "includeonly",
      items: [
        {
          type: "duration",
          granularity: 3600
          values: [1, 2]
        }
      ]
    }},
    {
      type: "expression",
      "Root": "Cases",
      "Expressions": [
        {
          "Expression": "Color",
          "Values": ["Red"]
        }
      ]
    }
  ]
}
</pre>
 
=== EventAttributeValue ===
Selection item type '''EventAttributeValue''' selects events having given value in given event attribute. Supports the following additional properties:
* '''Attribute''': Name of the event attribute.
* '''Values''': An array of event attribute values in string format.
 
Example:
<pre>
<pre>
{
{
   Type: "EventAttributeValue",
   Type: "ExpressionValue",
   Attribute: "Unit",
   Configuration: {
  Values: ["UnitA"]
    Root: "Cases",
    Expressions: [
      {
        Expression: "Duration.TotalDays",
        Comparison: "greaterthan",
        Values: [1]
      }
    ]
  }
}
}
</pre>
</pre>


=== EventType ===
All Cases that have started before year 2020:
Selection item type '''EventType''' selects individual event types. Supports the following additional property '''Values'''  which is an array of event type names (strings).
 
Example:
<pre>
<pre>
{
{
   Type: "EventType",
   Type: "ExpressionValue",
   Values: ["et1", "et3", "et5"]
   Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "StartTime",
        Comparison: "lessthan",
        StringifiedValues: ["22020-01-01T00:00:00.000"]
      }
    ]
  }
}
}
</pre>
</pre>


=== EventTypeTrend ===
Returns all cases that are conformant with the specified BPNM model.
Selects cases having at least one event occurrence of given event type at a specific time. Supports the following additional properties:
* '''PeriodLevel''': Specifies the group granularity for the timestamps. Supported values are '''Day''' (default), '''Week''', '''Month''', '''Quarter''', '''Year'''.
* '''StartDate''': Specifies the start date from which the indexing is started. Defaults to the current date.
* '''Trends''': Specifies the selected value+time combinations. An array of '''TrendRow''' objects.
 
Example:
<pre>
<pre>
{
{
   Type: "EventTypeTrend",
   Type: "ExpressionValue",
   PeriodLevel: "Day",
   Configuration: {
  StartDate: "2012-01-01",
    Variables: {
  Trends: [
      bpmnXml: "<XML BPMN model>"
     {
    },
      Value: "Shipment",
     Root: "Let(\"myConformanceModel\", DesignModelFromXml(bpmnXml));Cases.Where(IsConformant(myConformanceModel));"
      Offsets: [3]
  }
    }
  ]
}
}
</pre>
</pre>


=== ExpressionValue ===
Pass date values as ticks and convert them into date objects (that are used in the actual comparison).
'''ExpressionValue''' type selects cases that match the given expression. It supports property '''Configuration''' which is an object containing the following properties:
# '''Root''': Specifies the root expression returning objects to be used as context for evaluating the expressions. If not defined, all the cases in the current event log are used as root objects. Types of the root objects must be coerceable to a case. Allowed types are '''Case''', '''Event''', '''EventType''', '''Variation''', '''Flow''', '''FlowOccurrence'''.
# '''Expressions''': An array of selection expressions specifying the actual selection. All the root objects for which all the selection expression evaluations succeed will be coerced into a case and returned as selection. If not defined, all the objects returned from the Root expression will be selected. Each expression to be matched in a selection is defined as a separate JSON object. Defines an expression together with its selected values that will be used in the selection of actual model objects. Supports the following properties:
## '''Expression''': Expression that is evaluated using the context of the root object.
## '''Values''': An array of values to match to the expression result.
 
Examples:
<pre>
<pre>
{
{
   Type: "ExpressionValue",
   Type: "ExpressionValue",
   Configuration: {
   Configuration: {
     Root: "Cases.Where(",
     Root: "Cases",
     Expressions: [
     Expressions: [
       {
       {
         Expression: "Name",
         Expression: "myDatetimeAttribute",
         Values: ["c1", "c2"]
        ValueConversionExpression: "_.DateTimeFromTicks(_)",
         Values: [636214968000000000, 636239160000000000, 636291828000000000]
       }
       }
     ]
     ]
   }
   }
}
}
</pre>


Select cases named "c1" and "c2".
<pre>
 
{
{
   Type: "ExpressionValue",
   Type: "SqlExpressionValue",
   Configuration: {
   Configuration: {
     Root: "Cases.Where(Duration.TotalDays > 1)"
     Root: "Cases",
    Expressions: [{
      Expression: "AggregateFrom(Events, \"Count\")",
      Values: [4,5]
    }]
   }
   }
}
}
Selects cases whose duration is longer than one day.
</pre>
</pre>


=== Flow ===
=== Attribute ===
Filter rule type '''Attribute''' selects events having given event attribute values. This filter rule is available only when processing method is DataFrame, and when filter operation type is ''IncludeEvents''/''ExcludeEvents''. Properties:
* '''Attribute''': Event attribute name.
* '''Values''': Array of event attribute values. Suitable only for string, integer and boolean values.
* '''StringifiedValues''': Array of event attribute values in the [[Stringified_Value_Format|stringified format]]. Better support for different data types. Note that due to the equality comparison, float values cannot be used.


'''Flow item''' specifies one flow with following properties:
Examples:
* '''From''': Name of the event type which starts the flow.
<pre>
* '''To''': Name of the event type into which the flow goes.
{
* '''Occurrence''': The occurrence index of the selected flow within its case. If not specified, represents all occurrences.
  Type: "Attribute",
  Attribute: "Role",
  Values: ["Consultant", "Sales", "Support"]
}
</pre>
<pre>
{
  Type: "Attribute",
  Attribute: "Automation",
  StringifiedValues: ["0Manual"]
}
</pre>


Selects individual flows. Supports the following additional property '''Flows''' which selects an array of '''FlowItem''' objects.
=== Case attribute value ===
Filter rule type '''CaseAttributeValue''' selects cases having given value in given case attribute. Properties:
* '''Attribute''': Case attribute name.
* '''Values''': Array of case attribute values. Suitable only for string, integer and boolean values.
* '''StringifiedValues''': Array of case attribute values in the [[Stringified_Value_Format|stringified format]]. Better support for different data types. Note that due to the equality comparison, float values cannot be used.


Example:
Example:
<pre>
<pre>
{
{
   Type: "Flow",
   Type: "CaseAttributeValue",
   Flows: [{ From: "et2", To: "et3" }]
   Attribute: "Region",
  Values: ["Dallas", "Austin", "New York"]
}
</pre>
 
<pre>
{
  Type: "CaseAttributeValue",
  Attribute: "Region",
  StringifiedValues: ["0Dallas", "0Austin", "0New York"]
}
}
</pre>
</pre>


=== PathLength ===
=== Event attribute value ===
Selects case having given variation/process path lengths. Supports the following additional property '''Values''' which is an array of lengths (integers in strings).
Filter rule type '''EventAttributeValue''' selects cases having events with given event attribute values. Properties:
* '''Attribute''': Name of the event attribute.
* '''Values''': An array of event attribute values. Suitable only for string, integer and boolean values.
* '''StringifiedValues''': Array of event attribute values in the [[Stringified_Value_Format|stringified format]]. Better support for different data types. Note that due to the equality comparison, float values cannot be used.


Example:
Example:
<pre>
<pre>
{
{
   Type: "PathLength",
   Type: "EventAttributeValue",
   Values: ["3"]
  Attribute: "Organization",
   Values: ["Organization 1", "Organization 2"]
}
}
</pre>
</pre>


=== ProcessPath ===
<pre>
Selects individual process paths that is selected from Path Analysis. Supports the following additional properties:
{
* '''Paths''': An array of arrays of event type names (strings). Each item in the top level array represents one selected process path section.
  Type: "EventAttributeValue",
* '''RootEventType''': Name of the event type from which the paths start. Defaults to the most common starter event type of the process.
  Attribute: "Organization",
* '''ReversedPaths''': Is the path direction towards successors (false) or predecessors (true). Defaults to successors.
  StringifiedValues: ["0Organization 1", "0Organization 2"]
}
</pre>
 
=== Event type ===
Filter rule type '''EventType''' selects cases containing selected event types (Type=IncludeCases/ExcludeCases) or selects event types (Type=IncludeEventTypes/ExcludeEventTypes). It has property '''Values''' which is an array of event type names.


Example:
Example:
<pre>
<pre>
{
{
   Type: "ProcessPath",
   Type: "EventType",
   RootEventType: "et1",
   Values: ["Sales Order Created", "Payment Received", "Delivery Sent"]
  Paths: [["et1", "et2", "et3"]]
}
}
</pre>
</pre>


=== Variation ===
=== Variation ===
Filter rule type '''Variation''' selects individual variations. It supports the property '''Paths''' which is an array of arrays of event type names. Each item in the top level array represents one variation.
Filter rule type '''Variation''' selects cases belonging to selected variations. It has the property '''Paths''' which is an array of variations. Each variation is a string array of event type names in the variation.


Example:
Example:
Line 324: Line 316:
   Paths: [
   Paths: [
     ["Activity 1", "Activity 2", "Activity 3"],
     ["Activity 1", "Activity 2", "Activity 3"],
     ["Activity 3"]
     ["Activity 3"],
     ["Activity 2", "Activity 4"]
     ["Activity 2", "Activity 4"]
   ]
   ]
Line 330: Line 322:
</pre>
</pre>


=== SelectionOperations ===
=== Flow ===
SelectionOperations has the property '''Type''' which specifies the type of the filtering operation. It can have any of the following values:
Filter rule type '''Flow''' selects cases having the defined flows. It has property '''Flows''' which selects an array of objects with following properties:
* '''IncludeEventTypes''': Include only event types specified by SelectionItems.
* '''From''': Event type name which starts the flow.
* '''ExcludeEventTypes''': Exclude event types specified by SelectionItems.
* '''To''': Event type name into which the flow goes.
* '''IncludeCases''': Include cases specified by SelectionItems.
* '''Occurrence''': Zero-based occurrence index of the selected flow within its case. If not specified, represents all occurrences.  
* '''ExcludeCases''': Exclude cases specified by SelectionItems.
* '''Union''': Select objects that belong to union of all the given child selections.
* '''Intersection''': Select objects that belong to intersection of all the given child selections.
* '''ClearFilters''': Clear filter for given type of objects.
* '''Negate''': Negate the filtered objects of given type.
* '''IncludeCaseAttributes''': Include only given case attributes.
* '''ExcludeCaseAttributes''': Exclude given case attributes.
* '''IncludeEventAttributes''': Include only given event attributes.
* '''ExcludeEventAttributes''': Exclude given event attributes.
* '''Items''' specifies selected model objects. An array of SelectionItem objects. It is applicable only when the Type is '''IncludeEventTypes''', '''ExcludeEventTypes''', '''IncludeCases''' or '''ExcludeCases'''.
* '''ChildItems''': Specifies the selections to be combined using a set operation. An array of SelectionConfiguration objects. Applicable only when the Type is any of the following: Union, Intersection.
* '''Attributes''': Specifies an array of attribute names. Applicable only when the Type is any of the following: IncludeCaseAttributes, ExcludeCaseAttributes, IncludeEventAttributes, IncludeEventAttributes.
* '''TargetObjectType''': Specifies the type of objects the operation is targeted to. Supported values are '''EventType''' and '''Case'''. It is applicable only when the Type is '''ClearFilters''' or '''Negate'''.


Example:
Example:
<pre>
{
  Type: "Flow",
  Flows: [ {From: "EventType1", To: "EventType2", "Occurrence": 1} ]
}
</pre>
=== Case ID ===
Filter rule type '''Case''' selects individual cases. It supports property '''Values''' which is an array of case ID's (strings).
Example:
<pre>
{
  Type: "Case",
  Values: ["case1", "case2", "case3"]
}
</pre>
Same example in the whole JSON configuration:
<pre>
<pre>
{
{
   Items: [
   Items: [
     {
     {
       Type: "Union",
       Type: "IncludeCases",
       ChildItems: [
       Items: [
         {
         {
           Items: [
           Type: "Case",
            {
           Values: ["case1", "case2", "case3"]
              Type: "IncludeCases",
              Items: [
                {
                  Type: "Case",
                  Values: ["c1", "c3"]
                }
              ]
            }
          ]
        },
        {
           Items: [
            {
              Type: "IncludeCases",
              Items: [
                {
                  Type: "Case",
                  Values: ["c1"]
                }
              ]
            },
            {
              Type: "Negate",
              TargetObjectType: "Case"
            }
          ]
         }
         }
       ]
       ]
Line 391: Line 363:
}
}
</pre>
</pre>
=== Trend arrow ===
Trend arrow specifies time groups for one specific trend value. It has the following properties:
# '''Value''': String representation of the value.
# '''Offsets''': An array of integers which specifies which timestamp offsets (counted from the StartDate with PeriodLevel granularity) are selected.

Latest revision as of 12:03, 14 September 2023

QPR ProcessAnalyzer queries for models data can be filtered to include only selected cases or events to the calculation. The expression query have the parameter Filter to pass a filter definition. The Root cause analysis has also the parameter Comparison which divides the analyzed data into two groups to compare them in the analysis. The Comparison parameter has the same structure as in the Filter parameter.

If a filter (or comparison) refers to information that doesn't exist in the model, e.g. non-existing event type names or case attribute values, the non-existing values are ignored. Still, if the CaseAttributeValue or EventAttributeValue filter refers to an attribute name that doesn't exist, an error is given.

Filter and Comparison parameters

The filter definition has syntax demonstrated by the following example:

{
  Items: [
    {
      Type: "IncludeCases",
      Items: [
        {
          Type: "EventType",
          Values: ["Sales Order Created", "Payment Received"]
        },
        {
          Type: "CaseAttributeValue",
          Attribute: "Region",
          Values: ["Dallas", "Austin"]
        }
      ]
    },
    {
      Type: "ExcludeCases",
      Items: [
        {
          Type: "Case",
          Values: ["Case1", "Case2", "Case3"]
        },
        {
          Type: "flow",
          Values: [
            {
              From: "Shipment",
              To: "Invoice"
            }
          ]
        }
      ]
    }
  ]
}

The outmost object has a property Items which is an array of object with following properties:

  • Type: Specifies the type of the filtering operation with following options:
    • IncludeCases / ExcludeCases: Includes / excludes cases. All filter rule types can be used with this option.
    • IncludeEvents / ExcludeEvents: Includes / excludes events. Only Attribute filter rule types can be used with this option.
    • IncludeEventTypes / ExcludeEventTypes: Includes / excludes events based on the event type. Only Event type and Expression filter rule types can be used with this option.
  • Disabled: (boolean) Defines whether the filter rule is applied or not. This is used by the UI to temporarily disable filter rule without removing them.

The following chapters list different filter rule types that can be used in the above defined Items property.

Filter Rule Types

Expression

Filter rule type ExpressionValue (for in-memory calculation) or SqlExpressionValue (for dataframe calculation) selects cases or events that match the given expression. There is property Configuration which has properties:

  • Root: The root expression returning objects that are used to evaluate the Expressions (see below). If not defined, all the cases in the current event log are used as root objects. The root expression should return following types of objects: (1) for case filters: cases, events, event types, flows or flow occurrences, (2) for event filters: events and (3) for event type filters: event types. The expressions are typically what can be used as chart dimension expressions.
  • Expressions: Array of expressions specifying the filter rules. There is the AND logic between the filter rules, so all expressions need to match for the objects to come to the filter. Properties:
    • Expression: When filter rule type is ExpressionValue, specifies an eventlog based expression that is evaluated for each root object. When filter rule type is SqlExpressionValue, specifies an SQL expression that is evaluated for each root object.
    • Values: Array of values to match to the expression result. Suitable only for strings, numeric and boolean values.
    • StringifiedValues: Array of values to match to the expression result, and the values are defined in the stringified format. This has a better support for different data types than in the Values property.
    • NumberPrecision: Similar setting as the expression analysis dimensions have to round numerical type of result of the expression.
    • DatetimeTruncation: Similar setting as the expression analysis dimensions have to round date type of result of the expression.
    • TimespanPrecision: Similar setting as the expression analysis dimensions have to round timespan type of result of the expression. Supported only for expression type ExpressionValue.
    • Comparison: Defines type of comparison operation among the following: equal (default), notequal, greaterthan, lessthan, greaterthanorequal and lessthanorequal. When comparison is equal or notequal, several values can be specified. For other comparison types, there must only be one value. The lower and greater than comparisons work with numbers, datatimes and timespans. In the lower and greater than comparisons, null values in both sides of the comparison result in a non-match. Rounding or truncation defined by the NumberPrecision, DateTimeTruncation or TimespanPrecision are done before comparison, so do not use them if comparison should be based on the original values.
    • Columns: For SqlExpressionValue type, additional calculated columns that can be used in the main expression. Defined as an array of objects with following properties:
      • Name: Column name.
      • Expression: Column expression. In the expression, it's possible to refer to the previous columns.
  • Variables: Object specifying key-value pairs, where each pair creates a variable into the expression context where key is the name of the variable and value is its value. The values will be converted to strings. Supported only for expression type ExpressionValue.

Examples:

Select cases named "case1" and "case2".

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "Name",
        Values: ["case1", "case2"]
      }
    ]
  }
}

Cases where duration is as rounded 3 or 4 days.

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "Duration.TotalDays",
        NumberPrecision: 0,
        StringifiedValues: ["43", "44"]
      }
    ]
  }
}

Cases where duration is as rounded 3 or 4 days.

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "Duration",
        TimespanPrecision: "day",
        StringifiedValues: ["73.00:00:00.000", "74.00:00:00.000"]
      }
    ]
  }
}

Cases that have started in October or November 2020.

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "StartTime",
        DatetimeTruncation: "month",
        StringifiedValues: ["22020-10-01T00:00:00.000", "22020-11-01T00:00:00.000"]
      }
    ]
  }
}

Selects cases whose duration is longer than one day.

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases.Where(Duration.TotalDays > 1)"
  }
}

Same as previous using the Comparison property:

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "Duration.TotalDays",
        Comparison: "greaterthan",
        Values: [1]
      }
    ]
  }
}

All Cases that have started before year 2020:

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "StartTime",
        Comparison: "lessthan",
        StringifiedValues: ["22020-01-01T00:00:00.000"]
      }
    ]
  }
}

Returns all cases that are conformant with the specified BPNM model.

{
  Type: "ExpressionValue",
  Configuration: {
    Variables: {
      bpmnXml: "<XML BPMN model>"
    },
    Root: "Let(\"myConformanceModel\", DesignModelFromXml(bpmnXml));Cases.Where(IsConformant(myConformanceModel));"
  }
}

Pass date values as ticks and convert them into date objects (that are used in the actual comparison).

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "myDatetimeAttribute",
        ValueConversionExpression: "_.DateTimeFromTicks(_)",
        Values: [636214968000000000, 636239160000000000, 636291828000000000]
      }
    ]
  }
}
{
  Type: "SqlExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [{
      Expression: "AggregateFrom(Events, \"Count\")",
      Values: [4,5]
    }]
  }
}

Attribute

Filter rule type Attribute selects events having given event attribute values. This filter rule is available only when processing method is DataFrame, and when filter operation type is IncludeEvents/ExcludeEvents. Properties:

  • Attribute: Event attribute name.
  • Values: Array of event attribute values. Suitable only for string, integer and boolean values.
  • StringifiedValues: Array of event attribute values in the stringified format. Better support for different data types. Note that due to the equality comparison, float values cannot be used.

Examples:

{
  Type: "Attribute",
  Attribute: "Role",
  Values: ["Consultant", "Sales", "Support"]
}
{
  Type: "Attribute",
  Attribute: "Automation",
  StringifiedValues: ["0Manual"]
}	

Case attribute value

Filter rule type CaseAttributeValue selects cases having given value in given case attribute. Properties:

  • Attribute: Case attribute name.
  • Values: Array of case attribute values. Suitable only for string, integer and boolean values.
  • StringifiedValues: Array of case attribute values in the stringified format. Better support for different data types. Note that due to the equality comparison, float values cannot be used.

Example:

{
  Type: "CaseAttributeValue",
  Attribute: "Region",
  Values: ["Dallas", "Austin", "New York"]
}
{
  Type: "CaseAttributeValue",
  Attribute: "Region",
  StringifiedValues: ["0Dallas", "0Austin", "0New York"]
}

Event attribute value

Filter rule type EventAttributeValue selects cases having events with given event attribute values. Properties:

  • Attribute: Name of the event attribute.
  • Values: An array of event attribute values. Suitable only for string, integer and boolean values.
  • StringifiedValues: Array of event attribute values in the stringified format. Better support for different data types. Note that due to the equality comparison, float values cannot be used.

Example:

{
  Type: "EventAttributeValue",
  Attribute: "Organization",
  Values: ["Organization 1", "Organization 2"]
}
{
  Type: "EventAttributeValue",
  Attribute: "Organization",
  StringifiedValues: ["0Organization 1", "0Organization 2"]
}

Event type

Filter rule type EventType selects cases containing selected event types (Type=IncludeCases/ExcludeCases) or selects event types (Type=IncludeEventTypes/ExcludeEventTypes). It has property Values which is an array of event type names.

Example:

{
  Type: "EventType",
  Values: ["Sales Order Created", "Payment Received", "Delivery Sent"]
}

Variation

Filter rule type Variation selects cases belonging to selected variations. It has the property Paths which is an array of variations. Each variation is a string array of event type names in the variation.

Example:

{
  Type: "Variation",
  Paths: [
    ["Activity 1", "Activity 2", "Activity 3"],
    ["Activity 3"],
    ["Activity 2", "Activity 4"]
  ]
}

Flow

Filter rule type Flow selects cases having the defined flows. It has property Flows which selects an array of objects with following properties:

  • From: Event type name which starts the flow.
  • To: Event type name into which the flow goes.
  • Occurrence: Zero-based occurrence index of the selected flow within its case. If not specified, represents all occurrences.

Example:

{
  Type: "Flow",
  Flows: [ {From: "EventType1", To: "EventType2", "Occurrence": 1} ]
}

Case ID

Filter rule type Case selects individual cases. It supports property Values which is an array of case ID's (strings).

Example:

{
  Type: "Case",
  Values: ["case1", "case2", "case3"]
}

Same example in the whole JSON configuration:

{
  Items: [
    {
      Type: "IncludeCases",
      Items: [
        {
          Type: "Case",
          Values: ["case1", "case2", "case3"]
        }
      ]
    }
  ]
}