Skip to content

Quality Dimension Indicators

process_performance_indicators.indicators.quality.instances

outcome_unit_count_for_single_events_of_activity_instances(event_log: pd.DataFrame, instance_id: str) -> float | None

The outcome units associated with an activity instance, measured as the latest recorded value among the events of the activity instance.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
instance_id str

The instance id.

required
Source code in process_performance_indicators/indicators/quality/instances.py
def outcome_unit_count_for_single_events_of_activity_instances(
    event_log: pd.DataFrame, instance_id: str
) -> float | None:
    """
    The outcome units associated with an activity instance, measured as the latest recorded value among the events of the activity instance.

    Args:
        event_log: The event log.
        instance_id: The instance id.

    """
    assert_column_exists(event_log, StandardColumnNames.OUTCOME_UNIT)
    complete_event = instances_utils.cpl(event_log, instance_id)
    if not complete_event.empty:
        return float(complete_event[StandardColumnNames.OUTCOME_UNIT].unique()[0])

    start_event = instances_utils.start(event_log, instance_id)
    if not start_event.empty:
        return float(start_event[StandardColumnNames.OUTCOME_UNIT].unique()[0])

    return None

outcome_unit_count_for_sum_of_all_events_of_activity_instances(event_log: pd.DataFrame, instance_id: str) -> float | None

The outcome units associated with an activity instance, measured as the sum of all values among the events of the activity instance.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
instance_id str

The instance id.

required
Source code in process_performance_indicators/indicators/quality/instances.py
def outcome_unit_count_for_sum_of_all_events_of_activity_instances(
    event_log: pd.DataFrame, instance_id: str
) -> float | None:
    """
    The outcome units associated with an activity instance, measured as the sum of all values among the events of the activity instance.

    Args:
        event_log: The event log.
        instance_id: The instance id.

    """
    assert_column_exists(event_log, StandardColumnNames.OUTCOME_UNIT)
    start_event = instances_utils.start(event_log, instance_id)
    complete_event = instances_utils.cpl(event_log, instance_id)
    if not start_event.empty and not complete_event.empty:
        return float(
            start_event[StandardColumnNames.OUTCOME_UNIT].unique()[0]
            + complete_event[StandardColumnNames.OUTCOME_UNIT].unique()[0]
        )
    return None

successful_outcome_unit_count(event_log: pd.DataFrame, instance_id: str, aggregation_mode: Literal['sgl', 'sum']) -> int

The outcome units associated with an activity instance, after deducting those that were unsuccessfully completed.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
instance_id str

The instance id.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for outcome unit count calculations. "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

required
Source code in process_performance_indicators/indicators/quality/instances.py
def successful_outcome_unit_count(
    event_log: pd.DataFrame, instance_id: str, aggregation_mode: Literal["sgl", "sum"]
) -> int:
    """
    The outcome units associated with an activity instance, after deducting those that were unsuccessfully completed.

    Args:
        event_log: The event log.
        instance_id: The instance id.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for outcome unit count calculations.
            "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

    """
    aggregation_function = {
        "sgl": outcome_unit_count_for_single_events_of_activity_instances,
        "sum": outcome_unit_count_for_sum_of_all_events_of_activity_instances,
    }
    outcome_unit_count = aggregation_function[aggregation_mode](event_log, instance_id)
    complete_event = instances_utils.cpl(event_log, instance_id)
    if not complete_event.empty:
        return outcome_unit_count - float(complete_event[StandardColumnNames.UNSUCCESSFUL_OUTCOME_UNIT].unique()[0])

    return outcome_unit_count

successful_outcome_unit_percentage(event_log: pd.DataFrame, instance_id: str, aggregation_mode: Literal['sgl', 'sum']) -> float

The percentage of outcome units associated with an activity instance that were successfully completed.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
instance_id str

The instance id.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for outcome unit count calculations. "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

required
Source code in process_performance_indicators/indicators/quality/instances.py
def successful_outcome_unit_percentage(
    event_log: pd.DataFrame, instance_id: str, aggregation_mode: Literal["sgl", "sum"]
) -> float:
    """
    The percentage of outcome units associated with an activity instance that were successfully completed.

    Args:
        event_log: The event log.
        instance_id: The instance id.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for outcome unit count calculations.
            "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

    """
    # TODO: check here what to do if denominator is None
    outcome_unit_function = {
        "sgl": outcome_unit_count_for_single_events_of_activity_instances,
        "sum": outcome_unit_count_for_sum_of_all_events_of_activity_instances,
    }

    numerator = successful_outcome_unit_count(event_log, instance_id, aggregation_mode)
    denominator = outcome_unit_function[aggregation_mode](event_log, instance_id)
    return safe_division(numerator, denominator)

process_performance_indicators.indicators.quality.activities

activity_instance_count_by_human_resource(event_log: pd.DataFrame, activity_name: str, human_resource_name: str) -> int

The number of times that a specific activity is instantiated by a specific human resource in the event log.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
activity_name str

The name of the activity.

required
human_resource_name str

The name of the human resource.

required
Source code in process_performance_indicators/indicators/quality/activities.py
def activity_instance_count_by_human_resource(
    event_log: pd.DataFrame, activity_name: str, human_resource_name: str
) -> int:
    """
    The number of times that a specific activity is instantiated by a specific human resource in the event log.

    Args:
        event_log: The event log.
        activity_name: The name of the activity.
        human_resource_name: The name of the human resource.

    """
    activity_instances = activities_utils.inst(event_log, activity_name)
    activity_instances_instantiated_by_human_resource = set()
    for instance_id in activity_instances:
        if instances_utils.hres(event_log, instance_id) == human_resource_name:
            activity_instances_instantiated_by_human_resource.add(instance_id)
    return len(activity_instances_instantiated_by_human_resource)

client_count_and_total_cost_ratio(event_log: pd.DataFrame, activity_name: str, aggregation_mode: Literal['sgl', 'sum']) -> float

The ratio between the number of distinct clients associated with cases where the activity is instantiated, and the total cost associated with all instantiations of the activity.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
activity_name str

The name of the activity.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for cost calculations. "sum": Considers the sum of all events of activity instances for cost calculations.

required
Source code in process_performance_indicators/indicators/quality/activities.py
def client_count_and_total_cost_ratio(
    event_log: pd.DataFrame, activity_name: str, aggregation_mode: Literal["sgl", "sum"]
) -> float:
    """
    The ratio between the number of distinct clients associated with cases where the activity is instantiated,
    and the total cost associated with all instantiations of the activity.

    Args:
        event_log: The event log.
        activity_name: The name of the activity.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for cost calculations.
            "sum": Considers the sum of all events of activity instances for cost calculations.

    """
    numerator = flexibility_activities_indicators.client_count(event_log, activity_name)
    denominator = cost_activities_indicators.total_cost(event_log, activity_name, aggregation_mode)
    return safe_division(numerator, denominator)

human_resource_count(event_log: pd.DataFrame, activity_name: str) -> int

The number of human resources that are involved in the execution of the activity.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
activity_name str

The name of the activity.

required
Source code in process_performance_indicators/indicators/quality/activities.py
def human_resource_count(event_log: pd.DataFrame, activity_name: str) -> int:
    """
    The number of human resources that are involved in the execution of the activity.

    Args:
        event_log: The event log.
        activity_name: The name of the activity.

    """
    return len(activities_utils.hres(event_log, activity_name))

outcome_unit_count(event_log: pd.DataFrame, activity_name: str, aggregation_mode: Literal['sgl', 'sum']) -> float

The outcome units associated with all instantiations of the activity.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
activity_name str

The name of the activity.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for outcome unit calculations. "sum": Considers the sum of all events of activity instances for outcome unit calculations.

required
Source code in process_performance_indicators/indicators/quality/activities.py
def outcome_unit_count(event_log: pd.DataFrame, activity_name: str, aggregation_mode: Literal["sgl", "sum"]) -> float:
    """
    The outcome units associated with all instantiations of the activity.

    Args:
        event_log: The event log.
        activity_name: The name of the activity.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for outcome unit calculations.
            "sum": Considers the sum of all events of activity instances for outcome unit calculations.

    """
    aggregation_function = {
        "sgl": quality_instances_indicators.outcome_unit_count_for_single_events_of_activity_instances,
        "sum": quality_instances_indicators.outcome_unit_count_for_sum_of_all_events_of_activity_instances,
    }
    activity_instances = activities_utils.inst(event_log, activity_name)

    outcome_unit_count = 0
    for instance_id in activity_instances:
        outcome_unit = aggregation_function[aggregation_mode](event_log, instance_id)
        if outcome_unit is not None:
            outcome_unit_count += outcome_unit
    return outcome_unit_count

