GetEvents
The GetEvents function of the mplreport class returns a list of Events from the ARDI server for the chosen time-frame.
Parameters
Parameter | Type | Default | Meaning |
---|---|---|---|
source | str | None | A source name to get events from. If None, uses all sources. |
start | DateTime | None | The start time (UTC) to query from. If None, uses report start date. |
end | DateTime | None | The end time (UTC) to query to. If None, uses the report end date. |
utc | boolean | true | Iftrue, 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…
Key | Value |
---|---|
Name | The name of the event |
Source | The source of the event |
StartTime | The datetime the event begins |
EndTime | The 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()