Filtering in QPR ProcessAnalyzer Queries

From QPR ProcessAnalyzer Wiki
Revision as of 16:22, 25 January 2018 by Ollvihe (talk | contribs)
Jump to navigation Jump to search

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)
  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"
            }
          ]
        }
      ]
    }
  ]
}
  • Outmost object has a property Items, which is an array of SelectionOperation objects
  • SelectionOperation objects have Type property and possibly other properties. The Type property specifies the type of the filtering operation having the following values:
    • IncludeEventTypes: Include only event types.
    • ExcludeEventTypes: Exclude event types.
    • IncludeCases: Include only cases.
    • ExcludeCases: Exclude cases.
    • 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. It is used only when the Type is IncludeCases, ExcludeCases, IncludeEventTypes or ExcludeEventTypes.
    • 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.

The following chapters list all filter rule types that can be used.

Case

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"]
}

CaseAttributeTrend

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]
    }
  ]
}

CaseAttributeValue

Filter rule 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:

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

Duration

Filter rule 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:

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

EventAttributeTrend

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. 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: "EventAttributeTrend",
  Attribute: "Unit",
  PeriodLevel: "Day",
  StartDate: "2012-01-01",
  Trends: [
    {
      Value: "UnitA",
      Offsets: [9]
    }
  ]
}

EventAttributeValue

Filter rule 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:

{
  Type: "EventAttributeValue",
  Attribute: "Unit",
  Values: ["UnitA"]
}

EventType

Filter rule type EventType selects individual event types. It has property Values which is an array of event type names.

Example:

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

EventTypeTrend

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. 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: "EventTypeTrend",
  PeriodLevel: "Day",
  StartDate: "2012-01-01",
  Trends: [
    {
      Value: "Shipment",
      Offsets: [3]
    }
  ]
}

ExpressionValue

Filter rule type ExpressionValue selects cases 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 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:
    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: ["c1", "c2"]
      }
    ]
  }
}

Select cases named "c1" and "c2".

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

Flow

Filter rule type Flow selects individual 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: "et2", To: "et3"} ]
}

PathLength

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"]
}

ProcessPath

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.
  • 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: "et1",
  Paths: [["et1", "et2", "et3"]]
}

Variation

Filter rule type Variation selects individual 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"]
  ]
}

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"
            }
          ]
        }
      ]
    }
  ]
}