UiPath Documentation
process-mining
2023.10
false
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。
UiPath logo, featuring letters U and I in white

Process Mining 用户指南

上次更新日期 2026年4月23日

在本地环境中编辑数据转换

简介

备注:

强烈建议使用数据转换编辑器在Process Mining中自定义数据转换。查看数据转换,了解有关如何在Process Mining中自定义数据转换的更多信息。

本页介绍如何在Process Mining外部自定义数据转换。

从应用程序模板创建流程应用程序时,您需要确保流程应用程序中使用的数据以正确的方式反映您的业务流程。借助数据转换,您可以自定义用于Process Mining 的数据。

Data transformations enable you to:

  • “分组依据”“筛选器”添加新字段。例如,质量检查类型
  • add events. For example, Invoice quality check done.
  • 添加标签。例如,无法满足 SLA违反四眼原则
  • 添加用于计算 KPI 的业务逻辑。例如, Case_has_maverick_buing
  • 为计算定义新的输入字段。

数据转换编辑器

您可以使用数据转换Process Mining中自定义转换,也可以从Process Mining导出转换,并使用本地测试环境对其进行编辑和测试。

备注:

Process Mining中使用数据转换编辑器编辑转换不需要本地开发环境。

版本控制转换

目前,产品中没有转换代码的版本控制。 导入新转换时,以前的转换将被覆盖。 无法还原到先前版本的转换。

备注:

建议在进行更改时保留代码先前版本的本地副本。要跟踪更改,可以在版本控制系统(如 GIT 或 SVN)中对本地计算机上的转换进行版本控制。这样,您可以使用版本控制系统回滚到以前的版本,并在需要时将这些转换导入产品。

先决条件

开始编辑数据转换时,强烈建议您:

  • 对 SQL 有深入的了解;
  • 熟悉用于数据提取的源系统。
权限

您需要拥有流程应用程序的“编辑转换”权限才能自定义数据转换。

工具

编辑数据转换需要代码编辑器。Visual Studio Code 是推荐用于编辑数据转换的代码编辑器。您可以从“下载 Visual Studio 代码网页”下载 Visual Studio 代码。

It is recommended to run and test the data transformations outside Process Mining, before you import the edited transformation in your process app. To run and test the data transformations, a local test environment is required.

Customizing the transformations

每个流程应用程序都有相应的数据转换集。 自定义数据转换需要执行多个步骤。

  1. 从流程应用程序导出转换。
  2. 在 Visual Studio Code 中打开转换。
  3. 运行转换*。
  4. 编辑转换。
  5. 在本地测试环境中测试转换。*
  6. 在 Process Mining 的测试流程应用程序中导入并测试转换。
  7. 在流程应用程序中导入转换。
  • 在本地测试环境中运行和测试转换是可选步骤。

1. 从 Process App 导出转换

请参阅导出转换

2. Open the transformations in Visual Studio Code

请按照以下步骤在 Visual Studio Code 中打开转换。

步骤操作
1在 Windows 资源管理器中,在虚拟环境所在的文件夹中为导出的转换创建一个文件夹。例如C:\My_transformations\TemplateOne-MultiFiles
2解压缩文件夹中导出的转换.zip文件。

下图显示了一个示例。

My_transformations 中的 Venv 文件夹

步骤操作
3In Visual Studio Code, go to File -> Open Folder... and select the folder that contains the unzipped transformations.

下图显示了一个示例。

解压缩的转换

The dbt project is interpreted.

Date and time formats

重要提示:

Snowflake 使用与 SQL Server 不同的日期和时间格式。如果为流程应用程序的转换定义了日期和时间变量,则必须将dbt_project.yml中的日期和时间格式更改为 SQL Server 所需的格式。在使用新转换创建.zip文件之前,必须将日期和时间格式更改回 Snowflake 所需的格式。如果dbt_project.yml文件中未定义日期和时间格式,则使用默认值。对于 SQL Server,日期和时间格式由整数定义,而对于 Snowflake,则由字符串定义。

下表描述了 SQL Server 和 Snowflake 的不同(默认)格式。

变量SQL Server 格式雪花格式
date_format23'YYYY-MM-DD'
time_format14'hh24:mi:ss.ff3'
datetime_format21'YYYY-MM-DD hh24:mi:ss.ff3'

有关详细信息,请参阅:

3. Run the transformations

重要提示:

Running the transformations is only applicable if you want to test the transformations outside Process Mining on a local test environment.

最好在开始编辑转换之前运行转换。 这使您可以检查设置是否正确以及数据是否正确加载。

在开始之前

要运行转换,您必须:

  • 为流程应用程序创建新的数据库架构。 您可以在 Microsoft SQL Server Management Studio 中执行此操作。 请按照以下步骤操作。

    步骤操作
    1In the Object Explorer in Microsoft SQL Server Management Studio, go the folder of your database in the Databases folder.
    2Right-click on Security and select New -> Schema...

