Skip to content

analysis.py

BaseAnalysis (CelonisApiObject)

Base Analysis object to interact with Celonis Process Analytics API.

published: BasePublishedDocument property writable

Get/Set the Base Published Document of the Analysis.

draft property writable

Get/Set the Base Draft Document of the Analysis.

saved_formulas: CelonisCollection[BaseAnalysisSavedFormula] property readonly

Get all saved formulas of the Analysis.

API

  • GET: /process-mining/analysis/v1.2/api/analysis/{analysis_id}/kpi

Returns:

Type Description
CelonisCollection[BaseAnalysisSavedFormula]

A Collection of Analysis Saved Formulas.

images: CelonisCollection[BaseAnalysisImage] property readonly

Get all images of the Analysis.

API

  • GET: /process-mining/analysis/v1.2/api/analysis/{analysis_id}/assets

Returns:

Type Description
CelonisCollection[BaseAnalysisImage]

A Collection of Analysis Images.

create_saved_formula(self, name, description='', template='', parameters=None, **kwargs)

Creates a new Saved Formula.

API

  • POST: /process-mining/analysis/v1.2/api/analysis/{analysis_id}/kpi
    {
        "name": name,
        "description": description,
        "template": template,
        "parameters": parameters
    }
    

Parameters:

Name Type Description Default
name str

Name of the Saved Formula.

required
description str

Description of the KPI.

''
template str

Template of the Saved Formula.

''
parameters

Parameters of the Saved Formula.

None
**kwargs

optional

{}

Returns:

Type Description
BaseAnalysisSavedFormula

The newly created Saved Formula.

create_image_upload(self, path)

Upload an image to the Analysis.

API

  • POST: /process-mining/analysis/v1.2/api/analysis/{analysis_id}/assets
    {
        "file": <bytes>
    }
    

Parameters:

Name Type Description Default
path Union[str, pathlib.Path]

Path to the image file.

required

Returns:

Type Description
Dict

Upload result.

backup_content(self, backup_path='.')

Make a Backup of the Analysis in JSON format.

Parameters:

Name Type Description Default
backup_path Union[str, pathlib.Path]

The path where the Backup Folder will be created.

'.'

Returns:

Type Description
Path

Path to the Backup Folder.

rebuild_content_from_backup(self, backup_path, keep_analysis_name=True)

Overwrites the contents of the Analysis object with content from the Backup Folder.

Parameters:

Name Type Description Default
backup_path Union[str, pathlib.Path]

The path where the Backup Folder is located.

required
keep_analysis_name bool

If True keeps the Analysis name, else take from Backup.

True

process_shared_selection_url(self, shared_url)

Returns PQL object containing variables and filters from shared selection url.

Parameters:

Name Type Description Default
shared_url str

The shared url.

required

Returns:

Type Description
PQL

A PQL query containing variables and filters.

Analysis (BaseAnalysis)

Analysis object to interact with Celonis Process Mining API.

url: str property readonly

API

  • /process-mining/analysis/v1.2/api/analysis/{analysis_id}

Get the web link to the Analysis.

data: Dict property writable

Response data from the Celonis API. If static is set to False, every time you set the data property will execute a POST request to the resource API endpoint to update the remote resource in Celonis EMS.

Examples:

o = celonis.<api-service>.find("<name or ID")

# This will execute a `POST` request to '<celonis_url>/<api-service>/api/...'
o.data["name"] = "New Name"

workspace: Workspace property readonly

Get the Analysis Workspace.

Returns:

Type Description
Workspace

The Analysis Workspace object.

datamodel: Datamodel property readonly

Get the Analysis Datamodel.

Returns:

Type Description
Datamodel

The Analysis Datamodel object.

delete(self)

Deletes the Analysis.

API

  • DELETE: /process-mining/analysis/v1.2/api/analysis/{analysis_id}

move(self, to, target_workspace)

Moves the Analysis to the specified Workspace in another Team.

API

  • POST: /process-mining/api/analysis/move
    {
        "analysisIdsToReplace": [],
        "analysisId": self.id,
        "processId": target_workspace,
        "teamDomain": to
    }
    

Parameters:

Name Type Description Default
to str

