Skip to content

Flexibility Dimension Indicators

process_performance_indicators.indicators.flexibility.activities

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

The ratio between the number of times that a specific activity has been instantiated in the event log, and 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/flexibility/activities.py
def activity_instance_and_human_resource_count_ratio(event_log: pd.DataFrame, activity_name: str) -> float:
    """
    The ratio between the number of times that a specific activity has been instantiated in the event log, and 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.

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

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

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
Source code in process_performance_indicators/indicators/flexibility/activities.py
def client_count(event_log: pd.DataFrame, activity_name: str) -> int:
    """
    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.

    """
    assert_column_exists(event_log, StandardColumnNames.CLIENT)
    activity_events = event_log[event_log[StandardColumnNames.ACTIVITY] == activity_name]
    case_ids = set(activity_events[StandardColumnNames.CASE_ID].unique())
    cases_events = event_log[event_log[StandardColumnNames.CASE_ID].isin(case_ids)]
    return len(set(cases_events[StandardColumnNames.CLIENT].unique()))

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

The number of activities that have been instantiated directly after the activity of interest 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
Source code in process_performance_indicators/indicators/flexibility/activities.py
def directly_follows_relations_count(event_log: pd.DataFrame, activity_name: str) -> int:
    """
    The number of activities that have been instantiated directly after the activity of interest in the event log.

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

    """
    relations = set()
    for instance_id in activities_utils.inst(event_log, activity_name):
        _next_instances = instances_utils.next_instances(event_log, instance_id)
        next_activity_names = {
            instances_utils.act(event_log, instance_id_prime) for instance_id_prime in _next_instances
        }
        relations.update(next_activity_names)

    return len(relations)

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/flexibility/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))

process_performance_indicators.indicators.flexibility.cases

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

The ratio between the number of activities that occur in the case, and 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/flexibility/cases.py
def activity_and_role_count_ratio(event_log: pd.DataFrame, case_id: str) -> float:
    """
    The ratio between the number of activities that occur in the case, and 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.

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

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

The ratio between the number of times that any activity has been instantiated in the case, and 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/flexibility/cases.py
def activity_instance_and_human_resource_count_ratio(event_log: pd.DataFrame, case_id: str) -> float:
    """
    The ratio between the number of times that any activity has been instantiated in the case, and 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.

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

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

The ratio between the number of activity pairs where one has been instantiated directly after the other in the case, and the number of 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
Source code in process_performance_indicators/indicators/flexibility/cases.py
def directly_follows_relations_and_activity_count_ratio(event_log: pd.DataFrame, case_id: str) -> float:
    """
    The ratio between the number of activity pairs where one has been instantiated directly after the other in the case, and the number of activities that occur in the case.

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

    """
    return safe_division(
        directly_follows_relations_count(event_log, case_id),
        general_cases_indicators.activity_count(event_log, case_id),
    )

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

The number of activity pairs where one has been instantiated directly after the other 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/flexibility/cases.py
def directly_follows_relations_count(event_log: pd.DataFrame, case_id: str) -> int:
    """
    The number of activity pairs where one has been instantiated directly after the other in the case.

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

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

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/flexibility/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))

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

The number of optional activities that are instantiated in the case. An activity is considered optional if there is at least one case in the event log where it does not occur.

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/flexibility/cases.py
def optional_activity_count(event_log: pd.DataFrame, case_id: str) -> int:
    """
    The number of optional activities that are instantiated in the case. An activity is considered optional if there is at least one case in the event log where it does not occur.

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

    """
    target_activities = set(event_log[event_log[StandardColumnNames.CASE_ID] == case_id][StandardColumnNames.ACTIVITY])

    other_cases = event_log[event_log[StandardColumnNames.CASE_ID] != case_id]
    other_case_activities = (
        other_cases.groupby(StandardColumnNames.CASE_ID)[StandardColumnNames.ACTIVITY].apply(set).tolist()
    )

    optional_activities = {
        activity
        for activity in target_activities
        if any(activity not in activities for activities in other_case_activities)
    }

    return len(optional_activities)

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

