Giter VIP home page Giter VIP logo

Comments (5)

Javert899 avatar Javert899 commented on August 22, 2024

Hi,

Thanks for signaling.

Actually, the change you suggested has been implemented in the 'develop' branch, in the pm4py.objects.conversion.log.versions.to_trace_log.apply method, changing "include_case_attributes=" to True from False

from pm4py-core.

fmannhardt avatar fmannhardt commented on August 22, 2024

Thanks. I assume you mean the changes done in 27577e1?

However, what I meant is that it is impossible to know which attributes was used as trace identifier or case_glue as you denote it in PM4PY after having obtained the TraceLog. There might be multiple case attributes so it would not be clear (without computation) which one was used.

from pm4py-core.

Javert899 avatar Javert899 commented on August 22, 2024

Hi,

In the 'develop' branch now, when the trace log is converted to event log, and the include_case_attributes is (as default) True, then it is checked that the attribute "concept:name" is present, and if not is added considering the case id glue

A.k.a. the code changes as follows:

        if include_case_attributes:
            for k in event.keys():
                if k.startswith(case_attribute_prefix):
                    trace_attr[k.replace(case_attribute_prefix, '')] = event[k]
            if xes.DEFAULT_TRACEID_KEY not in trace_attr:
                trace_attr[xes.DEFAULT_TRACEID_KEY] = trace_attr[case_glue]

from pm4py-core.

fmannhardt avatar fmannhardt commented on August 22, 2024

Just trying this with the new v1.0.19 and now I get this error when trying to convert an EventLog with case_id patient to a TraceLog:

 Error in py_call_impl(callable, dots$args, dots$keywords) : 
   KeyError: 'patient'
 
 Detailed traceback: 
   File "C:\Users\felixm\AppData\Local\CONTIN~1\ANACON~1\envs\R-RETI~1\lib\site-packages\pm4py\objects\conversion\log\factory.py", line 14, in apply
     return VERSIONS[variant](log, parameters=parameters)
   File "C:\Users\felixm\AppData\Local\CONTIN~1\ANACON~1\envs\R-RETI~1\lib\site-packages\pm4py\objects\conversion\log\versions\to_trace_log.py", line 26, in apply
     case_attribute_prefix=case_pref, enable_deepcopy=enable_deepcopy)
   File "C:\Users\felixm\AppData\Local\CONTIN~1\ANACON~1\envs\R-RETI~1\lib\site-packages\pm4py\objects\conversion\log\versions\to_trace_log.py", line 66, in transform_event_log_to_trace_log
     trace_attr[xes.DEFAULT_TRACEID_KEY] = trace_attr[case_glue]

It seems that you assume that all case attributes have some kind of prefix? Could this limitation be dropped? In many cases attributes have a domain specific meaning and it would be weird having to rename it. It also prevents me from converting an R event log to PM4PY an back without changes.

Edit:
Just to add, for my use case on converting from bupaR to PM4PY and back I can workaround this issue by simply adding an artificial attribute and not converting trace attributes. So, the comment is more on the general PM4PY design choice. :)

from pm4py-core.

Javert899 avatar Javert899 commented on August 22, 2024

Hi,

Sorry for that. The bug you are seeing is obviously an error introduced by my side on last release. Indeed, it should be
trace_attr[xes.DEFAULT_TRACEID_KEY] = glue

I've pushed this hotfix into release 1.0.20

For the remainder of your observations, there could be two options:

  • provide to the conversion to trace log a list of attributes to consider as trace attributes
  • provide an utility to "move later" event attributes to trace level

from pm4py-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.