- 发行说明
- 在开始之前
- 入门指南
- 集成
- 使用流程应用程序
- 创建应用程序
- 正在加载数据
- 自定义流程应用程序
- 发布流程应用程序
- 应用程序模板
- 其他资源
![](https://docs.uipath.com/_next/static/media/grid.05ebd128.png?w=3840&%3Bq=100)
Process Mining
在本地环境中编辑数据转换
It is strongly recommended to customize data transformations from within Process Mining using the Data Transformations editor. Check out Data transformations for more information on how to customize data transformations from within Process Mining.
本页介绍如何在Process Mining外部自定义数据转换。
从应用程序模板创建流程应用程序时,您需要确保流程应用程序中使用的数据以正确的方式反映您的业务流程。 通过 数据转换 ,您可以自定义用于 Process Mining的数据。
数据转换 使您能够:
-
为 分组依据 和 筛选器添加新字段。 例如, 质量检查类型。
-
添加事件。 例如,“ 发票质量检查已完成”。
-
添加标签。 例如,“ 未能满足 SLA”、“违反四眼”。
-
添加用于计算 KPI 的业务逻辑。 例如 Case_has_maverick_buing。
-
为计算定义新的输入字段。
您可以使用 数据转换 在 Process Mining 中自定义转换,也可以从 Process Mining 导出转换并使用本地测试环境对其进行编辑和测试。
使用Process Mining中的数据转换编辑器编辑转换不需要本地开发环境。
开始编辑数据转换时,强烈建议您:
- 对 SQL 有深入的了解;
- 熟悉用于数据提取的源系统。
工具
编辑数据转换需要代码编辑器。Visual Studio Code 是推荐用于编辑数据转换的代码编辑器。您可以从“下载 Visual Studio 代码网页”下载 Visual Studio 代码。
建议在流程应用程序中导入已编辑的转换之前,在 Process Mining外部运行并测试数据转换。 要运行和测试数据转换,需要本地测试环境。
Check out Setting up a local test environment.
每个流程应用程序都有相应的数据转换集。 自定义数据转换需要执行多个步骤。
-
从流程应用程序导出转换。
-
在 Visual Studio Code 中打开转换。
-
运行转换*。
-
编辑转换。
-
在本地测试环境中测试转换。*
-
在 Process Mining 的测试流程应用程序中导入并测试转换。
-
在流程应用程序中导入转换。
* 在本地测试环境中运行和测试转换是可选步骤。
Refer to Exporting transformations.
请按照以下步骤在 Visual Studio Code 中打开转换。
步骤 |
操作 |
---|---|
1 |
在 Windows 资源管理器中,在虚拟环境所在的文件夹中为导出的转换创建一个文件夹。 例如
C:\My_transformations\TemplateOne-MultiFiles 。
|
2 |
解压缩文件夹中导出的转换
.zip 文件。
|
下图显示了一个示例。
步骤 |
操作 |
---|---|
3 |
在 Visual Studio Code 中,转到“ 文件” -> “打开文件夹...” ,然后选择包含解压缩转换的文件夹。 |
下图显示了一个示例。
已解释 dbt 项目。
dbt_project.yml
中的日期和时间格式更改为 SQL Server 所需的格式。 在使用新转换创建.zip
文件之前,您必须将日期和时间格式更改回 Snowflake 所需的格式。
dbt_project.yml
文件中定义日期和时间格式,则使用默认值。
对于 SQL Server,日期和时间格式由整数定义,而对于 Snowflake,日期和时间格式由字符串定义。
The following table describes the different (default) formats for SQL Server and Snowflake.
变量 |
SQL Server 格式 |
雪花格式 |
---|---|---|
|
23 |
'YYYY-MM-DD' |
|
14 |
'hh24:mi:ss.ff3' |
|
21 |
'YYYY-MM-DD hh24:mi:ss.ff3' |
有关详细信息,请参阅:
-
有关使用 Snowflake 转换中的日期和时间格式的官方 Snowflake 文档。
-
有关使用 SQL Server 进行日期和时间转换的 Microsoft SQL Server 官方文档。
最好在开始编辑转换之前运行转换。 这使您可以检查设置是否正确以及数据是否正确加载。
要运行转换,您必须:
-
为流程应用程序创建新的数据库架构。 您可以在 Microsoft SQL Server Management Studio 中执行此操作。 请按照以下步骤操作。
步骤
操作
1
在 Microsoft SQL Server Management Studio 的“ 对象资源管理器 ” 中,转到“数据库” 文件夹中的 数据库 文件夹。
2
右键单击“ 安全 性”,然后选择 “新建”->“架构...”
下图显示了 SQL Server 身份验证窗口。
有关更多信息,请参阅Microsoft 官方文档。
-
在新架构中加载数据,并确保架构中提供所需的输入表。 您可以使用提取程序加载数据,直接从 Microsoft SQL Server Management Studio 中的
.csv
文件加载数据。 请按照以下步骤操作步骤
操作
1
在 Microsoft SQL Server Management Studio 的“对象资源管理器”中,前往“数据库”文件夹中找到您的数据库。
2
右键单击数据库名称,然后选择“ 任务” -> “导入平面文件...”
注意: 建议使用小型数据集来测试数据转换。 数据集的记录计数越低,执行转换的速度就越快。
首次在 Visual Studio Code 中打开 dbt 项目时,系统将显示dbt消息,指示无法找到与新转换对应的配置文件。 下图显示了一个示例。
profiles.yml
文件。 对于新的转换,您可以通过添加新条目来扩展profiles.yml
文件。
profiles.yml
file, or click the link to download the template: 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 |
复制并粘贴上述模板中的内容。 |
3 |
将
my-app-template 替换为dbt_project.yml 中显示的profile 名称。
例如
uipathTemplateOne 。
|
3 |
编辑文件,使其指向刚刚创建的架构。 |
4 |
Save the
profiles.yml file in the folder that does not contain a dbt project
例如
C:\My_transformations 。
|
5 |
使用包含
profiles.yml 文件的文件夹的文件路径创建一个名为 DBT_PROFILES_DIR 的环境变量。
|
schema_sources
变量中定义此架构。
Refer to the official dbt documentation for more information on how to configure your profile.
For guidelines on editing transformation refer to Transformations and Tips for writing SQL.
请按照以下步骤测试转换。
步骤 |
操作 |
---|---|
1 |
在 Visual Studio Code 的集成终端的命令提示符处输入
dbt build 。
|
2 |
检查 SQL Server Management Studio 中的数据以验证值。
|
在本地测试环境中编辑并测试转换,直到转换运行没有任何错误并且数据正确为止。
强烈建议在原始流程应用程序中导入转换之前,在Process Mining的测试流程应用程序中运行新的转换。 由于转换是在本地 SQL Server 环境中进行测试,因此在“ Process Mining ”中运行新转换时可能会发生错误。
Check out 4. Edit the transformations.
dbt_project.yml
中的日期和时间格式更改为 SQL Server,则必须将日期和时间格式更改回 Snowflake 所需的格式,然后才能使用新的转换创建.zip
文件。
请按照以下步骤在 Process Mining的测试流程应用程序中导入和测试转换。
步骤 |
操作 |
---|---|
1 |
在 Windows 资源管理器中,转到存储转换的文件夹 例如
C:\My_transformations\TemplateOne-MultiFiles ,然后将转换添加到新的.zip 文件中。
|
2 |
转到 Process Mining 门户,然后根据与流程应用程序相同的应用程序模板创建新的流程应用程序。 |
3 |
在测试流程应用程序中导入转换。 |
4 |
检查仪表板以查看数据是否正确显示。 |
When the transformations are imported the new transformations are automatically run. This will immediately affect the data displayed in the published process app. It is strongly recommended to test the new transformations in a separate test process app to prevent any errors (refer to Step 6: Import and test the transformations in a test process app in Process Mining).
运行错误的转换将导致最终用户无法看到已发布的应用程序。
Check out Importing transformations.
- 简介
- 数据转换编辑器
- 版本控制转换
- 先决条件
- Customizing the transformations
- 1. 从 Process App 导出转换
- 2. Open the transformations in Visual Studio Code
- Date and time formats
- 3. Run the transformations
- 在开始之前
- 设置 Profiles.yml
- Running the transformations
- 4. Edit the transformations
- 5. Test the transformations on a local test environment
- 6. 在 Process Mining 的测试流程应用程序中导入和测试转换
- 7. 在流程应用程序中导入转换