Skip to main content

Is there any way to get the value of text components or variables defined inside process analytics sheet from machine learning script.

Similar action for OLAP table is possible as mentioned in the below documentation:

https://celonis.github.io/pycelonis/notebooks/01_Pulling_data.html

How can we perform the same for text components or variables?

I am also interested in how to achieve this! I want to take manual input from a user (an integer value) in Analysis sheet and use it as a variable in my Python script.

Hello.

Currently only the OLAP object is available.

You can use the ML Component to send variables to ML.

https://help.celonis.cloud/help/x/fYkeAg

.

As a last resource, you can create a tab with an OLAP and get all the desired values.

Best Regards.

DS Team.


hi Tandonaditi,
There is a solution to do this, but its quite a workaround. Please follow these steps:
  1. Connect to the Celonis instance using the API key
  2. Find the analysis you want to extract data from
  3. Create a back-up of the analysis, this will be saved as an JSON file
  4. Read the JSON file and find the component you want to extract
  5. Get the value you want to extract.

Note that in my situation, the KPI component was the only component (thus index 0). You should check the JSON file to determine the index of the component you want, and use that when extracting the value from the dict. If you have multiple KPIs, you can also iterate over the dict content.
Again, its a workaround, but maybe it helps for your use case.
Best regards,
Jan-peter

You can use this code:
import json

# Login
celonis = pycelonis.get_celonis()

# Show all analyses
celonis.analyses

# Select the analysis you want to extract from
analysis = celonis.analyses.find('<<insert_analysis_id>>')

# Create backup and specify the path to store
analysis.backup_content('../data/backups')

# Read JSON file
with open('../data/backups/Backup of Analysis - P2P Setup Data Model Training/published_sheet_01.json',) as f:
# returns JSON object as a dictionary
data = json.load(f)

value = data['components'][0]['kpiValue']
print(value)



code822604 40.3 KB
That was the whole usecase, I want to backup analysis by taking api key, analysis id and other required input from the user by making a dashboard in process analytics and then push those json files to github by taking repo name and token from the same dashboard.
Well, thats then good news. The backing up to Git was one of the example notebooks that was provided some time ago, but unfortunately its not part of the documentation anymore. Good luck with you further project!

Reply