Filtering in QPR ProcessAnalyzer Queries: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
Line 170: Line 170:
}
}
Selects cases whose duration is longer than one day.  
Selects cases whose duration is longer than one day.  
</pre>
=== 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:
<pre>
{
  Type: "Variation",
  Paths: [
    ["Activity 1", "Activity 2", "Activity 3"],
    ["Activity 3"],
    ["Activity 2", "Activity 4"]
  ]
}
</pre>
</pre>



Revision as of 18:55, 20 March 2018

QPR ProcessAnalyzer analyses can be filtered enabling to include only defined data to the analysis calculation. QPR ProcessAnalyzer analysis requests have parameter Filter which is used to pass a JSON formatted filter definition for the analysis. This filter definition is combined with the stored filter object, which is provided as the FilterId parameter. Influence 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.

When performing analyses, different filter specifications are applied in the following order (from first to last):

  1. Filter rules defined by a stored filter (the FilterId parameter) (this is mandatory as it also defines the model to use)
  2. Filter rules defined in the Filter parameter
  3. Other filtering related parameters, such as SelectedActivities or SelectedTransitions

Filter and Comparison parameters are only supported in the In-Memory core.

Filter parameter JSON syntax

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 JSON 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: Include only cases. All filter rule types can be used with this option.
    • ExcludeCases: Exclude cases. All filter rule types can be used with this option.
    • IncludeEventTypes: Include only event types. Only EventType and ExpressionValue filter rule types can be used with this option.
    • ExcludeEventTypes: Exclude event types. Only EventType and ExpressionValue filter rule types can be used with this option.
    • IncludeCaseAttributes: Include only given case attributes.
    • ExcludeCaseAttributes: Exclude given case attributes.
    • IncludeEventAttributes: Include only given event attributes.
    • ExcludeEventAttributes: Exclude given event attributes.
    • 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.
    • Negate: Negate the filtered objects of given type.
    • ClearFilters: Clear filter for given type of objects.
  • Items: Specifies selected model objects. It is used when the Type is IncludeCases, ExcludeCases, IncludeEventTypes or ExcludeEventTypes. The following chapter define all possibilities that can be used here.
  • ChildItems: Specifies the selections to be combined using a set operation. Applicable only when the Type is Union or Intersection.
  • Attributes: Specifies an array of attribute names. Applicable when the Type is IncludeCaseAttributes, ExcludeCaseAttributes, IncludeEventAttributes or IncludeEventAttributes.
  • TargetObjectType: Specifies the type of objects the operation is targeted to. Supported values are EventType and Case. It is applicable when the Type is ClearFilters or Negate.

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

Filter Rule Types

Case names

Filter rule type Case selects individual cases. It supports property Values which is an array of case names (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"]
        }
      ]
    }
  ]
}

Case attribute values

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

  • Attribute: Case attribute name.
  • Values: Array of case attribute values in string format.

Example:

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

Event attribute values

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 in string format.

Example:

{
  Type: "EventAttributeValue",
  Attribute: "Organization",
  Values: ["Organization 1", "Organization 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"]
}

Expression

Filter rule type ExpressionValue selects cases or event types that match the given expression. It has property Configuration which contains the following properties:

  1. 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. Allowed types for the root expression are Case, Event, EventType, Variation, Flow, FlowOccurrence.
  2. Expressions: An array of expressions specifying the actual filter. All the root objects for which all (AND logic) the expressions return true will be converted into corresponding cases or event types. If not defined, all the objects returned from the Root expression will be selected. Properties:
    1. Expression: Expression that is evaluated using the context of the root object.
    2. Values: An array of values to match to the expression result.

Examples:

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

Select cases named "case1" and "case2".

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases.Where(Duration.TotalDays > 1)"
  }
}
Selects cases whose duration is longer than one day. 

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: Occurrence index of the selected flow within its case. If not specified, represents all occurrences.

Example:

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

Path length

Filter rule type PathLength selects cases having the given variation or process path lengths. It has property Values which is an array of lengths (integers in strings).

Example:

{
  Type: "PathLength",
  Values: ["3"]
}

Process path

Filter rule type ProcessPath selects cases with the defined process paths. Properties:

  • Paths: An array of arrays of event type names (strings). Each item in the top level array represents one selected process path section.
  • RootEventType: Name of the event type from which the paths start. Defaults to the most common starter event type of the process.
  • ReversedPaths: Is the path direction towards successors (false) or predecessors (true). Defaults to successors.

Example:

{
  Type: "ProcessPath",
  RootEventType: "EventType1",
  Paths: [["EventType1", "EventType2", "EventType3"]]
}

Duration

Filter rule type Duration selects cases based on case duration or cases having flows with the selected durations. Properties:

  • Durations: 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. Properties:
    • From: Event type name which starts the flow.
    • To: Event type name into which the flow goes.

Example:

{
  Type: "Duration",
  Durations: [50],
  Granularity: 60,
  MaximumDuration: 50,
  FocusFlow: { From: "EventType1", To: "EventType2" }
}

Case attribute trend

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. 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.

Example:

{
  Type: "CaseAttributeTrend",
  Attribute: "Region",
  PeriodLevel: "Day",
  StartDate: "2012-01-01",
  TimeStampType: "CaseStartTime",
  Trends: [
    {
      Value: "Dallas",
      Offsets: [1]
    }
  ]
}

Event attribute trend

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. 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.

Example:

{
  Type: "EventAttributeTrend",
  Attribute: "Unit",
  PeriodLevel: "Day",
  StartDate: "2012-01-01",
  Trends: [
    {
      Value: "UnitA",
      Offsets: [9]
    }
  ]
}

Event type trend

Filter rule type EventTypeTrend selects cases having at least one event occurrence of given event type at a specific time. Properties:

  • PeriodLevel: Specifies the group granularity for the timestamps. Supported values are Day (default), Week, Month, Quarter and Year.
  • StartDate: Specifies the start date from which the indexing is started. Defaults to the current date.
  • Trends: Specifies the selected value+time combinations. 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.

Example:

{
  Type: "EventTypeTrend",
  PeriodLevel: "Day",
  StartDate: "2018-01-01",
  Trends: [
    {
      Value: "Shipment",
      Offsets: [3]
    }
  ]
}

Examples

{
  Items: [
    {
      Type: "Union",
      ChildItems: [
        {
          Items: [
            {
              Type: "IncludeCases",
              Items: [
                {
                  Type: "Case",
                  Values: ["c1", "c3"]
                }
              ]
            }
          ]
        },
        {
          Items: [
            {
              Type: "IncludeCases",
              Items: [
                {
                  Type: "Case",
                  Values: ["c1"]
                }
              ]
            },
            {
              Type: "Negate",
              TargetObjectType: "Case"
            }
          ]
        }
      ]
    }
  ]
}