Filtering in QPR ProcessAnalyzer Queries: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
No edit summary
Line 12: Line 12:


== Filter parameter JSON syntax ==
== 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:
The filter definition using JSON has the following kind of syntax
 
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: "includeonly",
      items: [
        {
          type: "caseattributevalue",
          attribute: "Region",
          values: ["Dallas", "Austin"]
        }
      ]
    },
     {
     {
       Type: "ExcludeCases",
       Type: "ExcludeCases",
Line 21: Line 33:
         {
         {
           Type: "Case",
           Type: "Case",
           Values: ["c1", "c3"]
           Values: ["Case1", "Case2", "Case3"]
         }
         }
       ]
       ]

Revision as of 14:39, 25 January 2018

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.

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.

Filter and Comparison parameters are only supported only by the In-Memory core and server connections to servers that internally use In-Memory core.

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

  1. Filter rules defined by a stored filter (identified by FilterId parameter).
  2. Filter rules defined by the Filter parameter.
  3. Additional selection related parameters, such as SelectedActivities or SelectedTransitions.


Filter parameter JSON syntax

The filter definition using JSON has the following kind of syntax

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:

{
  Items: [
    {
      type: "includeonly",
      items: [
        {
          type: "caseattributevalue",
          attribute: "Region",
          values: ["Dallas", "Austin"]
        }
      ]
    },
    {
      Type: "ExcludeCases",
      Items: [
        {
          Type: "Case",
          Values: ["Case1", "Case2", "Case3"]
        }
      ]
    },
    {
      Type: "ClearFilters",
      TargetObjectType: "Case"
    },
    {
      Type: "IncludeCases",
      Items: [
        {
          Type: "Case",
          Values: ["c1"]
        }
      ]
    }
  ]
}

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. An array of TrendRow objects.

Example:

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

CaseAttributeValue

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:

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

Duration

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:

{
  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. An array of TrendRow objects.

Example:

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

Example selection:

Any model, any data source type:

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

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:

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

EventType

Selection item type EventType selects individual event types. Supports the following additional property Values which is an array of event type names (strings).

Example:

{
  Type: "EventType",
  Values: ["et1", "et3", "et5"]
}

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. An array of TrendRow objects.

Example:

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

ExpressionValue

ExpressionValue type selects cases that match the given expression. It supports property Configuration which is an object containing 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. Types of the root objects must be coerceable to a case. Allowed types are Case, Event, EventType, Variation, Flow, FlowOccurrence.
  2. 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:
    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.Where(",
    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

Flow item specifies one flow with following properties:

  • From: Name of the event type which starts the flow.
  • 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.

Selects individual flows. Supports the following additional property Flows which selects an array of FlowItem objects.

Example:

{
  Type: "Flow",
  Flows: [{ From: "et2", To: "et3" }]
}

PathLength

Selects case having given variation/process path lengths. Supports the following additional 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 supports the property Paths which is an array of arrays of event type names. Each item in the top level array represents one variation.

Example:

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

SelectionOperations

SelectionOperations has the property Type which specifies the type of the filtering operation. It can have any of the following values:

  • IncludeEventTypes: Include only event types specified by SelectionItems.
  • ExcludeEventTypes: Exclude event types specified by SelectionItems.
  • IncludeCases: Include cases specified by SelectionItems.
  • 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:

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

Trend arrow

Trend arrow specifies time groups for one specific trend value. It has the following properties:

  1. Value: String representation of the value.
  2. Offsets: An array of integers which specifies which timestamp offsets (counted from the StartDate with PeriodLevel granularity) are selected.