rework_count(event_log: pd.DataFrame, activity_name: str) -> int

The number of times that the activity has been instantiated again, after its first instantiation, in any case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
activity_name str

The name of the activity.

required
Source code in process_performance_indicators/indicators/quality/activities.py
def rework_count(event_log: pd.DataFrame, activity_name: str) -> int:
    """
    The number of times that the activity has been instantiated again, after its first instantiation, in any case.

    Args:
        event_log: The event log.
        activity_name: The name of the activity.

    """
    rework_count = 0

    for case_id in event_log[StandardColumnNames.CASE_ID].unique():
        rework_count += max(0, cases_activities_utils.count(event_log, case_id, activity_name) - 1)
    return rework_count

rework_count_by_value(event_log: pd.DataFrame, activity_name: str, value: float) -> float

The number of times that the activity has been instantiated again, after it has been instantiated a certain number of times, in any case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
activity_name str

The name of the activity.

required
value float

The certain number of times that the activity has been instantiated.

required
Source code in process_performance_indicators/indicators/quality/activities.py
def rework_count_by_value(event_log: pd.DataFrame, activity_name: str, value: float) -> float:
    """
    The number of times that the activity has been instantiated again, after it has been instantiated a certain number of times, in any case.

    Args:
        event_log: The event log.
        activity_name: The name of the activity.
        value: The certain number of times that the activity has been instantiated.

    """
    rework_count = 0
    for case_id in event_log[StandardColumnNames.CASE_ID].unique():
        rework_count += max(0, cases_activities_utils.count(event_log, case_id, activity_name) - value)
    return rework_count

rework_percentage(event_log: pd.DataFrame, activity_name: str) -> float

The percentage of times that the activity has been instantiated again, after its first instantiation, in any case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
activity_name str

The name of the activity.

required
Source code in process_performance_indicators/indicators/quality/activities.py
def rework_percentage(event_log: pd.DataFrame, activity_name: str) -> float:
    """
    The percentage of times that the activity has been instantiated again, after its first instantiation, in any case.

    Args:
        event_log: The event log.
        activity_name: The name of the activity.

    """
    numerator = rework_count(event_log, activity_name)
    denominator = general_activities_indicators.activity_instance_count(event_log, activity_name)
    return safe_division(numerator, denominator)

rework_percentage_by_value(event_log: pd.DataFrame, activity_name: str, value: float) -> float

The percentage of times that the activity has been instantiated again, after it has been instantiated a certain number of times, in any case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
activity_name str

The name of the activity.

required
value float

The certain number of times that the activity has been instantiated.

required
Source code in process_performance_indicators/indicators/quality/activities.py
def rework_percentage_by_value(event_log: pd.DataFrame, activity_name: str, value: float) -> float:
    """
    The percentage of times that the activity has been instantiated again, after it has been instantiated
    a certain number of times, in any case.

    Args:
        event_log: The event log.
        activity_name: The name of the activity.
        value: The certain number of times that the activity has been instantiated.

    """
    numerator = rework_count_by_value(event_log, activity_name, value)
    denominator = general_activities_indicators.activity_instance_count(event_log, activity_name)
    return safe_division(numerator, denominator)

rework_time(event_log: pd.DataFrame, activity_name: str) -> pd.Timedelta

The total elapsed time for all times that the activity has been instantiated again, after its first instantiation, in any case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
activity_name str

The name of the activity.

required
Source code in process_performance_indicators/indicators/quality/activities.py
def rework_time(event_log: pd.DataFrame, activity_name: str) -> pd.Timedelta:
    """
    The total elapsed time for all times that the activity has been instantiated again, after its first instantiation, in any case.

    Args:
        event_log: The event log.
        activity_name: The name of the activity.

    """
    sum_of_first_occurrences_times = pd.Timedelta(0)
    for case_id in event_log[StandardColumnNames.CASE_ID].unique():
        sum_of_first_occurrences_times += cases_activities_utils.filt(event_log, case_id, activity_name)

    return time_activities_indicators.lead_time(event_log, activity_name) - sum_of_first_occurrences_times

successful_outcome_unit_count(event_log: pd.DataFrame, activity_name: str, aggregation_mode: Literal['sgl', 'sum']) -> int

The outcome units associated with all instantiations of the activity, after deducting those that were unsuccessfully completed.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
activity_name str

The name of the activity.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for outcome unit count calculations. "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

required
Source code in process_performance_indicators/indicators/quality/activities.py
def successful_outcome_unit_count(
    event_log: pd.DataFrame, activity_name: str, aggregation_mode: Literal["sgl", "sum"]
) -> int:
    """
    The outcome units associated with all instantiations of the activity, after deducting those that were unsuccessfully completed.

    Args:
        event_log: The event log.
        activity_name: The name of the activity.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for outcome unit count calculations.
            "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

    """
    sum_of_successful_outcome_unit_counts = 0
    for instance_id in activities_utils.inst(event_log, activity_name):
        sum_of_successful_outcome_unit_counts += quality_instances_indicators.successful_outcome_unit_count(
            event_log, instance_id, aggregation_mode
        )
    return sum_of_successful_outcome_unit_counts

successful_outcome_unit_percentage(event_log: pd.DataFrame, activity_name: str, aggregation_mode: Literal['sgl', 'sum']) -> float

The percentage of outcome units associated with all instantiations of the activity that were successfully completed.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
activity_name str

The name of the activity.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for outcome unit count calculations. "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

required
Source code in process_performance_indicators/indicators/quality/activities.py
def successful_outcome_unit_percentage(
    event_log: pd.DataFrame, activity_name: str, aggregation_mode: Literal["sgl", "sum"]
) -> float:
    """
    The percentage of outcome units associated with all instantiations of the activity that were successfully completed.

    Args:
        event_log: The event log.
        activity_name: The name of the activity.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for outcome unit count calculations.
            "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

    """
    numerator = successful_outcome_unit_count(event_log, activity_name, aggregation_mode)
    denominator = outcome_unit_count(event_log, activity_name, aggregation_mode)
    return safe_division(numerator, denominator)

total_cost_and_client_count_ratio(event_log: pd.DataFrame, activity_name: str, aggregation_mode: Literal['sgl', 'sum']) -> float

The ratio between the total cost associated with all instantiations of the activity, and the number of distinct clients associated with cases where the activity is instantiated.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
activity_name str

The name of the activity.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for cost calculations. "sum": Considers the sum of all events of activity instances for cost calculations.

required
Source code in process_performance_indicators/indicators/quality/activities.py
def total_cost_and_client_count_ratio(
    event_log: pd.DataFrame, activity_name: str, aggregation_mode: Literal["sgl", "sum"]
) -> float:
    """
    The ratio between the total cost associated with all instantiations of the activity, and the number of distinct clients associated with cases where the activity is instantiated.

    Args:
        event_log: The event log.
        activity_name: The name of the activity.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for cost calculations.
            "sum": Considers the sum of all events of activity instances for cost calculations.

    """
    numerator = cost_activities_indicators.total_cost(event_log, activity_name, aggregation_mode)
    denominator = flexibility_activities_indicators.client_count(event_log, activity_name)
    return safe_division(numerator, denominator)

process_performance_indicators.indicators.quality.cases

activity_instance_count_by_human_resource(event_log: pd.DataFrame, case_id: str, human_resource_name: str) -> int

The number of times that any activity is instantiated by a specific human resource in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
human_resource_name str

The name of the human resource.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def activity_instance_count_by_human_resource(event_log: pd.DataFrame, case_id: str, human_resource_name: str) -> int:
    """
    The number of times that any activity is instantiated by a specific human resource in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        human_resource_name: The name of the human resource.

    """
    activity_instances = cases_utils.inst(event_log, case_id)
    activity_instances_instantiated_by_human_resource = set()
    for instance_id in activity_instances:
        if instances_utils.hres(event_log, instance_id) == human_resource_name:
            activity_instances_instantiated_by_human_resource.add(instance_id)
    return len(activity_instances_instantiated_by_human_resource)

activity_instance_count_by_role(event_log: pd.DataFrame, case_id: str, role_name: str) -> int

The number of times that any activity is instantiated by a specific role in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
role_name str

The name of the role.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def activity_instance_count_by_role(event_log: pd.DataFrame, case_id: str, role_name: str) -> int:
    """
    The number of times that any activity is instantiated by a specific role in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        role_name: The name of the role.

    """
    activity_instances = cases_utils.inst(event_log, case_id)
    activity_instances_instantiated_by_role = set()
    for instance_id in activity_instances:
        if instances_utils.role(event_log, instance_id) == role_name:
            activity_instances_instantiated_by_role.add(instance_id)
    return len(activity_instances_instantiated_by_role)

