blob: 9c16a5e3133a12feb1c6cbbc8190b3bd6b6e1fb6 [file] [log] [blame]
=================
Utility Functions
=================
Distill provides two useful utility functions that can aid in the preprocessing of UserALE logs. They include the
``epoch_to_datetime`` and ``get_UUID`` functions. Below we provide an overview of both:
Epoch to Datetime
-----------------
The ``epoch_to_datetime`` function will take a string representation of unix time and convert it into an integer. An example
usage of this function is as follows:
.. code:: python
string_time = "1000"
integer_time = distill.epoch_to_datetime(string_time)
integer_time # 1000 represented as an integer
This function is specifically useful when preprocessing UserALE logs for Segmentation as logs can sometimes be read in as strings
and Segmentation requires that they be formatted as either integers or ``datetime`` objects.
Get UUID
--------
The ``get_uuid`` function will take a UserALE log and output a universally unique identifier (UUID) for that log. An example
usage of this function is shown below:
.. code:: python
# A UserALE log
log
# Generate UUID
uuid = distill.getUUID(log)
Similarly to the ``epoch_to_datetime`` function, the ``get_uuid`` function is particularly useful when preprocessing UserALE
logs in preparation for Segmentation.