Abonnieren

UiPath Process Mining

The UiPath Process Mining Guide

Editing transformations

Einleitung

Data transformations are used to transform input data into data suitable for Process Mining. The transformations in UiPath Process Mining are written as dbt projects.

This pages gives an introduction to dbt. For more detailed information, see the official dbt documentation.

Folder structure

The transformations of a process app consist of a dbt project. Below is a description of the contents of a dbt project folder.

Folder/fileContains
dbt_packages\the pm_utils package and its macros.
logs\logs created when running dbt.
macros\custom macros.
models\.sql files that define the transformations.
models\schema\.yml files that define tests on the data.
seeds\.csv files with configuration settings.
dbt_project.ymlthe settings of the dbt project.

Siehe Abbildung unten.

298

dbt_project.yml

The dbt_project.yml file contains settings of the dbt project which defines your transformations. The vars section contains variables that are used in the transformations.

Date/time format

Each app template contains variables that determine the format for parsing date/time data. These variables have to be adjusted if the input data has a different date/time format than expected.

Datentransformationen

Die Datenumwandlungen sind in .sql -Dateien im Verzeichnis models\ definiert. Die Datenumwandlungen sind in einem Standardsatz von Unterverzeichnissen organisiert:

  • 1_input,
  • 2_entities,
  • 3_events,
  • 4_event_logs,
  • 5_business_logic.

See Structure of transformations.

The .sql files are written in Jinja SQL, which allows you to insert Jinja statements inside plain SQL queries. When dbt runs all .sql files, each .sql file results in a new view or table in the database.
Normalerweise haben die .sql -Dateien die folgende Struktur:

  1. With statements: One or more with statements to include the required sub tables.
    • {{ ref(‘My_table) }} verweist auf eine Tabelle, die durch eine andere SQL-Datei definiert ist Datei.
    • {{ source(var("schema_sources"), 'My_table') }} verweist auf eine Eingabetabelle.
  2. Main query: The query that defines the new table.
  3. Final query: Typically a query like Select * from table is used at the end. This makes it easy to make sub-selections while debugging.
with Table_A as ( 
  select * from {{ ref('Table_A') }} 
), 
Table_B as ( 
  select 
    Table_A."Field_1" as "Alias_of_1", 
    Table_A."Field_2", 
    Table_A."Field_3" 
  from Table_A 
) 
select * from Table_B

For more tips on how to write transformations effectively, see Tips for writing SQL

Adding source tables

To add a new source table to the dbt project, it must be listed in models\schema\sources.yml. This way, other models can refer to it by using {{ source(var("schema_sources"), 'My_table') }}. See the illustration below for an example.

624

🚧

Hinweis:

Each new source table must be listed in sources.yml.

For more detailed information, see the official dbt documentation on Sources.

Data output

Die Datenumwandlungen müssen das Datenmodell ausgeben, das von der entsprechenden App benötigt wird. jede erwartete Tabelle und jedes Feld muss vorhanden sein.
Praktisch bedeutet dies, dass die Tabellen in models\5_business_logic nicht gelöscht werden sollten. Außerdem sollten die Ausgabefelder in den entsprechenden Abfragen nicht entfernt werden.

Wenn Sie Ihrer Prozess-App neue Felder hinzufügen möchten, können Sie die benutzerdefinierten Felder verwenden, die für die Prozess-App verfügbar sind. Ordnen Sie die Felder in den Transformationen den benutzerdefinierten Feldern zu, damit sie in der Ausgabe verfügbar sind. Stellen Sie sicher, dass die benutzerdefinierten Felder in der Ausgabe wie im Datenmodell der Prozess-App beschrieben benannt sind.

Makros

Macros make it easy to reuse common SQL constructions. For detailed information, see the official dbt documentation on Jinja macros.

pm_utils

The UiPath Process Mining app templates come with a dbt package called pm_utils. This contains a set of macros that are typically used in Process Mining transformations.
For more info about the pm_utils macros, see ProcessMining-pm-utils.
Nachfolgend finden Sie ein Beispiel für Jinja-Code, der das Makro pm_utils.optional() aufruft.

561

Samen

Seeds are csv files that are used to add data tables to your transformations. For detailed information, see the official dbt documentation on ninja seeds.
In Process Mining, this is typically used to make it easy to configure mappings in your transformations.

After editing seed files, these files are not automatically updated in the database immediately. To instruct dbt to load the new seed file contents into the database, run either

  • dbt seed – wodurch nur die Seed-Dateitabellen aktualisiert werden, oder
  • dbt build – führt auch alle Modelle und Tests aus.

📘

Hinweis:

If the seed file had no data records initially, the data types in the database might not have been set correctly. To fix this, call run dbt seed --full-refresh. This will also update the set of columns in the database.

Activity configuration

Die Datei activity_configuration.csv wird verwendet, um zusätzliche Felder im Zusammenhang mit Aktivitäten festzulegen. activity_order wird als Tie-Breaker verwendet, wenn zwei Ereignisse auf demselben Zeitstempel stattfinden. Ein Beispiel finden Sie in der Abbildung unten.

351

Tests

The models\schema\ folder contains a set of .yml files that define tests. These validate the structure and contents of the expected data. For detailed information, see the official dbt documentation on tests.

When the transformations are run in Process Mining, only the tests in sources.yml are run on each data ingestion. This is done to check if the input data is properly formatted.

📘

Hinweis:

When you edit transformations, make sure to update the tests accordingly. The tests can be removed if desired.

Aktualisiert vor 18 Tagen

Editing transformations


Auf API-Referenzseiten sind Änderungsvorschläge beschränkt

Sie können nur Änderungen an dem Textkörperinhalt von Markdown, aber nicht an der API-Spezifikation vorschlagen.