Skip to main content

Dear Celopeers,

 

Currently I am trying to extend the simulation capacity of Celonis in the Machine Learning workbench. To do so, I need to import an event log through, I think, PyCelonis. I would like to use the UI of the Process Explorer in a premade analysis of Studio to define the activities and connections that are imported.

The following link suggests this used to be possible within PyCelonis 1.7 using the ‘Share your selection’ URL. (Analysis: Pull data - PyCelonis) This appears like a very elegant and user friendly solution to me.

However, I can't figure out how to do so using the newer PyCelonis 2.12. I did find out how to navigate to the correct space, package, and analysis through different IDs. But the Python methods attached to the analysis object created through .get_analysis() do not make apparent how to perform the filtered data extraction I alluded to above.

Any ideas or references on how to do this?

 

Thank you in advance,

 

Bas

I’m assuming you have this portion:

studio = celonis.studio
space = studio.get_space(einsert space ID])
package = space.get_package(einsert package ID])
analysis = package.get_analysis(sinsert analysis ID])

So couple of things. You’re going to want to load the json package. Everything in PyCelonis past 2.0.0 are JSON dictionaries. 

dictionary = analysis.json_dict()
d = json.loads(dictionaryt'serialized_content'])

The ‘serialized_content’ is where everything that makes up the analysis lives. KPIs, Variables, etc.

To get to the components you need to put the analysis in draft mode. Within the ‘serialized_content’, there is a ‘document’ key. You’ll access that. 

draft = dn'draft']
doc = draftd'document']

Within ‘document’, you’ll have everything you’re looking for, I believe, for this use case.

dict_keys(e'id', 'name', 'theme', 'editMode', 'kpiViews', 'palettes', 'variables', 'KPILibrary', 'components', 'colorMappings', 'translationMap', 'allowBpmnExport', 'allowRawDataExport', 'rawDataExportLimit', 'publishedSelections', 'statelessLoadScript', 'showFiltersForViewers'])

These are the keys. You can see ‘components’. That’ll probably be what you’re looking for.


Reply