Example #1
0
def import_log_from_string(log_string, parameters=None, variant=ITERPARSE):
    """
    Imports a log from a string

    Parameters
    -----------
    log_string
        String that contains the XES
    parameters
        Parameters of the algorithm, including
            timestamp_sort -> Specify if we should sort log by timestamp
            timestamp_key -> If sort is enabled, then sort the log by using this key
            reverse_sort -> Specify in which direction the log should be sorted
            index_trace_indexes -> Specify if trace indexes should be added as event attribute for each event
            max_no_traces_to_import -> Specify the maximum number of traces to import from the log
            (read in order in the XML file)
    variant
        Variant of the algorithm to use, including:
            iterparse, nonstandard

    Returns
    -----------
    log
        Trace log object
    """
    temp_file = string_to_file.import_string_to_temp_file(log_string, "xes")
    return import_log(temp_file, parameters=parameters, variant=variant)
Example #2
0
def import_log_from_string(log_string, parameters=None, variant=PANDAS):
    """
    Import a CSV log from a string

    Parameters
    -----------
    log_string
        String that contains the CSV
    parameters
        Parameters of the importing:
            - Parameters.SEP
            - Parameters.QUOTECHAR
            - Parameters.NROWS
            - Parameters.SORT
            - Parameters.SORT_FIELD
            - Parameters.TIMEST_FORMAT
            - Parameters.TIMEST_COLUMNS
            - Parameters.ENCODING
    variant
        Variant of the dataframe manager:
            - Variants.PANDAS

    Returns
    -----------
    log
        Event log object
    """
    temp_file = string_to_file.import_string_to_temp_file(log_string, "csv")
    return import_event_stream(temp_file, parameters=parameters, variant=variant)
Example #3
0
def import_log_from_string(log_string, parameters=None, variant="pandas"):
    """
    Import a CSV log from a string

    Parameters
    -----------
    log_string
        String that contains the CSV
    parameters
        Parameters of the algorithm, including
            sep -> column separator
            quotechar -> (if specified) Character that starts/end big strings in CSV
            nrows -> (if specified) Maximum number of rows to read from the CSV
            sort -> Boolean value that tells if the CSV should be ordered
            sort_field -> If sort option is enabled, then the CSV is automatically sorted by the specified column
    variant
        Variant of the algorithm to use, including:
            pandas

    Returns
    -----------
    log
        Event log object
    """
    temp_file = string_to_file.import_string_to_temp_file(log_string, "csv")
    return import_log(temp_file, parameters=parameters, variant=variant)
Example #4
0
def __import_log_from_string(log_string,
                             parameters=None,
                             variant=DEFAULT_VARIANT):
    """
    Imports a log from a string

    Parameters
    -----------
    log_string
        String that contains the XES
    parameters
        Parameters of the algorithm, including
            Parameters.TIMESTAMP_SORT -> Specify if we should sort log by timestamp
            Parameters.TIMESTAMP_KEY -> If sort is enabled, then sort the log by using this key
            Parameters.REVERSE_SORT -> Specify in which direction the log should be sorted
            Parameters.INSERT_TRACE_INDICES -> Specify if trace indexes should be added as event attribute for each event
            Parameters.MAX_TRACES -> Specify the maximum number of traces to import from the log (read in order in the XML file)
    variant
        Variant of the algorithm to use, including:
            - Variants.ITERPARSE
            - Variants.LINE_BY_LINE

    Returns
    -----------
    log
        Trace log object
    """

    temp_file = string_to_file.import_string_to_temp_file(log_string, "xes")
    return apply(temp_file, parameters=parameters, variant=variant)