下图显示了 SQL Server 身份验证窗口。

SQL Server 身份验证

文档图像

有关更多信息,请参阅Microsoft 官方文档

  • 在新架构中加载数据,并确保架构中提供所需的输入表。 您可以使用提取程序加载数据,直接从 Microsoft SQL Server Management Studio 中的 .csv 文件加载数据。 请按照以下步骤操作

    步骤操作
    1In the Object Explorer in Microsoft SQL Server Management Studio, locate your database in the Databases folder.
    2Right-click on the name of your database and select Tasks -> Import Flat File...
    备注:

    It is recommended to use a small dataset for testing data transformations. The lower the record count of the dataset, the faster transformations will be executed.

设置 Profiles.yml

首次在 Visual Studio Code 中打开 dbt 项目时,系统将显示dbt消息,指出无法找到与新转换对应的配置文件。下图显示了一个示例。

错误消息示例

备注:

If you start editing transformations, you must first set up a profiles.yml file that is connected to your Microsoft SQL Server database. For new transformations, you can extend the profiles.yml file by adding a new entry.

以下代码块包含profiles.yml文件的模板,或单击链接以下载模板: profiles.yml

my-app-template:
  outputs:
    default:
      type: sqlserver
      driver: 'ODBC Driver 17 for SQL Server'
      server: 
      port: 
      user: 
      password: 
      database: 
      schema: 
      encrypt:
      trust_cert:
      
  target: default
my-app-template:
  outputs:
    default:
      type: sqlserver
      driver: 'ODBC Driver 17 for SQL Server'
      server: 
      port: 
      user: 
      password: 
      database: 
      schema: 
      encrypt:
      trust_cert:
      
  target: default
步骤操作
1打开文本编辑器。 例如记事本++。
2复制并粘贴上述模板中的内容。
3my-app-template替换为dbt_project.yml中显示的profile名称。例如uipathTemplateOne
3编辑文件,使其指向刚刚创建的架构。
4profiles.yml文件保存在不包含 dbt 项目的文件夹中。例如C:\My_transformations
5使用包含profiles.yml文件的文件夹的文件路径创建名为 DBT_PROFILES_DIR 的环境变量。

My_transformations 文件夹

新建用户变量

Dbt_project.yml 文件

备注:

By default, the source data is stored in the schema where the transformations run. If your source tables are in a different schema, you can define this schema in the schema_sources variable.

有关如何配置配置文件的更多信息,请参阅官方 dbt 文档

Running the transformations

请按照以下步骤运行转换。

步骤操作
1In Visual Studio Code, right-click on the models folder and select Open in Integrated Terminal from the context menu.
2在集成终端的命令提示符处输入dbt build

4. Edit the transformations

有关编辑转换的准则,请参阅转换编写 SQL 的提示

5. Test the transformations on a local test environment

重要提示:

Test the transformations is only applicable if you want to test the transformations outside Process Mining on a local test environment.

请按照以下步骤测试转换。

步骤

操作

1

在 Visual Studio Code 的集成终端的命令提示符处输入dbt build

2

检查 SQL Server Management Studio 中的数据以验证值。

  • 右键单击表格,然后选择“选择前 1000 行”
  • 如有必要,请修改查询以获得所需的结果。

在本地测试环境中编辑并测试转换,直到转换运行没有任何错误并且数据正确为止。

6. 在 Process Mining 的测试流程应用程序中导入和测试转换

强烈建议在原始流程应用程序中导入转换之前,在Process Mining 的测试流程应用程序中运行新的转换。由于转换是在本地 SQL Server 环境中测试的,因此在Process Mining中运行新转换时可能会发生错误。

请查看4. 编辑转换

重要提示:

Snowflake uses a different date and time formats than SQL Server. If you have changed the date and time formats in dbt_project.yml to to test the transformations SQL Server you must change the date and time formats back to the format required by Snowflake, before you create the .zip file with the new transformations.

Follow these steps to import and test the transformations in a test process app in Process Mining.

步骤操作
1在 Windows 资源管理器中,转到存储转换的文件夹(例如C:\My_transformations\TemplateOne-MultiFiles ,然后将转换添加到新的.zip文件中。
2转到 Process Mining 门户,然后根据与流程应用程序相同的应用程序模板创建新的流程应用程序。
3在测试流程应用程序中导入转换
4检查仪表板以查看数据是否正确显示。

7. 在流程应用程序中导入转换

重要提示:

导入转换后,将自动运行新转换。该操作将立即影响已发布流程应用程序中显示的数据。强烈建议在单独的测试流程应用程序中测试新转换,以防止出现任何错误(请参阅步骤 6:在 Process Mining 的测试流程应用程序中导入并测试转换)。运行错误的转换将导致最终用户无法查看已发布的应用程序。

请查看导入转换

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新