GetEvents

The GetEvents function of the mplreport class returns a list of Events from the ARDI server for the chosen time-frame.

Parameters
ParameterTypeDefaultMeaning
sourcestrNoneA source name to get events from. If None, uses all sources.
startDateTimeNoneThe start time (UTC) to query from. If None, uses report start date.
endDateTimeNoneThe end time (UTC) to query to. If None, uses the report end date.
utcbooleantrueIftrue, resulting times are in UTC. If False, times are in the report local timezone.
Return

An array of dictionaries.

Each element in the array describes an event. This includes all of the ARDI information around the event, with a minimum of…

KeyValue
NameThe name of the event
SourceThe source of the event
StartTimeThe datetime the event begins
EndTimeThe datetime the event finishes

Events will often include other details that vary depending on the source (for example, they might include the numbers recorded during an inspection, results of a manual measurement, details from a log etc.).

Usage

If you are synchronising your events with your time-series data, ensure you request your event data with 'utc' set to False. This will ensure both your event data and pandas dataframes are in the local timezone.

If this information is required for your report, we suggest calling FailOnError immediately after using this function.

Example

The following fetches all of the events for the report range and creates a timeline showing when they happened.

#Get a list of downtime events
evlist = report.GetEvents(source='Downtimes',utc=False)
report.FailOnError('Downtime')
 
#For each event...
for ev in evlist:
 
   #Draw a horizontal line showing the duration
   ax.broken_barh([(ev['StartTime'],ev['EndTime'] - ev['StartTime'])],(0,1),label=ev['Name'])
 
ax.legend()