automated_activity_count(event_log: pd.DataFrame, case_id: str, automated_activities: set[str]) -> int

The number of automated activities that occur in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
automated_activities set[str]

The set of automated activities.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def automated_activity_count(event_log: pd.DataFrame, case_id: str, automated_activities: set[str]) -> int:
    """
    The number of automated activities that occur in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        automated_activities: The set of automated activities.

    """
    case_activities = cases_utils.act(event_log, case_id)
    return len(automated_activities.intersection(case_activities))

automated_activity_instance_count(event_log: pd.DataFrame, case_id: str, automated_activities: set[str]) -> int

The number of times that an automated activity is instantiated in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
automated_activities set[str]

The set of automated activities.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def automated_activity_instance_count(event_log: pd.DataFrame, case_id: str, automated_activities: set[str]) -> int:
    """
    The number of times that an automated activity is instantiated in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        automated_activities: The set of automated activities.

    """
    case_instances = cases_utils.inst(event_log, case_id)
    instances_of_automated_activities = set()
    for instance in case_instances:
        if instances_utils.act(event_log, instance) in automated_activities:
            instances_of_automated_activities.add(instance)
    return len(instances_of_automated_activities)

desired_activity_count(event_log: pd.DataFrame, case_id: str, desired_activities: set[str]) -> int

The number of instantiated activities whose occurence is desirable in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
desired_activities set[str]

The set of desired activities.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def desired_activity_count(event_log: pd.DataFrame, case_id: str, desired_activities: set[str]) -> int:
    """
    The number of instantiated activities whose occurence is desirable in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        desired_activities: The set of desired activities.

    """
    desired_activities = set(desired_activities)
    case_activities = cases_utils.act(event_log, case_id)
    return len(desired_activities.intersection(case_activities))

human_resource_count(event_log: pd.DataFrame, case_id: str) -> int

The number of human resources that are involved in the execution of the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def human_resource_count(event_log: pd.DataFrame, case_id: str) -> int:
    """
    The number of human resources that are involved in the execution of the case.

    Args:
        event_log: The event log.
        case_id: The case ID.

    """
    return len(cases_utils.hres(event_log, case_id))

non_automated_activity_count(event_log: pd.DataFrame, case_id: str, automated_activities: set[str]) -> int

The number of non-automated activities that occur in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
automated_activities set[str]

The set of automated activities.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def non_automated_activity_count(event_log: pd.DataFrame, case_id: str, automated_activities: set[str]) -> int:
    """
    The number of non-automated activities that occur in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        automated_activities: The set of automated activities.

    """
    case_activities = cases_utils.act(event_log, case_id)
    return len(case_activities.difference(automated_activities))

non_automated_activity_instance_count(event_log: pd.DataFrame, case_id: str, automated_activities: set[str]) -> int

The number of times that an non-automated activity is instantiated in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
automated_activities set[str]

The set of automated activities.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def non_automated_activity_instance_count(event_log: pd.DataFrame, case_id: str, automated_activities: set[str]) -> int:
    """
    The number of times that an non-automated activity is instantiated in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        automated_activities: The set of automated activities.

    """
    non_automated_activity_instances = {
        instance
        for instance in cases_utils.inst(event_log, case_id)
        if instances_utils.act(event_log, instance) not in automated_activities
    }
    return len(non_automated_activity_instances)

outcome_unit_count(event_log: pd.DataFrame, case_id: str, aggregation_mode: Literal['sgl', 'sum']) -> float

The outcome units associated with all instantiations of the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for outcome unit calculations. "sum": Considers the sum of all events of activity instances for outcome unit calculations.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def outcome_unit_count(event_log: pd.DataFrame, case_id: str, aggregation_mode: Literal["sgl", "sum"]) -> float:
    """
    The outcome units associated with all instantiations of the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for outcome unit calculations.
            "sum": Considers the sum of all events of activity instances for outcome unit calculations.

    """
    aggregation_function = {
        "sgl": quality_instances_indicators.outcome_unit_count_for_single_events_of_activity_instances,
        "sum": quality_instances_indicators.outcome_unit_count_for_sum_of_all_events_of_activity_instances,
    }
    case_instances = cases_utils.inst(event_log, case_id)

    outcome_unit_count: float = 0
    for instance_id in case_instances:
        outcome_unit = aggregation_function[aggregation_mode](event_log, instance_id)
        if outcome_unit is not None:
            outcome_unit_count += outcome_unit
    return outcome_unit_count

overall_quality(event_log: pd.DataFrame, case_id: str) -> float

The overall quality associated with the outcome of the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def overall_quality(event_log: pd.DataFrame, case_id: str) -> float:
    """
    The overall quality associated with the outcome of the case.

    Args:
        event_log: The event log.
        case_id: The case ID.

    """
    assert_column_exists(event_log, StandardColumnNames.QUALITY)
    case_rows = event_log[event_log[StandardColumnNames.CASE_ID] == case_id]
    return float(case_rows[StandardColumnNames.QUALITY].unique()[0])

repeatability(event_log: pd.DataFrame, case_id: str) -> float

The inverted ratio between the number of activities that occur in the case, and the number of times that an activity has been instantiated in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def repeatability(event_log: pd.DataFrame, case_id: str) -> float:
    """
    The inverted ratio between the number of activities that occur in the case, and the number of times that an activity has been instantiated in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.

    """
    return 1 - safe_division(
        general_cases_indicators.activity_count(event_log, case_id),
        general_cases_indicators.activity_instance_count(event_log, case_id),
    )

rework_count(event_log: pd.DataFrame, case_id: str) -> int

The number of times that any activity has been instantiated again, after its first instantiation, in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def rework_count(event_log: pd.DataFrame, case_id: str) -> int:
    """
    The number of times that any activity has been instantiated again, after its first instantiation, in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.

    """
    rework_count = 0

    for activity_name in event_log[StandardColumnNames.ACTIVITY].unique():
        rework_count += max(0, cases_activities_utils.count(event_log, case_id, activity_name) - 1)
    return rework_count

rework_count_by_value(event_log: pd.DataFrame, case_id: str, value: float) -> int

The number of times that the activity has been instantiated again, after it has been instantiated a certain number of times, in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
value float

The certain number of times that the activity has been instantiated.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def rework_count_by_value(event_log: pd.DataFrame, case_id: str, value: float) -> int:
    """
    The number of times that the activity has been instantiated again, after it has been instantiated a certain number of times, in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        value: The certain number of times that the activity has been instantiated.

    """
    rework_count = 0

    for activity_name in event_log[StandardColumnNames.ACTIVITY].unique():
        rework_count += max(0, cases_activities_utils.count(event_log, case_id, activity_name) - value)
    return int(rework_count)

rework_of_activities_subset(event_log: pd.DataFrame, case_id: str, activities_subset: set[str]) -> int

The number of times that any activity belonging to a subset of activities has been instantiated again, after its first instantiation, in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
activities_subset set[str]

The subset of activities.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def rework_of_activities_subset(event_log: pd.DataFrame, case_id: str, activities_subset: set[str]) -> int:
    """
    The number of times that any activity belonging to a subset of activities has been instantiated again, after its first instantiation,
    in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        activities_subset: The subset of activities.

    """
    rework_count = 0

    for activity_name in activities_subset:
        rework_count += max(0, cases_activities_utils.count(event_log, case_id, activity_name) - 1)
    return rework_count

rework_percentage(event_log: pd.DataFrame, case_id: str) -> float

The percentage of times that any activity has been instantiated again, after its first instantiation, in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def rework_percentage(event_log: pd.DataFrame, case_id: str) -> float:
    """
    The percentage of times that any activity has been instantiated again, after its first instantiation, in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.

    """
    numerator = rework_count(event_log, case_id)
    denominator = general_cases_indicators.activity_instance_count(event_log, case_id)
    return safe_division(numerator, denominator)

rework_percentage_by_value(event_log: pd.DataFrame, case_id: str, value: float) -> float

The percentage of times that any activity has been instantiated again, after it has been instantiated a certain number of times, in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
value float

The certain number of times that the activity has been instantiated.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def rework_percentage_by_value(event_log: pd.DataFrame, case_id: str, value: float) -> float:
    """
    The percentage of times that any activity has been instantiated again, after it has been instantiated a certain number of times, in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        value: The certain number of times that the activity has been instantiated.

    """
    numerator = rework_count_by_value(event_log, case_id, value)
    denominator = general_cases_indicators.activity_instance_count(event_log, case_id)
    return safe_division(numerator, denominator)

