Filtering in QPR ProcessAnalyzer Queries

From QPR ProcessAnalyzer Wiki
Revision as of 22:24, 24 January 2018 by Ollvihe (talk | contribs) (Created page with "== General == QPR ProcessAnalyzer analysis requests have parameter '''Filter''' which can be used to pass filter definition for the analysis. The filter is defined using a JSO...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

General

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 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: "ExcludeCases",
      Items: [
        {
          Type: "Case",
          Values: ["c1", "c3"]
        }
      ]
    },
    {
      Type: "ClearFilters",
      TargetObjectType: "Case"
    },
    {
      Type: "IncludeCases",
      Items: [
        {
          Type: "Case",
          Values: ["c1"]
        }
      ]
    }
  ]
}

Case

SelectionItem type Case selects individual cases. It supports additionally property Values which is an array of case names (strings).

Example:

{
  Type: "Case",
  Values: ["c1", "c3" ]
}

CaseAttributeTrend

SelectionItem 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

Selects cases that match given expression. Supports additional property Configuration which is a selection expression configuration.

Examples:

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases.Where(",
    Expressions: [
      {
        Expression: "Name",
        Values: ["c1", "c3"]
      }
    ]
  }
}

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

Selects individual variations. Supports the following additional property Paths which is an array of arrays of event type names (strings). Each item in the top level array represents one variation.

Example:

{
  Type: "Variation",
  Paths: [["et1", "et2", "et3"], ["et1"]]
}

SelectionOperations has the following 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. 1.1.3.2. An array of SelectionItem -objects. 1.1.3.2.1. Applicable only when the Type is any of the following: IncludeEventTypes, ExcludeEventTypes, IncludeCases, ExcludeCases. 1.1.4. ChildItems: 1.1.4.1. Specifies the selections to be combined using a set operation. 1.1.4.2. An array of SelectionConfiguration -objects. 1.1.4.2.1. Applicable only when the Type is any of the following: Union, Intersection. 1.1.5. Attributes: 1.1.5.1. Specifies an array of attribute names. 1.1.5.2. An array of strings. 1.1.5.2.1. Applicable only when the Type is any of the following: IncludeCaseAttributes, ExcludeCaseAttributes, IncludeEventAttributes, IncludeEventAttributes. 1.1.6. TargetObjectType: 1.1.6.1. Specifies the type of objects the operation is targeted to. 1.1.6.2. Supported values are: 1.1.6.2.1. EventType 1.1.6.2.2. Case 1.1.6.3. Applicable only when the Type is any of the following: ClearFilters, 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.