Create Simulated Eventlog

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search

This article has instructions how to install, configure and use eventlog simulations. The simulation creates a new model that contains both the source model data and the new simulated data. Case attribute Simulated can be used to determine whether the case is in the source data (false) or whether the simulation generated it as a new simulated case (true).

Prerequisites for simulation

As prerequisite, prediction must be installed into the used Snowflake as described in Install prediction in Snowflake.

Create simulation script in QPR ProcessAnalyzer

1. Create the following example expression script (e.g., with name "Create simulation model - delete events"):

let sourceModel = ProjectByName("<project name>").ModelByName("<model name>");
let eventTypeColumnName = sourceModel.EventsDataTable.ColumnMappings["EventType"];
let flowFromEventType = "<from event type of a flow to modify>", flowToEventType = "<to event type of a flow to modify>";

let targetProject = Project;
_system.ML.ApplyTransformations(#{
  "Name": "My simulation model - delete",   // Name of the PA model to generate to the target project.
  "SourceModel": sourceModel,               // Snowflake-based PA model used for training the prediction model.
  "TargetProject": targetProject,           // Target project to create the model into.
  "Transformations": [#{                    // Transformation configurations.
    "type": "modify_flow_durations",
    "column": eventTypeColumnName,
    "flows": [#{
      "from": flowFromEventType,
      "to": flowToEventType,
      "probability": 1.0,
      "operation": #{
        "type": "set_value",
        "value": 0.0
      },
      "delete": true
    }]
  }]
});

2. Configure simulation for the previously created script as instructed in the next chapter. At minimum, replace the tags listed below with some suitable values:

  • <project name>: Name of the project in which the source model is located.
  • <model name>: Name of the model to be used as source model. This data in this source model will be used as source data to be modified by the simulation transformations.
  • <from event type of a flow to modify>: .From-event type name of flows from which the from-event is to be deleted.
  • <to event type of a flow to modify>: .To-event type name of flows from which the from-event is to be deleted.

Configure simulation

Simulation script has the following settings in the ApplyTransformations call:

  • Name: Name of the QPR ProcessAnalyzer model that is created to the target project. The model will contain the source model content and the predictions.
  • SourceModel: Source model for which the simulation is made. Model can be selected for example based on id with ModelById function or by name with ModelByName function.
  • TargetProject: Target project to create the new model into.
  • Transformations: Array of transformation configuration objects. Each object supports the following parameters:
    • type: Defines the type of the transformation to perform. Supported values are:
      • enforce_resource_limits: Used to modify given event log using given maximum resource limits.
      • extract_max_resource_usages: Used to extract, for every value of a specified column, the maximum number of concurrent cases in given event log that have that value.
      • generate: Used to generate a new event log using a trained ML model.
      • modify_flow_durations: Used to modify durations of flows and possibly remove events having specific flows.
      • modify_values: Used to modify values of a dictionary given as input (e.g., dictionary generated by extract_max_resource_usages).
      • resources_to_roles: Performs "organization mining" by trying to group together column values (e.g., resources) that are used in similar fashion in given event log (e.g., resources that are often present in similar set of activities).
    • input: Can be used to specify that given transformation input parameters get their values from the previous transformation result.
      • Value can be either direct mapping by just the name of the transformation result property, or it can be a value mapping configuration object that supports the following parameters:
        • input: Name of the parameter to get from the previous transformation result as the root object of the actual value to extract.
        • value_path: An array of property names to traverse into the root object.

Transformation: event_resource_limits

Using given input data, this transformation generates a new event log which does not exceed the concurrency limitations of specified column values.

Event rows are traversed in time order, and if at some point a limit would be exceeded, instead of outputting the actual event, a new copy of the actual event, with copied event properties, is created to represent the queue for the actual event.

Only after an event leaves from the column value that contains a queue, the event that had been waiting for the longest in the queue will be generated (following the FIFO-principle).

Supported parameters:

  • column: Name of the column having the values whose concurrent usage is to be limited by specified limits
  • limits: Specifies an object containing key-value -pairs where keys are column values and values contain an integer specifying the maximum number of concurrent cases in the given event log that can contain given value.
  • queue_event_activity_name: If set, specifies the name template used for queue-events. In this template, when a queue event is created, %s is replaced with the name of the activity this queue event is queuing to.
    • If not set, the activity name is not altered at all for the queue event.
  • queue_event_column:
    • If queue_event_activity_name is set:
      • If the event represents a queue-event, the value in this column specifies the name of the queue-activity.
      • Otherwise, the value is null.
    • If queue_event_activity_name is not set:
      • If the event represents a queue-event, the value in this column True.
      • Otherwise, the value is False.

Inputs:

Event log to operate on.

Outputs:

Event log with resource limits enforced.

Example:

#{
  "type": "enforce_resource_limits",
  "queue_event_column": "Queue",
  "queue_event_activity_name": "%s - Queue",
  "limits": #{
    "Role 3": None
  },
  "input": #{
    "limits": "role_limits",
    "column": "role_column"
  }
}

Jeps