rework_time(event_log: pd.DataFrame, case_id: str) -> pd.Timedelta

The total elapsed time for all times that any activity has been instantiated again, after its first instantiation, in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def rework_time(event_log: pd.DataFrame, case_id: str) -> pd.Timedelta:
    """
    The total elapsed time for all times that any activity has been instantiated again, after its first instantiation, in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.

    """
    sum_of_first_occurrences_times = pd.Timedelta(0)
    for activity_name in event_log[StandardColumnNames.ACTIVITY].unique():
        sum_of_first_occurrences_times += cases_activities_utils.filt(event_log, case_id, activity_name)
    return time_cases_indicators.lead_time(event_log, case_id) - sum_of_first_occurrences_times

successful_outcome_unit_count(event_log: pd.DataFrame, case_id: str, aggregation_mode: Literal['sgl', 'sum']) -> int

The outcome units associated with all activity instances of the case, after deducting those that were unsuccessfully completed.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for outcome unit count calculations. "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def successful_outcome_unit_count(
    event_log: pd.DataFrame, case_id: str, aggregation_mode: Literal["sgl", "sum"]
) -> int:
    """
    The outcome units associated with all activity instances of the case, after deducting those that were unsuccessfully completed.

    Args:
        event_log: The event log.
        case_id: The case ID.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for outcome unit count calculations.
            "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

    """
    sum_of_successful_outcome_unit_counts = 0
    for instance_id in cases_utils.inst(event_log, case_id):
        sum_of_successful_outcome_unit_counts += quality_instances_indicators.successful_outcome_unit_count(
            event_log, instance_id, aggregation_mode
        )
    return sum_of_successful_outcome_unit_counts

successful_outcome_unit_percentage(event_log: pd.DataFrame, case_id: str, aggregation_mode: Literal['sgl', 'sum']) -> float

The percentage of outcome units associated with all activity instances of the case that were successfully completed.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for outcome unit count calculations. "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def successful_outcome_unit_percentage(
    event_log: pd.DataFrame, case_id: str, aggregation_mode: Literal["sgl", "sum"]
) -> float:
    """
    The percentage of outcome units associated with all activity instances of the case that were successfully completed.

    Args:
        event_log: The event log.
        case_id: The case ID.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for outcome unit count calculations.
            "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

    """
    numerator = successful_outcome_unit_count(event_log, case_id, aggregation_mode)
    denominator = outcome_unit_count(event_log, case_id, aggregation_mode)
    return safe_division(numerator, denominator)

unwanted_activity_count(event_log: pd.DataFrame, case_id: str, unwanted_activities: set[str]) -> int

The number of unwanted activities that occur in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
unwanted_activities set[str]

The set of unwanted activities names.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def unwanted_activity_count(event_log: pd.DataFrame, case_id: str, unwanted_activities: set[str]) -> int:
    """
    The number of unwanted activities that occur in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        unwanted_activities: The set of unwanted activities names.

    """
    return len(unwanted_activities.intersection(cases_utils.act(event_log, case_id)))

unwanted_activity_instance_count(event_log: pd.DataFrame, case_id: str, unwanted_activities: set[str]) -> int

The number of times that an unwanted activity is instantiated in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
unwanted_activities set[str]

The set of unwanted activities names.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def unwanted_activity_instance_count(event_log: pd.DataFrame, case_id: str, unwanted_activities: set[str]) -> int:
    """
    The number of times that an unwanted activity is instantiated in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        unwanted_activities: The set of unwanted activities names.

    """
    unwanted_activity_instances = {
        instance
        for instance in cases_utils.inst(event_log, case_id)
        if instances_utils.act(event_log, instance) in unwanted_activities
    }
    return len(unwanted_activity_instances)

unwanted_activity_instance_percentage(event_log: pd.DataFrame, case_id: str, unwanted_activities: set[str]) -> float

The percentage of times that an unwanted activity is instantiated in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
unwanted_activities set[str]

The set of unwanted activities names.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def unwanted_activity_instance_percentage(
    event_log: pd.DataFrame, case_id: str, unwanted_activities: set[str]
) -> float:
    """
    The percentage of times that an unwanted activity is instantiated in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        unwanted_activities: The set of unwanted activities names.

    """
    numerator = unwanted_activity_instance_count(event_log, case_id, unwanted_activities)
    denominator = general_cases_indicators.activity_instance_count(event_log, case_id)
    return safe_division(numerator, denominator)

unwanted_activity_percentage(event_log: pd.DataFrame, case_id: str, unwanted_activities: set[str]) -> float

The percentage of unwanted activities that occur in the case.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_id str

The case ID.

required
unwanted_activities set[str]

The set of unwanted activities names.

required
Source code in process_performance_indicators/indicators/quality/cases.py
def unwanted_activity_percentage(event_log: pd.DataFrame, case_id: str, unwanted_activities: set[str]) -> float:
    """
    The percentage of unwanted activities that occur in the case.

    Args:
        event_log: The event log.
        case_id: The case ID.
        unwanted_activities: The set of unwanted activities names.

    """
    numerator = unwanted_activity_count(event_log, case_id, unwanted_activities)
    denominator = general_cases_indicators.activity_count(event_log, case_id)
    return safe_division(numerator, denominator)

process_performance_indicators.indicators.quality.groups

activity_instance_count_by_human_resource(event_log: pd.DataFrame, case_ids: list[str] | set[str], human_resource_name: str) -> int

The number of times that any activity is instantiated by a specific human resource in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
human_resource_name str

The name of the human resource.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def activity_instance_count_by_human_resource(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], human_resource_name: str
) -> int:
    """
    The number of times that any activity is instantiated by a specific human resource in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        human_resource_name: The name of the human resource.

    """
    count = 0
    for case_id in case_ids:
        count += quality_cases_indicators.activity_instance_count_by_human_resource(
            event_log, case_id, human_resource_name
        )
    return count

activity_instance_count_by_role(event_log: pd.DataFrame, case_ids: list[str] | set[str], role_name: str) -> int

The number of times that any activity is instantiated by a specific role in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
role_name str

The name of the role.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def activity_instance_count_by_role(event_log: pd.DataFrame, case_ids: list[str] | set[str], role_name: str) -> int:
    """
    The number of times that any activity is instantiated by a specific role in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        role_name: The name of the role.

    """
    count = 0
    for case_id in case_ids:
        count += quality_cases_indicators.activity_instance_count_by_role(event_log, case_id, role_name)
    return count

automated_activity_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]) -> int

The number of automated activities that occur in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
automated_activities set[str]

The set of automated activities.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def automated_activity_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]
) -> int:
    """
    The number of automated activities that occur in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        automated_activities: The set of automated activities.

    """
    activities_in_group = set()
    for case_id in case_ids:
        activities_in_group.update(cases_utils.act(event_log, case_id))

    return len(automated_activities.intersection(activities_in_group))

automated_activity_instance_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]) -> int

The number of times that an automated activity is instantiated in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
automated_activities set[str]

The set of automated activities.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def automated_activity_instance_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]
) -> int:
    """
    The number of times that an automated activity is instantiated in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        automated_activities: The set of automated activities.

    """
    count = 0
    for case_id in case_ids:
        count += quality_cases_indicators.automated_activity_instance_count(event_log, case_id, automated_activities)
    return count

case_and_client_count_ratio(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float

The ratio between the number of cases belonging to the group of cases, and the number of distinct clients associated with cases in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_and_client_count_ratio(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The ratio between the number of cases belonging to the group of cases, and the number of distinct clients associated with cases in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    return safe_division(
        general_groups_indicators.case_count(event_log, case_ids),
        flexibility_groups_indicators.client_count(event_log, case_ids),
    )

case_count_where_activity_after_time_frame(event_log: pd.DataFrame, case_ids: list[str] | set[str], activity_name: str, end_time: pd.Timestamp) -> int

The number of cases belonging to the group of cases where a certain activity has occurred after a specific time frame.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
activity_name str

The name of the activity.

required
end_time Timestamp

The end time stamp.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_count_where_activity_after_time_frame(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], activity_name: str, end_time: pd.Timestamp
) -> int:
    """
    The number of cases belonging to the group of cases where a certain activity has occurred after a specific time frame.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        activity_name: The name of the activity.
        end_time: The end time stamp.

    """
    resulting_cases = {
        case_id
        for case_id in case_ids
        if any(
            instances_utils.stime(event_log, instance) >= end_time
            for instance in cases_activities_utils.inst(event_log, case_id, activity_name)
        )
    }
    return len(resulting_cases)

case_count_where_activity_before_time_frame(event_log: pd.DataFrame, case_ids: list[str] | set[str], activity_name: str, start_time: pd.Timestamp) -> int

The number of cases belonging to the group of cases where a certain activity has occurred before a specific time frame.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
activity_name str

The name of the activity.

required
start_time Timestamp

The start time stamp.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_count_where_activity_before_time_frame(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], activity_name: str, start_time: pd.Timestamp
) -> int:
    """
    The number of cases belonging to the group of cases where a certain activity has occurred before a specific time frame.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        activity_name: The name of the activity.
        start_time: The start time stamp.

    """
    resulting_cases = {
        case_id
        for case_id in case_ids
        if any(
            instances_utils.stime(event_log, instance) <= start_time
            for instance in cases_activities_utils.inst(event_log, case_id, activity_name)
        )
    }
    return len(resulting_cases)

