Python Transformation
The Python transformation is used in the enterprise version of process.science for Power BI to prepare the data. The package is designed so that the data can be transformed directly in the Power BI report. It creates four tables that can be used for analysis in Power BI.
Preparing the environment
To work with Python scripts in Power BI, you need to follow the steps from the Microsoft [documentation](https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts).
Preparing the input table
Before the scripts can be used, you must ensure that your input table fulfils the following requirements. The column names for case_id, activity and timestamp are fixed and must be present in your input table.
| Field Name | Description | Data Type | Mandatory |
|---|---|---|---|
case_id | Through this field the process instances can be differentiated. | nvarchar | ✓ |
activity | This field describes the activity that has taken place. | nvarchar | ✓ |
activity_grouped | This field describes the group of the activity that has taken place. | nvarchar | ✗ |
timestamp | This field describes when an event has taken place. | datetime2 | ✓ |
timestamp_end | This field can be used to calculate the duration of activities. | datetime2 | ✗ |
sort_key | This field can be used to adjust the sorting of the event log. | numeric | ✗ |
value | This allows you to set the costs for the current event. | numeric | ✗ |
automated | This allows you to set wether the activity was automated or not. | numeric | ✗ |
resource | This allows you to set user information for each activity.â | Any | ✗ |
Additional Activity Values | Further information per activity, e.g. quantity of items. All fields, not matching other names will be mapped as additional activity values and will be stored in the newly created event log table. | Any | ✗ |
Additional Cases Values | Further information per case, e.g. a company division. All fields starting with case_ will be mapped as additional cases values and will be stored in the newly created cases table. | Any | ✗ |
Additional Activity Values Grouped | Further information per activity group, e.g. quantity of items. All fields ending with _grouped will be mapped as additional activity group values and will be stored in the newly created event log table. | Any | ✗ |
Downloading the scripts
The scripts can always be downloaded in the latest version from our Self Service Portal. The scripts are contained in a ZIP file and must be unpacked.
Installation and configuration
Event log
The script createEventLog.py creates the table eventlog directly in the Power BI report, use this as a Python script step in the Event Log table in Power BI. This script is already included in our templates.
Cases table
The script createCasesData.py creates the table cases_data directly in the Power BI report, use this as a Python script step in the Cases Data table in Power BI. This script is already included in our templates.
Filter Tables
The filter tables are required to create the filters in Power BI. These are created directly in Power Query and do not require any Python scripts. Use our Power BI templates for this.
