backend.api.modules.general_router

Contains the router for general informtion API endpoints.

Attributes

Functions

get_general_information() → EndpointReturnType)

Fetches general information about the process from Celonis.

transform_counts_df_to_endpoint_format(→ TableType)

Transforms the counts DataFrame into a format suitable for the endpoint.

transform_traces_df_to_endpoint_format(→ TableType)

Transforms the traces DataFrame into a format suitable for the endpoint.

transform_dfg_df_to_endpoint_format(→ GraphType)

Transforms the DFG DataFrame into a format suitable for the endpoint.

get_unique_activities(→ List[str])

Extracts unique activities from the activities DataFrame.

Module Contents

backend.api.modules.general_router.router
type backend.api.modules.general_router.TableType = Dict[str, List[str] | List[List[str]]]
type backend.api.modules.general_router.GraphType = Dict[str, List[Dict[str, str]]]
type backend.api.modules.general_router.EndpointReturnType = Dict[str, List[TableType] | List[GraphType]]
async backend.api.modules.general_router.get_general_information(celonis: backend.celonis_connection.celonis_connection_manager.CelonisConnectionManager = Depends(get_celonis_connection)) EndpointReturnType

Fetches general information about the process from Celonis.

This endpoint retrieves the number of cases, activities, trace variants, and the Directly-Follows Graph (DFG) representation of the process.

Parameters:

celonis (optional) – The CelonisConnectionManager. Defaults to Depends(get_celonis_connection).

Returns:

A dictionary containing tables with general information and a graph representing the Directly-Follows Graph (DFG).

backend.api.modules.general_router.transform_counts_df_to_endpoint_format(counts_df: pandas.DataFrame) TableType

Transforms the counts DataFrame into a format suitable for the endpoint.

Parameters:

counts_df – The DataFrame containing counts of cases, activities, and trace variants.

Returns:

A dictionary encoding a table with general information.

backend.api.modules.general_router.transform_traces_df_to_endpoint_format(traces_df: pandas.DataFrame) TableType

Transforms the traces DataFrame into a format suitable for the endpoint.

Parameters:

traces_df – The DataFrame containing traces and their counts.

Returns:

A dictionary encoding a table with trace variants and their counts.

backend.api.modules.general_router.transform_dfg_df_to_endpoint_format(dfg_df: pandas.DataFrame, activities_df: pandas.DataFrame) GraphType

Transforms the DFG DataFrame into a format suitable for the endpoint.

This function encodes the DFG as a dictionary with nodes and edges, where nodes represent unique activities and edges represent the relationships between them with their respective counts.

Parameters:
  • dfg_df – The DataFrame containing the DFG representation.

  • activities_df – The DataFrame containing the activities.

Returns:

A dictionary containing the encoded DFG.

backend.api.modules.general_router.get_unique_activities(activities_df: pandas.DataFrame) List[str]

Extracts unique activities from the activities DataFrame.

Parameters:

activities_df – The DataFrame containing activities.

Returns:

A list of the unique activities.