-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'PMPY-2090' into 'integration'
PMPY-2090 Consistency checks when importing/exporting OCELs Closes PMPY-2090 See merge request process-mining/pm4py/pm4py-core!988
- Loading branch information
Showing
14 changed files
with
91 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from pm4py.objects.ocel.obj import OCEL | ||
from typing import Optional, Dict, Any | ||
|
||
|
||
def apply(ocel: OCEL, parameters: Optional[Dict[Any, Any]] = None) -> OCEL: | ||
""" | ||
Forces the consistency of the OCEL, ensuring that the event/object identifier, | ||
event/object type are of type string and non-empty. | ||
Parameters | ||
-------------- | ||
ocel | ||
OCEL | ||
parameters | ||
Possible parameters of the method | ||
Returns | ||
-------------- | ||
ocel | ||
Consistent OCEL | ||
""" | ||
if parameters is None: | ||
parameters = {} | ||
|
||
fields = { | ||
"events": ["ocel:eid", "ocel:activity"], | ||
"objects": ["ocel:oid", "ocel:type"], | ||
"relations": ["ocel:eid", "ocel:oid", "ocel:activity", "ocel:type"], | ||
"o2o": ["ocel:oid", "ocel:oid_2"], | ||
"e2e": ["ocel:eid", "ocel:eid_2"], | ||
"object_changes": ["ocel:oid"] | ||
} | ||
|
||
for tab in fields: | ||
df = getattr(ocel, tab) | ||
for fie in fields[tab]: | ||
df.dropna(subset=[fie], how="any", inplace=True) | ||
df[fie] = df[fie].astype("string") | ||
df = df[df[fie].str.len() > 0] | ||
|
||
return ocel |