Team name (e.g. move for https://move.eu-1.celonis.cloud)

required
target_workspace Union[str, Workspace]

Workspace ID or Workspace object where the analysis should be copied to.

required

get_data_frame(self, pql_query, **kwargs)

Exports the results of a PQL query as pyarrow.parquet.ParquetFile and converts it to a pandas.DataFrame. Uses get_data_file.

Parameters:

Name Type Description Default
pql_query Union[pycelonis.celonis_api.pql.pql.PQL, pycelonis.celonis_api.pql.pql.PQLColumn]

The table query to be executed.

required
**kwargs

optional arguments passed to get_data_file.

{}

Returns:

Type Description
DataFrame

Dataframe containing the results of the query.

get_data_file(self, pql_query, file_path=None, export_type='PARQUET', variables=None, chunked_download=False)

Exports the results of a PQL query as pyarrow.parquet.ParquetFile and returns the path to the exported file.

Parameters:

Name Type Description Default
pql_query Union[pycelonis.celonis_api.pql.pql.PQL, pycelonis.celonis_api.pql.pql.PQLColumn, str]

The table query to be executed.

required
file_path Union[str, pathlib.Path]

The output path for the export. Defaults to tmpdir/celonis_pql_export_<current_time>.parquet.

None
export_type str

Export filetype. One of [PARQUET, EXCEL, CSV].

'PARQUET'
variables List[Dict]

Only needed when PQL query contains saved formulas that contain variables.

None
chunked_download bool

Can be used to download big data sets in chunks (Datamodel permissions required).

False

Returns:

Type Description
Path

Path to downloaded file containing the results of the query.

StudioAnalysis (Analysis)

Analysis object to interact with Celonis Process Analytics API. Use celonis_api.studio.analysis.Analysis to interact with Studio Analysis.

url: str property readonly

API

  • /process-analytics/analysis/v2/api/analysis/{analysis_id}

This method is not implemented.

delete(self)

This method is not implemented.

move(self, to, target_workspace)

This method is not implemented.

backup_content(self, backup_path='.')

This method is not implemented.

rebuild_content_from_backup(self, backup_path, keep_analysis_name=True)

This method is not implemented.

process_shared_selection_url(self, shared_url)

This method is not implemented.

BaseAnalysisDocument (CelonisApiObject)

Base Analysis Document object to interact with Celonis Process Analytics API.

Parameters:

Name Type Description Default
parent CelonisApiObject

Parent Analysis object.

required

sheets: CelonisCollection[BaseAnalysisSheet] property writable

Get/Set all Analysis Document Sheets.

Returns:

Type Description
CelonisCollection[BaseAnalysisSheet]

A Collection of Analysis Sheets.

components: CelonisCollection[BaseAnalysisComponent] property readonly

Get all components of all Analysis Document Sheets.

Returns:

Type Description
CelonisCollection[BaseAnalysisComponent]

A Collection of Analysis Components.

variables: List[Dict] property writable

Get/Set all Variables of the Analysis Document.

pql_filter: Optional[pycelonis.celonis_api.pql.pql.PQLFilter] property readonly

Get the PQLFilter query of the Analysis filter (load script).

create_sheet(self, name)

Create a new Analysis Document Sheet.

Parameters:

Name Type Description Default
name str

Name of the new Analysis Document Sheet.

required

Returns:

Type Description
BaseAnalysisSheet

The newly created Analysis Document Sheet.

calculate_variables(self, variables=None)

Calculates static values of all Variables of the Analysis Document.

Parameters:

Name Type Description Default
variables List[Dict]

Optional list of variables to calculate.

None

Returns:

Type Description
List[Dict]

Variables with results of static variable formulas.

create_variable(self, name, value, var_type='text_replacement')

Creates a new Analysis Document Variable.

Parameters:

Name Type Description Default
name str

Name of the new Variable.

required
value str

Value of the new Variable.

required
var_type str

Type of the new Variable.

'text_replacement'

Returns:

Type Description
Dict

The newly created Analysis Document Variable.

BasePublishedDocument (BaseAnalysisDocument)

Analysis Published Document object to interact with Celonis Process Analytics API.

url: str property readonly

API

  • /process-mining/analysis/v1.2/api/analysis/{analysis_id}/published'

data property writable

Response data from the Celonis API. If static is set to False, every time you set the data property will execute a POST request to the resource API endpoint to update the remote resource in Celonis EMS.

Examples:

o = celonis.<api-service>.find("<name or ID")

# This will execute a `POST` request to '<celonis_url>/<api-service>/api/...'
o.data["name"] = "New Name"

BaseDraftDocument (BaseAnalysisDocument)

Analysis Draft Document object to interact with Celonis Process Analytics API.

url: str property readonly

API

  • /process-mining/analysis/v1.2/api/analysis/{analysis_id}/autosave'

data property writable

Response data from the Celonis API. If static is set to False, every time you set the data property will execute a POST request to the resource API endpoint to update the remote resource in Celonis EMS.

Examples:

o = celonis.<api-service>.find("<name or ID")

# This will execute a `POST` request to '<celonis_url>/<api-service>/api/...'
o.data["name"] = "New Name"

publish(self)

Converts the Analysis Draft Document into a Published Document.

BaseAnalysisSheet (CelonisDataObject)

Analysis Sheet object to interact with Celonis Process Analytics API.

data property readonly

A reference to the data of this object.

components: CelonisCollection[BaseAnalysisComponent] property writable

Get/Set all Analysis Sheet Components.

Returns:

Type Description
CelonisCollection[BaseAnalysisComponent]

A Collection of Analysis Components.

pql_filter: Optional[pycelonis.celonis_api.pql.pql.PQLFilter] property readonly

Get the PQLFilter query of the Analysis filter (load script).

BaseAnalysisComponent (CelonisDataObject)

Base Analysis Components object to interact with Celonis Process Analytics API.

data property readonly

A reference to the data of this object.

pql_filter: Optional[pycelonis.celonis_api.pql.pql.PQLFilter] property readonly

Get the PQLFilter query of the Analysis filter (load script).

pql_columns: List[pycelonis.celonis_api.pql.pql.PQLColumn] property readonly

Get all PQL Columns with all dimensions and KPIs of the Analysis Component.

Returns:

Type Description
List[pycelonis.celonis_api.pql.pql.PQLColumn]

A List of PQL Columns.

pql_query: List[Dict] property readonly

Get the PQL query needed to recreate the component including filters and variables.

Returns:

Type Description
List[Dict]

A List of Dictionaries containing

get_data_frame(self, ignore_name_mapping=False, chunked_download=False)

Get a pandas.DataFrame with the Analysis components data.

Args: !!! chunked_download "Can be used to download big data sets in chunks (Datamodel permissions required)." This might be necessary if the data of the component is too large to be downloaded in a single chunk.

Returns:

Type Description
DataFrame

Dataframe containing the Analysis components data.

BaseAnalysisImageComponent (BaseAnalysisComponent)

Analysis Image Components object to interact with Celonis Process Analytics API.

set_image(self, image)

Sets the image of the image component.

Parameters:

Name Type Description Default
image BaseAnalysisImage

The image that the component should be set to.

required

BaseAnalysisTable (BaseAnalysisComponent)

Analysis Table Components object to interact with Celonis Process Analytics API.

add_column(self, column, column_type, **kwargs)

Adds a PQL Column to the Analysis Table.

Parameters:

Name Type Description Default
column Union[str, pycelonis.celonis_api.pql.pql.PQLColumn]

The column name to add or the PQLColumn with the column to add.

required
column_type str

Type of the column added. One of [dimension, kpi].

required

remove_column(self, column_name)

Removes a Column to the Analysis Table.

Parameters:

Name Type Description Default
column_name

The column name to remove.

required

BaseAnalysisSavedFormula (CelonisDataObject)

Analysis Saved Formula object to interact with Celonis Process Analytics API.

data property readonly

A reference to the data of this object.

delete(self)

API

  • DELETE: /process-mining/analysis/v1.2/api/analysis/{analysis_id}/kpi/{formula_id}

BaseAnalysisImage (CelonisDataObject)

Analysis Image object to interact with Celonis Process Analytics API.

data property readonly

A reference to the data of this object.

download(self, file_path='./image.png')

Downloads the Analysis Image to the specified path.

API

  • GET: /process-mining/analysis/v1.2/api/analysis/{analysis_id}/assets/{asset_id}/image

Parameters:

Name Type Description Default
file_path Union[str, pathlib.Path]

Path where the image should be downloaded.

'./image.png'

Returns:

Type Description
Path

Path to the downloaded file.