The ratio between the number of optional activities that are instantiated in the case, and the number of 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
Source code in process_performance_indicators/indicators/flexibility/cases.py
def optionality(event_log: pd.DataFrame, case_id: str) -> float:
    """
    The ratio between the number of optional activities that are instantiated in the case, and the number of activities that occur in the case.

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

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

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

The number of human resource roles 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/flexibility/cases.py
def role_count(event_log: pd.DataFrame, case_id: str) -> int:
    """
    The number of human resource roles that are involved in the execution of the case.

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

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

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

The percentage of cases in the event log who possess the same variant as 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/flexibility/cases.py
def variant_case_coverage(event_log: pd.DataFrame, case_id: str) -> float:
    """
    The percentage of cases in the event log who possess the same variant as the case.

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

    """
    case_traces = cases_utils.trace(event_log, case_id)
    all_case_ids = set(event_log[StandardColumnNames.CASE_ID].unique())
    count = 0

    for c_prime in all_case_ids:
        # if case_traces and c_prime's trace have any common activities
        if case_traces.intersection(cases_utils.trace(event_log, c_prime)):
            count += 1

    return safe_division(count, len(all_case_ids))

process_performance_indicators.indicators.flexibility.groups

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

The ratio between the number of activities that occur in the group of cases, and 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/flexibility/groups.py
def activity_and_role_count_ratio(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The ratio between the number of activities that occur in the group of cases, and 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.

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

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

The ratio between the number of times that any activity has been instantiated in the group of cases, and the number of human resources that are involved in the execution of 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/flexibility/groups.py
def activity_instance_and_human_resource_count_ratio(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The ratio between the number of times that any activity has been instantiated in the group of cases, and the number of human resources that are involved in the execution of cases in the group of cases.

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

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

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

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/flexibility/groups.py
def client_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int:
    """
    The number of distinct clients associated with cases in the group of cases.

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

    """
    assert_column_exists(event_log, StandardColumnNames.CLIENT)
    clients = set()
    for case_id in case_ids:
        clients.update(
            set(event_log[StandardColumnNames.CLIENT][event_log[StandardColumnNames.CASE_ID] == case_id].unique())
        )
    return len(clients)

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

The ratio between the number of activity pairs where one has been instantiated directly after the other in the group of cases, and the number of 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
Source code in process_performance_indicators/indicators/flexibility/groups.py
def directly_follows_relations_and_activity_count_ratio(
    event_log: pd.DataFrame, case_ids: list[str] | set[str]
) -> float:
    """
    The ratio between the number of activity pairs where one has been instantiated directly after the other in the group of cases, and the number of activities that occur in the group of cases.

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

    """
    return safe_division(
        directly_follows_relations_count(event_log, case_ids),
        general_groups_indicators.activity_count(event_log, case_ids),
    )

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

The number of activity pairs where one has been instantiated directly after the other 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/flexibility/groups.py
def directly_follows_relations_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int:
    """
    The number of activity pairs where one has been instantiated directly after the other in the group of cases.

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

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

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

The ratio between the expected number of activities that occur in a case belonging to the group of cases, and the expected number of human resource roles 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/flexibility/groups.py
def expected_activity_and_role_count_ratio(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The ratio between the expected number of activities that occur in a case belonging to the group of cases, and the expected number of human resource roles 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.

    """
    sum_of_activities_count = 0
    sum_of_roles_count = 0
    for case_id in case_ids:
        sum_of_activities_count += general_cases_indicators.activity_count(event_log, case_id)
        sum_of_roles_count += general_cases_indicators.role_count(event_log, case_id)

    numerator = sum_of_activities_count
    denominator = sum_of_roles_count
    return safe_division(numerator, denominator)

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

The ratio between the expected number of times that any activity is instantiated in a case belonging to the group of cases, an the expected number of huma resources that are involed 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/flexibility/groups.py
def expected_activity_instance_and_human_resource_count_ratio(
    event_log: pd.DataFrame, case_ids: list[str] | set[str]
) -> float:
    """
    The ratio between the expected number of times that any activity is instantiated in a case belonging to the group of cases, an the expected number of huma resources that are involed in the execution of a case belonging to the group of cases.

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

    """
    sum_of_human_resources_counts = 0
    for case_id in case_ids:
        sum_of_human_resources_counts += general_cases_indicators.human_resource_count(event_log, case_id)

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

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

The ratio between the number of distinct clients associated with cases in the group cases, and the number of cases 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/flexibility/groups.py
def expected_client_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The ratio between the number of distinct clients associated with cases in the group cases, and the number of cases belonging to the group of cases.

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

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

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

The ratio between the epected number of activity pairs where one has been instantiated directly after the other in a case belonging to the group of cases, and the expected number of 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
Source code in process_performance_indicators/indicators/flexibility/groups.py
def expected_directly_follows_relations_and_activity_count_ratio(
    event_log: pd.DataFrame, case_ids: list[str] | set[str]
) -> float:
    """
    The ratio between the epected number of activity pairs where one has been instantiated directly after the other in a case belonging to the group of cases, and the expected number of activities that occur in a case belonging to the group of cases.

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

    """
    sum_of_directly_follows_relations_counts = 0
    sum_of_activities_counts = 0
    for case_id in case_ids:
        sum_of_directly_follows_relations_counts += cases_flexibility_indicators.directly_follows_relations_count(
            event_log, case_id
        )
        sum_of_activities_counts += general_cases_indicators.activity_count(event_log, case_id)

    return safe_division(sum_of_directly_follows_relations_counts, sum_of_activities_counts)

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

The expected number of activity pairs where one has been instantiated directly after the other 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/flexibility/groups.py
def expected_directly_follows_relations_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The expected number of activity pairs where one has been instantiated directly after the other in a case belonging to the group of cases.

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

    """
    sum_of_directly_follows_relations_counts = 0
    for case_id in case_ids:
        sum_of_directly_follows_relations_counts += cases_flexibility_indicators.directly_follows_relations_count(
            event_log, case_id
        )
    return safe_division(
        sum_of_directly_follows_relations_counts, general_groups_indicators.case_count(event_log, case_ids)
    )

expected_human_resource_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> 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/flexibility/groups.py
def expected_human_resource_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> 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.

    """
    _is_case_ids_empty(case_ids)

    sum_of_human_resources_counts = 0
    for case_id in case_ids:
        sum_of_human_resources_counts += general_cases_indicators.human_resource_count(event_log, case_id)

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

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

The expected number of optional activities that are instantiated in a case belonging to the group of cases. An activity is considered optional if there is at least one case in the event log where it does not occur.

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/flexibility/groups.py
def expected_optional_activity_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The expected number of optional activities that are instantiated in a case belonging to the group of cases. An activity is considered optional if there is at least one case in the event log where it does not occur.

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

    """
    sum_of_optional_activities_counts = 0
    for case_id in case_ids:
        sum_of_optional_activities_counts += cases_flexibility_indicators.optional_activity_count(event_log, case_id)

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

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

The ratio between the expected number of optional activities that are instantiated in a case belonging to the group of cases, and the expected number of 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
Source code in process_performance_indicators/indicators/flexibility/groups.py
def expected_optionality(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The ratio between the expected number of optional activities that are instantiated in a case belonging to the group of cases, and the expected number of activities that occur in a case belonging to the group of cases.

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

    """
    sum_of_optional_activities_counts = 0
    sum_of_activities_counts = 0
    for case_id in case_ids:
        sum_of_optional_activities_counts += cases_flexibility_indicators.optional_activity_count(event_log, case_id)
        sum_of_activities_counts += general_cases_indicators.activity_count(event_log, case_id)

    numerator = sum_of_optional_activities_counts
    denominator = sum_of_activities_counts
    return safe_division(numerator, denominator)

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

The expected number of human resource roles that are involed 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/flexibility/groups.py
def expected_role_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The expected number of human resource roles that are involed in the execution of the group of cases.

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

    """
    _is_case_ids_empty(case_ids)
    sum_of_role_counts = 0
    for case_id in case_ids:
        sum_of_role_counts += general_cases_indicators.role_count(event_log, case_id)
    numerator = sum_of_role_counts
    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 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/flexibility/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 cases in the group of cases.

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

    """
    _is_case_ids_empty(case_ids)
    count = 0
    for case_id in case_ids:
        count += len(cases_utils.hres(event_log, case_id))
    return count

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

The number of optional activities that are instantiated in the group of cases. An activity is considered optional if there is at least one case in the event log where it does not occur.

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/flexibility/groups.py
def optional_activity_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int:
    """
    The number of optional activities that are instantiated in the group of cases. An activity is considered optional if there is at least one case in the event log where it does not occur.

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

    """
    group_case_ids_log = event_log[event_log[StandardColumnNames.CASE_ID].isin(case_ids)]
    group_activities_per_case = (
        group_case_ids_log.groupby(StandardColumnNames.CASE_ID)[StandardColumnNames.ACTIVITY].apply(set).tolist()
    )
    group_unique_activities = set().union(*group_activities_per_case) if group_activities_per_case else set()

    other_cases = event_log[~event_log[StandardColumnNames.CASE_ID].isin(case_ids)]
    other_cases_activities = (
        other_cases.groupby(StandardColumnNames.CASE_ID)[StandardColumnNames.ACTIVITY].apply(set).tolist()
    )

    optional_activities = {
        activity
        for activity in group_unique_activities
        if any(activity not in activities for activities in other_cases_activities)
    }

    return len(optional_activities)

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

The ratio between the number of optional activities that are instantiated in the group of cases, and the number of 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
Source code in process_performance_indicators/indicators/flexibility/groups.py
def optionality(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The ratio between the number of optional activities that are instantiated in the group of cases, and the number of activities that occur in the group of cases.

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

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

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

The ratio between the number of human resource roles that are involved in the execution of the case, and the number of variants that are observed for 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/flexibility/groups.py
def role_and_variant_count_ratio(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The ratio between the number of human resource roles that are involved in the execution of the case, and the number of variants that are observed for the group of cases.

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

    """
    return safe_division(
        general_groups_indicators.role_count(event_log, case_ids),
        variant_count(event_log, case_ids),
    )

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

The number of human resource roles that are involed 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/flexibility/groups.py
def role_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int:
    """
    The number of human resource roles that are involed in the execution of the group of cases.

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

    """
    _is_case_ids_empty(case_ids)
    count = 0
    for case_id in case_ids:
        count += len(cases_utils.role(event_log, case_id))
    return count

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

The percentage of cases in the event log who possess the same variant as any case 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/flexibility/groups.py
def variant_case_coverage(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> float:
    """
    The percentage of cases in the event log who possess the same variant as any case in the group of cases.

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

    """
    group_variants = groups_utils.variants(event_log, case_ids)
    all_case_ids = set(event_log[StandardColumnNames.CASE_ID].unique())
    count = 0
    for c in all_case_ids:
        # if group_variants and c's trace have any common activities
        if group_variants.intersection(cases_utils.trace(event_log, c)):
            count += 1
    return safe_division(count, len(all_case_ids))

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

The number of variants that are observed for 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/flexibility/groups.py
def variant_count(event_log: pd.DataFrame, case_ids: list[str] | set[str]) -> int:
    """
    The number of variants that are observed for the group of cases.

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

    """
    return len(groups_utils.variants(event_log, case_ids))