Working with simultaneous event statuses
Starting from version 11.2, we introduced a new tag called eventType
to complement the existing eventId
field and grouping system.
An eventType
is a way to classify events, allowing multiple events to occur simultaneously. This is particularly useful in cases such as alarm codes, where overlapping events are common.
Sample data file
You can find this tutorial sample code on our GitHub as sample-04
To introduce this concept, we prepared a sample file available on our GitHub. The dataset contains 24 hours of different event types—some of which overlap in time.
batchType,process,start,stop
online,mt1,2025-07-10T14:57:05+00:00,2025-07-10T21:09:55+00:00
abnormal,mt1,2025-07-10T21:09:55+00:00,2025-07-11T04:05:53+00:00
offline,mt1,2025-07-11T02:10:16+00:00,2025-07-11T04:05:53+00:00
online,mt1,2025-07-11T04:05:53+00:00,2025-07-11T14:57:05+00:00
In this example, the abnormal
event for motor 1 bearings starts at 21:09:55 and ends at the exact same time as offline
(this last event starting some hours later). This can be interpreted as the machine operating under abnormal conditions before eventually shutting down.
File structure
The CSV file includes the following key elements:
- A batch type representing the name of the process that is occuring in a specific timestamp
- The process name, just like in traditional event batch files.
- Start and stop timestamps of the process (same format as for batch event data).
Convert dataframe
Each record in the dataset is converted to a JSON structure like the one shown below:
{
"Timestamp": "2025-07-10T14:57:05Z",
"HardwareId": "mt1_bearings_status",
"EventType": "online",
"EventStatus": "On",
"SensorValue": 1.0
}
{
"Timestamp": "2025-07-10T21:09:55Z",
"HardwareId": "mt1_bearings_status",
"EventType": "online",
"EventStatus": "Off",
"SensorValue": 1.0
}
We should also send the "Off" event status corresponding to the stop time of the process.
The process to convert and send this data is the same as for standard event uploads, just with a modified structure to include the eventType field.
def convert_dataframe(dataframe: pd.DataFrame) -> pd.DataFrame:
data = []
for index, row in dataframe.iterrows():
data.append(
{
"Timestamp": pd.to_datetime(row.start, utc=True).isoformat(),
"HardwareId": f"{row.process}_bearings_status",
"EventType": row.batchType,
"EventStatus": "On",
"SensorValue": 1.0
}
)
data.append(
{
"Timestamp": pd.to_datetime(row.stop, utc=True).isoformat(),
"HardwareId": f"{row.process}_bearings_status",
"EventType": row.batchType,
"EventStatus": "Off",
"SensorValue": 0.0
}
)
return pd.DataFrame(data)
Updated 3 months ago
In the next article we will use this data sample to create different types of queries and reviewing the results obtained