Formatters package
The package contains different formatters implementation - allowing to process standard file formats of event logs (XES,MXML and CSV) into data containers.
Submodules
sax.core.process_data.formatters.base_formatter module
- class sax.core.process_data.formatters.base_formatter.BaseFormatter(parameters=None)
Bases:
object
Formatter base class which can transform event log data from a file in different event log formats to standard raw event log representation for further use.
- abstract extract_data(event_log_data) RawEventData
Create RawEventData data object from the provided event log file
Parameters
event_log_data : The path designation of the event log file. type event_log_data : File
Returns
A RawEventData representing the event log in a tabular format. type : RawEventData
sax.core.process_data.formatters.csv_formatter module
- class sax.core.process_data.formatters.csv_formatter.CSVFormatter(parameters=None)
Bases:
BaseFormatter
Formatter class for CSV event log files transforming the file to standard event log dataframe representation
- class Parameters(*args, **kwargs)
Bases:
object
Constants representing various default values for mandatory attributes for CSV-based event log
- ACTIVITY = 'Source'
- CASE_ID = 'Id'
- CSV_SEPARATOR = ','
- RESOURCE_ID = 'Resource'
- STARTTIME_COLUMN = ''
- TIMESTAMP = 'Timestamp'
- TIMESTAMP_FORMAT = '%Y-%m-%d %H:%M:%S%z'
- TYPE = 'Type'
- extract_data(event_log_data, separator=',') RawEventData
Extract tabular data from the provided CSV event log file, instantiate raw data object containing the tabular data.
Parameters
- event_log_datafile
File representing the event log data, in CSV format.
- separatorstr, optional
The separator used in the CSV file, by default Constants.CSV_SEPARATOR.
Returns
- RawEventData
A RawEventData representing the event log in a raw event format.
Raises
- ValueError
If the event_log_data argument is not a file.
- extract_from_dataframe(dataframe: DataFrame) RawEventData
Extract event log tabular data from the provided dataframe, instantiate process raw event data object.
Parameters
- dataframepd.DataFrame
Dataframe representing the event log data.
Returns
- RawEventData
A RawEventData representing the event log in a raw event format.
Raises
- ValueError
If the dataframe argument is not a pandas DataFrame.
sax.core.process_data.formatters.mxml_formatter module
- class sax.core.process_data.formatters.mxml_formatter.MXMLConstants(*args, **kwargs)
Bases:
object
Constants representing standart metafields in the MXML format
PROCESS_INSTANCE: designatation of a the process entry
TRACE_INSTANCE: designation of separate trace within the process
ID_ATTRIBUTE: designation of the attribute representing trace id
EVENT_TYPE: designation of event lifecycle element
ACTIVITY: designation of activity element
RESOURCE: designation of resource element
ATTRIBUTE: designation of attribute element
ATTRIBUTE_NAME: designation of attribute name field within attribute element
- ACTIVITY = 'WorkflowModelElement'
- ATTRIBUTE = 'attribute'
- ATTRIBUTE_NAME = 'name'
- DATA = 'Data'
- ELEMENT_ID = 'elementId'
- EVENT_TYPE = 'EventType'
- ID_ATTRIBUTE = 'id'
- PROCESS_ID = 'processId'
- PROCESS_INSTANCE = './/ProcessInstance'
- RESOURCE = 'originator'
- TIMESTAMP = 'Timestamp'
- TRACE_INSTANCE = './/AuditTrailEntry'
- class sax.core.process_data.formatters.mxml_formatter.MXMLFormatter(parameters=None)
Bases:
BaseFormatter
Formatter class for MXML event log files transforming the file to standard event log dataframe representation
- class Parameters(*args, **kwargs)
Bases:
object
Constants representing various default values for mandatory attributes values for MXML-based event log
Attributes
- ACTIVITYstr
Default value for activity key.
- CASE_IDstr
Default value for case id key.
- TYPEstr
Default value for lifecycle event key.
- TIMESTAMPstr
Default value for timestamp key.
- TIMESTAMP_FORMATstr
Default value for timestamp format key.
- RESOURCE_IDstr
Default value for resource id key.
- ACTIVITY = 'concept:name'
- CASE_ID = 'case:concept:name'
- RESOURCE_ID = 'org:resource'
- TIMESTAMP = 'time:timestamp'
- TIMESTAMP_FORMAT = '%Y-%m-%d %H:%M:%S.%f'
- TYPE = 'lifecycle:transition'
- extract_data(event_log_data) BaseProcessDataObject
Extract tabular data from the provided MXML event log file, instantiate raw data object containing the tabular data.
Parameters
- param event_log_data:
File representing the event log data, in MXML format
- type event_log_data:
file
Returns
- return:
A RawEventData representing the event log in a raw event format
- rtype:
RawEventData
Raises
- raises ValueError:
If the event log data is not in MXML format.
sax.core.process_data.formatters.xes_formatter module
- class sax.core.process_data.formatters.xes_formatter.XESFormatter(parameters=None)
Bases:
BaseFormatter
Formatter class for XES event log files transforming the file to standard event log dataframe representation
- class Parameters(*args, **kwargs)
Bases:
object
Constants representing various default values for mandatory attributes values for XES-based event log
Attributes
- ACTIVITYstr
Default value for activity key.
- CASE_IDstr
Default value for case id key.
- TYPEstr
Default value for lifecycle event key.
- TIMESTAMPstr
Default value for timestamp key.
- TIMESTAMP_FORMATstr
Default value for timestamp format key.
- RESOURCE_IDstr
Default value for resource id key.
- ACTIVITY = 'concept:name'
- CASE_ID = 'case:concept:name'
- RESOURCE_ID = 'org:resource'
- TIMESTAMP = 'time:timestamp'
- TIMESTAMP_FORMAT = '%Y-%m-%d %H:%M:%S.%f'
- TYPE = 'lifecycle:transition'
- extract_data(event_log_data) RawEventData
Extract tabular data from the provided XES event log file, instantiate raw data object containing the tabular data.
Args: :param event_log_data: File representing the event log data, in XES format :type event_log_data: file
Returns: :return: A RawEventData representing the event log in a raw event format :rtype: RawEventData
Raises: :raises ValueError: If the event log data is not in MXML format.