case_count_where_activity_during_time_frame(event_log: pd.DataFrame, case_ids: list[str] | set[str], activity_name: str, start_time: pd.Timestamp, end_time: pd.Timestamp) -> int

The number of cases belonging to the group of cases where a certain activity has occurred within a specific time frame.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
activity_name str

The name of the activity.

required
start_time Timestamp

The start time.

required
end_time Timestamp

The end time.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_count_where_activity_during_time_frame(
    event_log: pd.DataFrame,
    case_ids: list[str] | set[str],
    activity_name: str,
    start_time: pd.Timestamp,
    end_time: pd.Timestamp,
) -> int:
    """
    The number of cases belonging to the group of cases where a certain activity has occurred within a specific time frame.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        activity_name: The name of the activity.
        start_time: The start time.
        end_time: The end time.

    """
    resulting_cases = {
        case_id
        for case_id in case_ids
        if any(
            instances_utils.stime(event_log, instance) >= start_time
            and instances_utils.stime(event_log, instance) <= end_time
            for instance in cases_activities_utils.inst(event_log, case_id, activity_name)
        )
    }
    return len(resulting_cases)

case_count_where_end_activity_is_a(event_log: pd.DataFrame, case_ids: list[str] | set[str], a_activity_name: str) -> int

The number of cases belonging to the group of cases where a specific activity is the last instantiated one.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
a_activity_name str

The name of the activity.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_count_where_end_activity_is_a(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], a_activity_name: str
) -> int:
    """
    The number of cases belonging to the group of cases where a specific activity is the last instantiated one.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        a_activity_name: The name of the activity.

    """
    resulting_cases = {
        case_id
        for case_id in case_ids
        if any(
            instances_utils.act(event_log, instance_id) == a_activity_name
            for instance_id in cases_utils.endin(event_log, case_id)
        )
    }
    return len(resulting_cases)

case_count_where_start_activity_is_a(event_log: pd.DataFrame, case_ids: list[str] | set[str], a_activity_name: str) -> int

The number of cases belonging to the group of cases where a specific activity is the first instantiated one.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
a_activity_name str

The name of the activity.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_count_where_start_activity_is_a(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], a_activity_name: str
) -> int:
    """
    The number of cases belonging to the group of cases where a specific activity is the first instantiated one.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        a_activity_name: The name of the activity.

    """
    resulting_cases = {
        case_id
        for case_id in case_ids
        if any(
            instances_utils.act(event_log, instance_id) == a_activity_name
            for instance_id in cases_utils.strin(event_log, case_id)
        )
    }
    return len(resulting_cases)

case_count_with_rework(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int

The number of cases belonging to the group of cases where there has been rework.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_count_with_rework(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int:
    """
    The number of cases belonging to the group of cases where there has been rework.

    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    resulting_cases = {case_id for case_id in case_ids if quality_cases_indicators.rework_count(event_log, case_id) > 0}
    return len(resulting_cases)

case_percentage_where_activity_after_time_frame(event_log: pd.DataFrame, case_ids: list[str] | set[str], activity_name: str, end_time: pd.Timestamp) -> float

The percentage of cases belonging to the group of cases where a certain activity has occurred after a specific time frame.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
activity_name str

The name of the activity.

required
end_time Timestamp

The end time.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_percentage_where_activity_after_time_frame(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], activity_name: str, end_time: pd.Timestamp
) -> float:
    """
    The percentage of cases belonging to the group of cases where a certain activity has occurred after a specific time frame.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        activity_name: The name of the activity.
        end_time: The end time.

    """
    numerator = case_count_where_activity_after_time_frame(event_log, case_ids, activity_name, end_time)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

case_percentage_where_activity_before_time_frame(event_log: pd.DataFrame, case_ids: list[str] | set[str], activity_name: str, start_time: pd.Timestamp) -> float

The percentage of cases belonging to the group of cases where a certain activity has occurred before a specific time frame.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
activity_name str

The name of the activity.

required
start_time Timestamp

The start time.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_percentage_where_activity_before_time_frame(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], activity_name: str, start_time: pd.Timestamp
) -> float:
    """
    The percentage of cases belonging to the group of cases where a certain activity has occurred before a specific time frame.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        activity_name: The name of the activity.
        start_time: The start time.

    """
    numerator = case_count_where_activity_before_time_frame(event_log, case_ids, activity_name, start_time)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

case_percentage_where_activity_during_time_frame(event_log: pd.DataFrame, case_ids: list[str] | set[str], activity_name: str, start_time: pd.Timestamp, end_time: pd.Timestamp) -> float

The percentage of cases belonging to the group of cases where a certain activity has occurred within a specific time frame.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
activity_name str

The name of the activity.

required
start_time Timestamp

The start time.

required
end_time Timestamp

The end time.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_percentage_where_activity_during_time_frame(
    event_log: pd.DataFrame,
    case_ids: list[str] | set[str],
    activity_name: str,
    start_time: pd.Timestamp,
    end_time: pd.Timestamp,
) -> float:
    """
    The percentage of cases belonging to the group of cases where a certain activity has occurred within a specific time frame.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        activity_name: The name of the activity.
        start_time: The start time.
        end_time: The end time.

    """
    numerator = case_count_where_activity_during_time_frame(event_log, case_ids, activity_name, start_time, end_time)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

case_percentage_where_end_activity_is_a(event_log: pd.DataFrame, case_ids: list[str] | set[str], a_activity_name: str) -> float

The percentage of cases belonging to the group of cases where a specific activity is the last instantiated one.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
a_activity_name str

The name of the activity.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_percentage_where_end_activity_is_a(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], a_activity_name: str
) -> float:
    """
    The percentage of cases belonging to the group of cases where a specific activity is the last instantiated one.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        a_activity_name: The name of the activity.

    """
    numerator = case_count_where_end_activity_is_a(event_log, case_ids, a_activity_name)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

case_percentage_where_start_activity_is_a(event_log: pd.DataFrame, case_ids: list[str] | set[str], a_activity_name: str) -> float

The percentage of cases belonging to the group of cases where a specific activity is the first instantiated one.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
a_activity_name str

The name of the activity.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_percentage_where_start_activity_is_a(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], a_activity_name: str
) -> float:
    """
    The percentage of cases belonging to the group of cases where a specific activity is the first instantiated one.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        a_activity_name: The name of the activity.

    """
    numerator = case_count_where_start_activity_is_a(event_log, case_ids, a_activity_name)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

case_percentage_with_missed_deadline(event_log: pd.DataFrame, case_ids: list[str] | set[str], deadline: pd.Timestamp) -> float

The percentage of cases belonging to the group of cases whose latest event occurs after a given deadline.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
deadline Timestamp

The deadline time stamp.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_percentage_with_missed_deadline(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], deadline: pd.Timestamp
) -> float:
    """
    The percentage of cases belonging to the group of cases whose latest event occurs after a given deadline.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        deadline: The deadline time stamp.

    """
    resulting_cases = {case_id for case_id in case_ids if cases_utils.endt(event_log, case_id) > deadline}
    return len(resulting_cases)

case_percentage_with_rework(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float

The percentage of cases belonging to the group of cases where there has been rework.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def case_percentage_with_rework(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The percentage of cases belonging to the group of cases where there has been rework.

    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    numerator = case_count_with_rework(event_log, case_ids)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

client_count_and_total_cost_ratio(event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal['sgl', 'sum']) -> float

The ratio between the number of distinct clients associated with cases in the group of cases, and the total cost associated with all activity instances of the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for cost calculations. "sum": Considers the sum of all events of activity instances for cost calculations.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def client_count_and_total_cost_ratio(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal["sgl", "sum"]
) -> float:
    """
    The ratio between the number of distinct clients associated with cases in the group of cases,
    and the total cost associated with all activity instances of the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for cost calculations.
            "sum": Considers the sum of all events of activity instances for cost calculations.

    """
    numerator = flexibility_groups_indicators.client_count(event_log, case_ids)
    denominator = cost_groups_indicators.total_cost(event_log, case_ids, aggregation_mode)
    return safe_division(numerator, denominator)

desired_activity_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], desired_activities: set[str]) -> int

The number of instantiated activities whose occurence is desirable in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
desired_activities set[str]

The set of desired activities.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def desired_activity_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], desired_activities: set[str]
) -> int:
    """
    The number of instantiated activities whose occurence is desirable in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        desired_activities: The set of desired activities.

    """
    activities_in_group = set()
    for case_id in case_ids:
        activities_in_group.update(cases_utils.act(event_log, case_id))

    return len(desired_activities.intersection(activities_in_group))

expected_activity_instance_count_by_human_resource(event_log: pd.DataFrame, case_ids: list[str] | set[str], human_resource_name: str) -> float

The expected number of times that any activity is instantiated by a specific human resource in a case belonging to the group of cases

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
human_resource_name str

The name of the human resource.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_activity_instance_count_by_human_resource(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], human_resource_name: str
) -> float:
    """
    The expected number of times that any activity is instantiated by a specific human resource in a case belonging to the group of cases

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        human_resource_name: The name of the human resource.

    """
    numerator = activity_instance_count_by_human_resource(event_log, case_ids, human_resource_name)
    denominator = general_groups_indicators.case_count(event_log, case_ids)

    return safe_division(numerator, denominator)

expected_activity_instance_count_by_role(event_log: pd.DataFrame, case_ids: list[str] | set[str], role_name: str) -> int | float

The expected number of times that any activity is instantiated by a specific role in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
role_name str

The name of the role.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_activity_instance_count_by_role(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], role_name: str
) -> int | float:
    """
    The expected number of times that any activity is instantiated by a specific role in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        role_name: The name of the role.

    """
    numerator = activity_instance_count_by_role(event_log, case_ids, role_name)
    denominator = general_groups_indicators.case_count(event_log, case_ids)

    return safe_division(numerator, denominator)

expected_automated_activity_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]) -> float

The expected number of automated activities that occur in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
automated_activities set[str]

The set of automated activities.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_automated_activity_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]
) -> float:
    """
    The expected number of automated activities that occur in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        automated_activities: The set of automated activities.

    """
    count = 0
    for case_id in case_ids:
        count += quality_cases_indicators.automated_activity_count(event_log, case_id, automated_activities)

    numerator = count
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_automated_activity_instance_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]) -> float

The expected number of times that an automated activity is instantiated in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
automated_activities set[str]

The set of automated activities.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_automated_activity_instance_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]
) -> float:
    """
    The expected number of times that an automated activity is instantiated in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        automated_activities: The set of automated activities.

    """
    numerator = automated_activity_instance_count(event_log, case_ids, automated_activities)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_client_count_and_total_cost_ratio(event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal['sgl', 'sum']) -> float

The ratio between the number of distinct clients associated with cases in the group of cases, and the total cost associated with all activity instances of the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for cost calculations. "sum": Considers the sum of all events of activity instances for cost calculations.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_client_count_and_total_cost_ratio(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal["sgl", "sum"]
) -> float:
    """
    The ratio between the number of distinct clients associated with cases in the group of cases,
    and the total cost associated with all activity instances of the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for cost calculations.
            "sum": Considers the sum of all events of activity instances for cost calculations.

    """
    numerator = flexibility_groups_indicators.client_count(event_log, case_ids)
    denominator = cost_groups_indicators.total_cost(event_log, case_ids, aggregation_mode)
    return safe_division(numerator, denominator)

expected_desired_activity_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], desired_activities: set[str]) -> float

The expected number of instantiated activities whose occurrence is desirable in a case belonging to the groupd of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
desired_activities set[str]

The set of desired activities.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_desired_activity_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], desired_activities: set[str]
) -> float:
    """
    The expected number of instantiated activities whose occurrence is desirable in a case belonging to the groupd of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        desired_activities: The set of desired activities.

    """
    group_desired_activity_count = 0
    for case_id in case_ids:
        group_desired_activity_count += quality_cases_indicators.desired_activity_count(
            event_log, case_id, desired_activities
        )

    return safe_division(
        group_desired_activity_count, general_groups_indicators.activity_instance_count(event_log, case_ids)
    )

expected_human_resource_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int | float

The expected number of human resources that are involved in the execution of a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_human_resource_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int | float:
    """
    The expected number of human resources that are involved in the execution of a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    human_resources_count = 0
    for case_id in case_ids:
        human_resources_count += quality_cases_indicators.human_resource_count(event_log, case_id)

    return safe_division(human_resources_count, general_groups_indicators.activity_instance_count(event_log, case_ids))

expected_non_automated_activity_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]) -> float

