- 发行说明
- 在开始之前
- 入门指南
- 集成
- 使用流程应用程序
- 创建应用程序
- 正在加载数据
- 自定义流程应用程序
- 发布流程应用程序
- 应用程序模板
- 其他资源
标签
在 Process Mining 中,标签是您应用于数据的业务规则,使您能够检查流程中的一致性,例如效率低下、返工或违规。
Tags
表的字段。
如果要使用“标签”仪表板来分析流程中的标签,则必须为应用程序模板定义标签。
对于某些应用程序模板,提供开箱即用标签,这些标签将显示在仪表板中。 在特定应用程序模板的文档中,您将找到可用标签的概述。 “应用程序模板”页面包含指向所有可用应用程序模板的文档的链接。
所有自定义流程应用程序模板都具有一个开箱即用标签,用于检查案例是否具有由不同用户执行的返工活动。
如果“标签”仪表板中没有可用数据,则您需要使用数据转换配置自己的标签。 在这里,您还可以根据业务需求配置任何默认标签。 下面概述了不同应用程序模板的标签配置文件。
应用程序模板基于 |
标签配置文件 |
事件日志 | models\5_business_logic\Tags_base.sql |
自定义流程1 | models\5_business_logic\Tags_base.sql |
购买到付款 | models\5_business_logic\Tags.sql |
订单到现金 | models\5_business_logic\Tags.sql |
Tags_raw.csv
文件上传标签。 请参阅自定义流程输入字段。
在最后一个转换步骤中,根据需要添加业务逻辑以进行数据分析。
标签表中的每条记录代表特定案例的一个标签。 示例标签包括:
- 违反合同的 SLA。
- 由未经授权的人付款。
Case_ID
和 Tag
。
并非所有案例都有标签,有些案例可能有多个标签。
有关更多信息,请参阅数据转换。
以下是一些 SQL 示例,您可使用这些示例来配置使用转换的标签。
Case_ID
。 如果要使用 SQL 示例为“采购到付款”应用程序模板或“订单到现金”应用程序模板定义标签,请确保使用适当的实体和相关的内部“entity_ID”。 扩展标签的实现时,请遵循现有实现。
直接关注
此 SQL 代码可识别活动“X”后直接跟有活动“Y”的情况,并将其标记为“违规”。
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
-- Event log with current activity and next activity
Event_log_extended as (
select
Event_log_base."Case_ID",
Event_log_base."Activity" as "Current_activity",
lead(Event_log_base."Activity") over (order by "Event_end") as "Next_activity"
from Event_log_base
),
-- This SQL code checks whether activity X is directly followed by Y in a given case
Directly_follows as (
select
Event_log_extended ."Case_ID",
{{ pm_utils.as_varchar('Activity X directly followed by activity Y') }} as "Tag",
{{ pm_utils.as_varchar('Violation') }} as "Tag_type"
from Event_log_extended
where Event_log_extended ."Current_activity" = 'X' and Event_log_extended ."Next_activity" = 'Y'
group by Event_log_extended ."Case_ID"
)
select * from Directly_follows
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
-- Event log with current activity and next activity
Event_log_extended as (
select
Event_log_base."Case_ID",
Event_log_base."Activity" as "Current_activity",
lead(Event_log_base."Activity") over (order by "Event_end") as "Next_activity"
from Event_log_base
),
-- This SQL code checks whether activity X is directly followed by Y in a given case
Directly_follows as (
select
Event_log_extended ."Case_ID",
{{ pm_utils.as_varchar('Activity X directly followed by activity Y') }} as "Tag",
{{ pm_utils.as_varchar('Violation') }} as "Tag_type"
from Event_log_extended
where Event_log_extended ."Current_activity" = 'X' and Event_log_extended ."Next_activity" = 'Y'
group by Event_log_extended ."Case_ID"
)
select * from Directly_follows
间接关注
此 SQL 代码可识别活动“X”后直接或间接后跟活动“Y”的情况,并将其标记为“违规”。
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
Cases_with_activity_X as (
select
Event_log_base."Case_ID",
min(Event_log_base."Event_end") as "Event_end"
from Event_log_base
where Event_log_base."Activity" = 'X'
group by Event_log_base."Case_ID"
),
-- Activity X is directly or indirectly followed by activity Y
Indirectly_follows as (
select
Event_log_base."Case_ID",
{{ pm_utils.as_varchar('Activity X indirectly followed by activity Y') }} as "Tag",
{{ pm_utils.as_varchar('Violation') }} as "Tag_type"
from Event_log_base
inner join Cases_with_activity_X
on Event_log_base."Case_ID" = Cases_with_activity_X."Case_ID"
where Event_log_base."Activity" = 'Y' and Event_log_base."Event_end" > Cases_with_activity_X."Event_end"
group by Event_log_base."Case_ID"
)
select * from Indirectly_follows
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
Cases_with_activity_X as (
select
Event_log_base."Case_ID",
min(Event_log_base."Event_end") as "Event_end"
from Event_log_base
where Event_log_base."Activity" = 'X'
group by Event_log_base."Case_ID"
),
-- Activity X is directly or indirectly followed by activity Y
Indirectly_follows as (
select
Event_log_base."Case_ID",
{{ pm_utils.as_varchar('Activity X indirectly followed by activity Y') }} as "Tag",
{{ pm_utils.as_varchar('Violation') }} as "Tag_type"
from Event_log_base
inner join Cases_with_activity_X
on Event_log_base."Case_ID" = Cases_with_activity_X."Case_ID"
where Event_log_base."Activity" = 'Y' and Event_log_base."Event_end" > Cases_with_activity_X."Event_end"
group by Event_log_base."Case_ID"
)
select * from Indirectly_follows
活动 X 多次
此 SQL 代码可识别多次发生活动“X”的情况,并将其标记为“效率低下”。
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
-- This SQL code checks if Activity X occurs twice or more times in the same case
Activity_X_multiple_times as (
select
Event_log_base."Case_ID",
{{ pm_utils.as_varchar('Activity X multiple times') }} as "Tag",
{{ pm_utils.as_varchar('Inefficiency') }} as "Tag_type"
from Event_log_base
where Event_log_base."Activity" = 'X'
group by Event_log_base."Case_ID"
having count(Event_log_base."Activity") > 1
)
select * from Activity_X_multiple_times
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
-- This SQL code checks if Activity X occurs twice or more times in the same case
Activity_X_multiple_times as (
select
Event_log_base."Case_ID",
{{ pm_utils.as_varchar('Activity X multiple times') }} as "Tag",
{{ pm_utils.as_varchar('Inefficiency') }} as "Tag_type"
from Event_log_base
where Event_log_base."Activity" = 'X'
group by Event_log_base."Case_ID"
having count(Event_log_base."Activity") > 1
)
select * from Activity_X_multiple_times
案例包含活动 X
此 SQL 代码可识别具有一个或多个名称中包含“X”的活动的案例,并将其标记为“效率低下”。
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
-- Case has activity with name like X
Case_has_activity_X as (
select
Event_log_base."Case_ID",
{{ pm_utils.as_varchar('Case has activity X') }} as "Tag",
{{ pm_utils.as_varchar('Inefficiency') }} as "Tag_type"
from Event_log_base
where {{ pm_utils.charindex('X', 'Event_log_base."Activity"') }} > 0
group by Event_log_base."Case_ID"
)
select * from Case_has_activity_X
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
-- Case has activity with name like X
Case_has_activity_X as (
select
Event_log_base."Case_ID",
{{ pm_utils.as_varchar('Case has activity X') }} as "Tag",
{{ pm_utils.as_varchar('Inefficiency') }} as "Tag_type"
from Event_log_base
where {{ pm_utils.charindex('X', 'Event_log_base."Activity"') }} > 0
group by Event_log_base."Case_ID"
)
select * from Case_has_activity_X
案例没有活动 X
此 SQL 代码可识别不存在名称中包含“X”的活动的案例,并将其标记为“效率低下”。
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
Cases as (
select * from {{ ref('Cases') }}
),
-- Case has no activity with name like X
-- Obtained by subtracting the set of cases that have activity X from the set of all cases
Case_has_no_activity_X as (
select
Cases."Case_ID",
{{ pm_utils.as_varchar('Case has no activity X') }} as "Tag",
{{ pm_utils.as_varchar('Inefficiency') }} as "Tag_type"
from Cases
where Cases."Case_ID" not in (
-- Case has activity with name like X
select
Event_log_base."Case_ID"
from Event_log_base
where {{ pm_utils.charindex('X', 'Event_log_base."Activity"') }} > 0
group by Event_log_base."Case_ID"
)
)
select * from Case_has_no_activity_X
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
Cases as (
select * from {{ ref('Cases') }}
),
-- Case has no activity with name like X
-- Obtained by subtracting the set of cases that have activity X from the set of all cases
Case_has_no_activity_X as (
select
Cases."Case_ID",
{{ pm_utils.as_varchar('Case has no activity X') }} as "Tag",
{{ pm_utils.as_varchar('Inefficiency') }} as "Tag_type"
from Cases
where Cases."Case_ID" not in (
-- Case has activity with name like X
select
Event_log_base."Case_ID"
from Event_log_base
where {{ pm_utils.charindex('X', 'Event_log_base."Activity"') }} > 0
group by Event_log_base."Case_ID"
)
)
select * from Case_has_no_activity_X
开头为
此 SQL 代码可识别以活动“X”开头的案例,并将其标记为“违规”。
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
-- Add row_number to initial event log
Event_log_base_numbered as (
select
Event_log_base."Case_ID",
Event_log_base."Activity",
Event_log_base."Event_end",
row_number() over (partition by Event_log_base."Case_ID" order by Event_log_base."Event_end") as "Row_number"
from Event_log_base
),
-- Case starts with activity X
Starts_with as (
select
Event_log_base_numbered."Case_ID",
{{ pm_utils.as_varchar('Case starts with activity X') }} as "Tag",
{{ pm_utils.as_varchar('Violation') }} as "Tag_type"
from Event_log_base_numbered
where
Event_log_base_numbered."Row_number" = 1
and Event_log_base_numbered."Activity" = 'X'
)
select * from Starts_with
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
-- Add row_number to initial event log
Event_log_base_numbered as (
select
Event_log_base."Case_ID",
Event_log_base."Activity",
Event_log_base."Event_end",
row_number() over (partition by Event_log_base."Case_ID" order by Event_log_base."Event_end") as "Row_number"
from Event_log_base
),
-- Case starts with activity X
Starts_with as (
select
Event_log_base_numbered."Case_ID",
{{ pm_utils.as_varchar('Case starts with activity X') }} as "Tag",
{{ pm_utils.as_varchar('Violation') }} as "Tag_type"
from Event_log_base_numbered
where
Event_log_base_numbered."Row_number" = 1
and Event_log_base_numbered."Activity" = 'X'
)
select * from Starts_with
吞吐时间超过 10 天
此 SQL 代码可识别吞吐时间超过 10 天的案例,并将其标记为“低效率”。
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
-- Throuput time of each case
Throughput_time_per_case as (
select
Event_log_base."Case_ID",
{{ pm_utils.datediff('day', 'coalesce(min(Event_log_base."Event_start"), min(Event_log_base."Event_end"))', 'max(Event_log_base."Event_end")') }} as "Throughput_time"
from Event_log_base
group by Event_log_base."Case_ID"
),
-- Case throughput time is longer than 10 days
Throughput_time_longer_than_10_days as (
select
Throughput_time_per_case."Case_ID",
{{ pm_utils.as_varchar('Throughput time is longer than 10 days') }} as "Tag",
{{ pm_utils.as_varchar('Inneficiency') }} as "Tag_type"
from Throughput_time_per_case
where Throughput_time_per_case."Throughput_time" > 10
)
select * from Throughput_time_longer_than_10_days
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
-- Throuput time of each case
Throughput_time_per_case as (
select
Event_log_base."Case_ID",
{{ pm_utils.datediff('day', 'coalesce(min(Event_log_base."Event_start"), min(Event_log_base."Event_end"))', 'max(Event_log_base."Event_end")') }} as "Throughput_time"
from Event_log_base
group by Event_log_base."Case_ID"
),
-- Case throughput time is longer than 10 days
Throughput_time_longer_than_10_days as (
select
Throughput_time_per_case."Case_ID",
{{ pm_utils.as_varchar('Throughput time is longer than 10 days') }} as "Tag",
{{ pm_utils.as_varchar('Inneficiency') }} as "Tag_type"
from Throughput_time_per_case
where Throughput_time_per_case."Throughput_time" > 10
)
select * from Throughput_time_longer_than_10_days
持续时间超过 30 分钟
此 SQL 代码可识别活动“X”和活动“Y”之间的持续时间超过 30 分钟的情况,并将其标记为“低效率”。
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
-- First activity X of each case
First_activity_X_of_each_case as (
select
Event_log_base."Case_ID",
min(Event_log_base."Event_end") as "Event_end"
from Event_log_base
where Event_log_base."Activity" = 'X'
group by Event_log_base."Case_ID"
),
-- Last activity Y of each case
Last_activity_Y_of_each_case as (
select
Event_log_base."Case_ID",
max(Event_log_base."Event_end") as "Event_end"
from Event_log_base
where Event_log_base."Activity" = 'Y'
group by Event_log_base."Case_ID"
),
-- Time between first X and last Y > 30 minutes
Duration_more_than_30_minutes as (
select
First_activity_X_of_each_case."Case_ID",
{{ pm_utils.as_varchar('Duration more than 30 minutes') }} as "Tag",
{{ pm_utils.as_varchar('Inefficiency') }} as "Tag_type"
from First_activity_X_of_each_case
inner join Last_activity_Y_of_each_case
on First_activity_X_of_each_case."Case_ID" = Last_activity_Y_of_each_case."Case_ID"
where {{ pm_utils.datediff('minute', 'First_activity_X_of_each_case."Event_end"', 'Last_activity_Y_of_each_case."Event_end"') }} > 30
)
select * from Duration_more_than_30_minutes
with Event_log_base as (
select * from {{ ref('Event_log_base') }}
),
-- First activity X of each case
First_activity_X_of_each_case as (
select
Event_log_base."Case_ID",
min(Event_log_base."Event_end") as "Event_end"
from Event_log_base
where Event_log_base."Activity" = 'X'
group by Event_log_base."Case_ID"
),
-- Last activity Y of each case
Last_activity_Y_of_each_case as (
select
Event_log_base."Case_ID",
max(Event_log_base."Event_end") as "Event_end"
from Event_log_base
where Event_log_base."Activity" = 'Y'
group by Event_log_base."Case_ID"
),
-- Time between first X and last Y > 30 minutes
Duration_more_than_30_minutes as (
select
First_activity_X_of_each_case."Case_ID",
{{ pm_utils.as_varchar('Duration more than 30 minutes') }} as "Tag",
{{ pm_utils.as_varchar('Inefficiency') }} as "Tag_type"
from First_activity_X_of_each_case
inner join Last_activity_Y_of_each_case
on First_activity_X_of_each_case."Case_ID" = Last_activity_Y_of_each_case."Case_ID"
where {{ pm_utils.datediff('minute', 'First_activity_X_of_each_case."Event_end"', 'Last_activity_Y_of_each_case."Event_end"') }} > 30
)
select * from Duration_more_than_30_minutes