arthurai.util.format_timestamps#

arthurai.util.format_timestamps(inferences, tz=None, timestamp_attributes=None, time_series_attributes=None, is_reference_data=False)#

Checks list of json inferences to ensure their timestamps have been converted to ISO8601 conventions.

Parameters
  • inferences (List[Dict[str, Any]]) – inferences from input to send_inferences() function or output from nest_reference_data() function. This enforces requirement that the inference has an “inference_data” or “reference_data” field.

  • tz (Union[timezone, str, None]) – datetime timezone object or timezone string

  • timestamp_attributes (Optional[List[str]]) – List of attributes of the model of timestamp type

  • time_series_attributes (Optional[List[str]]) – List of attributes of the model of time series type

  • is_reference_data (bool) – True if data to be formatted is reference data, False if inference data or ground truth data

Return type

List[Dict[str, Any]]

Returns

updated list of json inferences with ISO8601 formatted timestamps

Raises
  • TypeError – timestamp is not of type datetime.datetime

  • ValueError – timestamp is not timezone aware and no location data is provided to remedy