The expected number of non-automated activities that occur in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
automated_activities set[str]

The set of automated activities.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_non_automated_activity_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]
) -> float:
    """
    The expected number of non-automated activities that occur in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        automated_activities: The set of automated activities.

    """
    non_automated_activity_count = 0
    for case_id in case_ids:
        non_automated_activity_count += quality_cases_indicators.non_automated_activity_count(
            event_log, case_id, automated_activities
        )
    return safe_division(
        non_automated_activity_count, general_groups_indicators.activity_instance_count(event_log, case_ids)
    )

expected_non_automated_activity_instance_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]) -> float

The expected number of times that an non-automated activity is instantiated in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
automated_activities set[str]

The set of automated activities.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_non_automated_activity_instance_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]
) -> float:
    """
    The expected number of times that an non-automated activity is instantiated in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        automated_activities: The set of automated activities.

    """
    numerator = non_automated_activity_instance_count(event_log, case_ids, automated_activities)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_outcome_unit_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal['sgl', 'sum']) -> float

The expected outcome units associated with all activity instances of a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_outcome_unit_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal["sgl", "sum"]
) -> float:
    """
    The expected outcome units associated with all activity instances of a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        aggregation_mode: The aggregation mode.

    """
    numerator = outcome_unit_count(event_log, case_ids, aggregation_mode)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_overall_quality(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float

The overall quality associated with the outcome of a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_overall_quality(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The overall quality associated with the outcome of a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    cases_overall_quality = 0
    for case_id in case_ids:
        cases_overall_quality += quality_cases_indicators.overall_quality(event_log, case_id)

    numerator = cases_overall_quality
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_repeatability(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float

The expected inverted ratio between the number of activities that occur in a case belonging to the group of cases, and the number of times that an activity has been instantiated in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_repeatability(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The expected inverted ratio between the number of activities that occur in a case belonging to the group of cases,
    and the number of times that an activity has been instantiated in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    sum_of_activity_counts = 0

    for case_id in case_ids:
        sum_of_activity_counts += general_cases_indicators.activity_count(event_log, case_id)

    return 1 - safe_division(
        sum_of_activity_counts, general_groups_indicators.activity_instance_count(event_log, case_ids)
    )

expected_rework_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int | float

The expected number of times that any activity has been instantiated again, after its first instantiation, in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_rework_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int | float:
    """
    The expected number of times that any activity has been instantiated again, after its first instantiation, in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    numerator = rework_count(event_log, case_ids)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_rework_count_by_value(event_log: pd.DataFrame, case_ids: list[str] | set[str], value: float) -> float

The expected number of times that the activity has been instantiated again, after it has been instantiated a certain number of times, in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
value float

The certain number of times that the activity has been instantiated.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_rework_count_by_value(event_log: pd.DataFrame, case_ids: list[str] | set[str], value: float) -> float:
    """
    The expected number of times that the activity has been instantiated again, after it has been instantiated a certain number of times,
    in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        value: The certain number of times that the activity has been instantiated.

    """
    numerator = rework_count_by_value(event_log, case_ids, value)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_rework_of_activities_subset(event_log: pd.DataFrame, case_ids: list[str] | set[str], activities_subset: set[str]) -> float

The expected number of times that any activity belonging to a subset of activities has been instantiated again, after its first instantiation, in a case belonging to the group of cases.

Source code in process_performance_indicators/indicators/quality/groups.py
def expected_rework_of_activities_subset(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], activities_subset: set[str]
) -> float:
    """
    The expected number of times that any activity belonging to a subset of activities has been instantiated again, after its first instantiation,
    in a case belonging to the group of cases.

    """
    numerator = rework_of_activities_subset(event_log, case_ids, activities_subset)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_rework_percentage(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float

The expected percentage of times that any activity has been instantiated again, after its first instantiation, in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_rework_percentage(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The expected percentage of times that any activity has been instantiated again, after its first instantiation,
    in a case belonging to the group of cases.


    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    sum_of_rework_percentages = 0
    for case_id in case_ids:
        sum_of_rework_percentages += quality_cases_indicators.rework_percentage(event_log, case_id)

    numerator = sum_of_rework_percentages
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_rework_percentage_by_value(event_log: pd.DataFrame, case_ids: list[str] | set[str], value: float) -> float

The expected percentage of times that any activity has been instantiated again, after it has been instantiated a certain number of times, in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
value float

The certain number of times that the activity has been instantiated.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_rework_percentage_by_value(event_log: pd.DataFrame, case_ids: list[str] | set[str], value: float) -> float:
    """
    The expected percentage of times that any activity has been instantiated again, after it has been instantiated a certain number of times, in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        value: The certain number of times that the activity has been instantiated.

    """
    sum_of_rework_by_value_percentages = 0
    for case_id in case_ids:
        sum_of_rework_by_value_percentages += quality_cases_indicators.rework_percentage_by_value(
            event_log, case_id, value
        )

    numerator = sum_of_rework_by_value_percentages
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_rework_time(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> pd.Timedelta

The expected total elapsed time for all times that any activity has been instantiated again, after its first instantiation, in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_rework_time(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> pd.Timedelta:
    """
    The expected total elapsed time for all times that any activity has been instantiated again, after its first instantiation,
    in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    return safe_division(rework_time(event_log, case_ids), general_groups_indicators.case_count(event_log, case_ids))

expected_successful_outcome_unit_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal['sgl', 'sum']) -> int | float

The expected outcome units associated with all activity instances of a case belonging to the group of cases, after deducting those that were unsuccessfully completed.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for outcome unit count calculations. "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_successful_outcome_unit_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal["sgl", "sum"]
) -> int | float:
    """
    The expected outcome units associated with all activity instances of a case belonging to the group of cases, after deducting those that were unsuccessfully completed.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for outcome unit count calculations.
            "sum": Considers the sum of all events of activity instances for outcome unit count calculations.


    """
    numerator = successful_outcome_unit_count(event_log, case_ids, aggregation_mode)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_successful_outcome_unit_percentage(event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal['sgl', 'sum']) -> float

The expected percentage of outcome units associated with all activity instances of a case belonging to the group of cases that were successfully completed.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for outcome unit count calculations. "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_successful_outcome_unit_percentage(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal["sgl", "sum"]
) -> float:
    """
    The expected percentage of outcome units associated with all activity instances of a case belonging to the group of cases that were successfully completed.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for outcome unit count calculations.
            "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

    """
    sum_of_successful_outcome_unit_percentages = 0
    for case_id in case_ids:
        sum_of_successful_outcome_unit_percentages += quality_cases_indicators.successful_outcome_unit_percentage(
            event_log, case_id, aggregation_mode
        )

    numerator = sum_of_successful_outcome_unit_percentages
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_total_cost_and_client_count_ratio(event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal['sgl', 'sum']) -> float

The expected ratio between the total cost associated with all activity instances of the group of cases, and the number of distinct clients associated with cases in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for cost calculations. "sum": Considers the sum of all events of activity instances for cost calculations.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_total_cost_and_client_count_ratio(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal["sgl", "sum"]
) -> float:
    """
    The expected ratio between the total cost associated with all activity instances of the group of cases, and the number of distinct clients associated with cases in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for cost calculations.
            "sum": Considers the sum of all events of activity instances for cost calculations.

    """
    numerator = flexibility_groups_indicators.client_count(event_log, case_ids)
    denominator = cost_groups_indicators.total_cost(event_log, case_ids, aggregation_mode)
    return safe_division(numerator, denominator)

expected_unwanted_activity_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]) -> int

The expected number of unwanted activities that occur in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
unwanted_activities set[str]

The set of unwanted activities names.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_unwanted_activity_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]
) -> int:
    """
    The expected number of unwanted activities that occur in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        unwanted_activities: The set of unwanted activities names.

    """
    sum_of_unwanted_activity_counts = 0
    for case_id in case_ids:
        sum_of_unwanted_activity_counts += quality_cases_indicators.unwanted_activity_count(
            event_log, case_id, unwanted_activities
        )
    return sum_of_unwanted_activity_counts

expected_unwanted_activity_instance_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]) -> float

The expected number of times that an unwanted activity is instantiated in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
unwanted_activities set[str]

The set of unwanted activities names.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_unwanted_activity_instance_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]
) -> float:
    """
    The expected number of times that an unwanted activity is instantiated in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        unwanted_activities: The set of unwanted activities names.

    """
    numerator = unwanted_activity_instance_count(event_log, case_ids, unwanted_activities)
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_unwanted_activity_instance_percentage(event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]) -> float

The expected percentage of times that an unwanted activity is instantiated in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
unwanted_activities set[str]

The set of unwanted activities names.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_unwanted_activity_instance_percentage(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]
) -> float:
    """
    The expected percentage of times that an unwanted activity is instantiated in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        unwanted_activities: The set of unwanted activities names.

    """
    sum_of_unwanted_activity_instance_percentages = 0
    for case_id in case_ids:
        sum_of_unwanted_activity_instance_percentages += quality_cases_indicators.unwanted_activity_instance_percentage(
            event_log, case_id, unwanted_activities
        )

    numerator = sum_of_unwanted_activity_instance_percentages
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

expected_unwanted_activity_percentage(event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]) -> float

The expected percentage of unwanted activities that occur in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
unwanted_activities set[str]

The set of unwanted activities names.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def expected_unwanted_activity_percentage(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]
) -> float:
    """
    The expected percentage of unwanted activities that occur in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        unwanted_activities: The set of unwanted activities names.

    """
    sum_of_unwanted_activity_percentages = 0
    for case_id in case_ids:
        sum_of_unwanted_activity_percentages += quality_cases_indicators.unwanted_activity_percentage(
            event_log, case_id, unwanted_activities
        )

    numerator = sum_of_unwanted_activity_percentages
    denominator = general_groups_indicators.case_count(event_log, case_ids)
    return safe_division(numerator, denominator)

human_resource_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int

The number of human resources that are involved in the execution of the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def human_resource_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int:
    """
    The number of human resources that are involved in the execution of the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    cases_human_resources = set()
    for case_id in case_ids:
        cases_human_resources.update(cases_utils.hres(event_log, case_id))
    return len(cases_human_resources)

non_automated_activity_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]) -> int

The number of non-automated activities that occur in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
automated_activities set[str]

The set of automated activities.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def non_automated_activity_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]
) -> int:
    """
    The number of non-automated activities that occur in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        automated_activities: The set of automated activities.

    """
    activities_in_cases = set()
    for case_id in case_ids:
        activities_in_cases.update(cases_utils.act(event_log, case_id))

    return len(activities_in_cases.difference(automated_activities))

non_automated_activity_instance_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]) -> int

The number of times that an non-automated activity is instantiated in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
automated_activities set[str]

The set of automated activities.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def non_automated_activity_instance_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], automated_activities: set[str]
) -> int:
    """
    The number of times that an non-automated activity is instantiated in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        automated_activities: The set of automated activities.

    """
    non_automated_activity_instance_count = 0
    for case_id in case_ids:
        non_automated_activity_instance_count += quality_cases_indicators.non_automated_activity_instance_count(
            event_log, case_id, automated_activities
        )
    return non_automated_activity_instance_count

outcome_unit_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal['sgl', 'sum']) -> float

The outcome units associated with all instantiations of the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for outcome unit calculations. "sum": Considers the sum of all events of activity instances for outcome unit calculations.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def outcome_unit_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal["sgl", "sum"]
) -> float:
    """
    The outcome units associated with all instantiations of the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for outcome unit calculations.
            "sum": Considers the sum of all events of activity instances for outcome unit calculations.

    """
    outcome_unit_count = 0
    for case_id in case_ids:
        outcome_unit_count += quality_cases_indicators.outcome_unit_count(event_log, case_id, aggregation_mode)
    return outcome_unit_count

repeatability(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float

The inverted ratio between the number of activities that occur in the group of cases, and the number of times that an activity has been instantiated in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def repeatability(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The inverted ratio between the number of activities that occur in the group of cases, and the number of times
    that an activity has been instantiated in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    return 1 - safe_division(
        general_groups_indicators.activity_count(event_log, case_ids),
        general_groups_indicators.activity_instance_count(event_log, case_ids),
    )

rework_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int

The number of times that any activity has been instantiated again, after its first instantiation, in a case belonging to the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def rework_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int:
    """
    The number of times that any activity has been instantiated again, after its first instantiation, in a case belonging to the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    sum_of_rework_counts = 0
    for case_id in case_ids:
        sum_of_rework_counts += quality_cases_indicators.rework_count(event_log, case_id)
    return sum_of_rework_counts

rework_count_by_value(event_log: pd.DataFrame, case_ids: list[str] | set[str], value: float) -> int

The number of times that the activity has been instantiated again, after it has been instantiated a certain number of times, in every case of the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
value float

The certain number of times that the activity has been instantiated.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def rework_count_by_value(event_log: pd.DataFrame, case_ids: list[str] | set[str], value: float) -> int:
    """
    The number of times that the activity has been instantiated again, after it has been instantiated a certain number of times, in every case of the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        value: The certain number of times that the activity has been instantiated.

    """
    sum_of_rework_counts = 0
    for case_id in case_ids:
        sum_of_rework_counts += quality_cases_indicators.rework_count_by_value(event_log, case_id, value)
    return sum_of_rework_counts

rework_of_activities_subset(event_log: pd.DataFrame, case_ids: list[str] | set[str], activities_subset: set[str]) -> int

The number of times that any activity belonging to a subset of activities has been instantiated again, after its first instantiation, in every case of the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
activities_subset set[str]

The subset of activities.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def rework_of_activities_subset(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], activities_subset: set[str]
) -> int:
    """
    The number of times that any activity belonging to a subset of activities has been instantiated again, after its first instantiation,
    in every case of the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        activities_subset: The subset of activities.

    """
    sum_of_rework_counts = 0
    for case_id in case_ids:
        sum_of_rework_counts += quality_cases_indicators.rework_of_activities_subset(
            event_log, case_id, activities_subset
        )
    return sum_of_rework_counts

rework_percentage(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float

The percentage of times that any activity has been instantiated again, after its first instantiation, in every case of the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def rework_percentage(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The percentage of times that any activity has been instantiated again, after its first instantiation,
    in every case of the group of cases.


    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    numerator = rework_count(event_log, case_ids)
    denominator = general_groups_indicators.activity_instance_count(event_log, case_ids)
    return safe_division(numerator, denominator)

rework_percentage_by_value(event_log: pd.DataFrame, case_ids: list[str] | set[str], value: float) -> float

The percentage of times that any activity has been instantiated again, after it has been instantiated a certain number of times, in every case of the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
value float

The certain number of times that the activity has been instantiated.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def rework_percentage_by_value(event_log: pd.DataFrame, case_ids: list[str] | set[str], value: float) -> float:
    """
    The percentage of times that any activity has been instantiated again, after it has been instantiated a certain number of times,
    in every case of the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        value: The certain number of times that the activity has been instantiated.

    """
    numerator = rework_count_by_value(event_log, case_ids, value)
    denominator = general_groups_indicators.activity_instance_count(event_log, case_ids)
    return safe_division(numerator, denominator)

rework_time(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> pd.Timedelta

The total elapsed time for all times that any activity has been instantiated again, after its first instantiation, in every case of group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def rework_time(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> pd.Timedelta:
    """
    The total elapsed time for all times that any activity has been instantiated again, after its first instantiation,
    in every case of group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.

    """
    sum_of_rework_times = pd.Timedelta(0)
    for case_id in case_ids:
        sum_of_rework_times += quality_cases_indicators.rework_time(event_log, case_id)
    return sum_of_rework_times

successful_outcome_unit_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal['sgl', 'sum']) -> int

The outcome units associated with all activity instances of the group of cases, after deducting those that were unsuccessfully completed.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for outcome unit count calculations. "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def successful_outcome_unit_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal["sgl", "sum"]
) -> int:
    """
    The outcome units associated with all activity instances of the group of cases, after deducting those that were unsuccessfully completed.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for outcome unit count calculations.
            "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

    """
    sum_of_successful_outcome_unit_counts = 0
    for case_id in case_ids:
        sum_of_successful_outcome_unit_counts += quality_cases_indicators.successful_outcome_unit_count(
            event_log, case_id, aggregation_mode
        )
    return sum_of_successful_outcome_unit_counts

successful_outcome_unit_percentage(event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal['sgl', 'sum']) -> float

The percentage of outcome units associated with all activity instances of the group of cases that were successfully completed.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for outcome unit count calculations. "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def successful_outcome_unit_percentage(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal["sgl", "sum"]
) -> float:
    """
    The percentage of outcome units associated with all activity instances of the group of cases that were successfully completed.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for outcome unit count calculations.
            "sum": Considers the sum of all events of activity instances for outcome unit count calculations.

    """
    numerator = successful_outcome_unit_count(event_log, case_ids, aggregation_mode)
    denominator = outcome_unit_count(event_log, case_ids, aggregation_mode)
    return safe_division(numerator, denominator)

total_cost_and_client_count_ratio(event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal['sgl', 'sum']) -> float

The ratio between the total cost associated with all activity instances of the group of cases, and the number of distinct clients associated with cases in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
aggregation_mode Literal['sgl', 'sum']

The aggregation mode. "sgl": Considers single events of activity instances for cost calculations. "sum": Considers the sum of all events of activity instances for cost calculations.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def total_cost_and_client_count_ratio(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], aggregation_mode: Literal["sgl", "sum"]
) -> float:
    """
    The ratio between the total cost associated with all activity instances of the group of cases, and the number of distinct clients associated with cases in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        aggregation_mode: The aggregation mode.
            "sgl": Considers single events of activity instances for cost calculations.
            "sum": Considers the sum of all events of activity instances for cost calculations.

    """
    numerator = flexibility_groups_indicators.client_count(event_log, case_ids)
    denominator = cost_groups_indicators.total_cost(event_log, case_ids, aggregation_mode)
    return safe_division(numerator, denominator)

unwanted_activity_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]) -> int

The number of unwanted activities that occur in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
unwanted_activities set[str]

The set of unwanted activities names.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def unwanted_activity_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]
) -> int:
    """
    The number of unwanted activities that occur in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        unwanted_activities: The set of unwanted activities names.

    """
    activities_in_group = set()
    for case_id in case_ids:
        activities_in_group.update(cases_utils.act(event_log, case_id))

    return len(unwanted_activities.intersection(activities_in_group))

unwanted_activity_instance_count(event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]) -> int

The number of times that an unwanted activity is instantiated in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
unwanted_activities set[str]

The set of unwanted activities names.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def unwanted_activity_instance_count(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]
) -> int:
    """
    The number of times that an unwanted activity is instantiated in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        unwanted_activities: The set of unwanted activities names.

    """
    sum_of_unwanted_activity_instance_counts = 0
    for case_id in case_ids:
        sum_of_unwanted_activity_instance_counts += quality_cases_indicators.unwanted_activity_instance_count(
            event_log, case_id, unwanted_activities
        )
    return sum_of_unwanted_activity_instance_counts

unwanted_activity_instance_percentage(event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]) -> float

The percentage of times that an unwanted activity is instantiated in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
unwanted_activities set[str]

The set of unwanted activities names.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def unwanted_activity_instance_percentage(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]
) -> float:
    """
    The percentage of times that an unwanted activity is instantiated in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        unwanted_activities: The set of unwanted activities names.

    """
    numerator = unwanted_activity_instance_count(event_log, case_ids, unwanted_activities)
    denominator = general_groups_indicators.activity_instance_count(event_log, case_ids)
    return safe_division(numerator, denominator)

unwanted_activity_percentage(event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]) -> float

The percentage of unwanted activities that occur in the group of cases.

Parameters:

Name Type Description Default
event_log DataFrame

The event log.

required
case_ids list[str] | set[str]

The case IDs.

required
unwanted_activities set[str]

The set of unwanted activities names.

required
Source code in process_performance_indicators/indicators/quality/groups.py
def unwanted_activity_percentage(
    event_log: pd.DataFrame, case_ids: list[str] | set[str], unwanted_activities: set[str]
) -> float:
    """
    The percentage of unwanted activities that occur in the group of cases.

    Args:
        event_log: The event log.
        case_ids: The case IDs.
        unwanted_activities: The set of unwanted activities names.

    """
    numerator = unwanted_activity_count(event_log, case_ids, unwanted_activities)
    denominator = general_groups_indicators.activity_count(event_log, case_ids)
    return safe_division(numerator, denominator)