Skip to content

Commit 1edd90a

Browse files
feat: add room type to room events
1 parent d016ee4 commit 1edd90a

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/main/kotlin/entities/events/RoomEvent.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
package entities.events
1010

1111
import entities.events.EventProperties.EventKey
12+
import entities.process.ProcessData.RoomType
1213

1314
/**
1415
* The event of change of humidity in a room of the operating block.
@@ -21,6 +22,11 @@ data class RoomEvent<E : Any> (
2122
*/
2223
val roomId: String,
2324

25+
/**
26+
* The type of the room.
27+
*/
28+
val roomType: RoomType,
29+
2430
override val data: E,
2531

2632
override val dateTime: String

src/main/kotlin/infrastructure/digitaltwins/parser/UpdateEventParser.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import entities.process.PatientData.PatientData
2626
import entities.process.PatientData.RespiratoryRate
2727
import entities.process.PatientData.Saturation
2828
import entities.process.PatientData.SystolicPressure
29+
import entities.process.ProcessData
2930
import entities.process.ProcessData.MedicalTechnologyUsage
3031
import entities.process.ProcessData.ProcessInfo
3132
import infrastructure.digitaltwins.events.TwinProperties.DTModelID.MEDICAL_TECHNOLOGY_MODEL_ID
@@ -73,25 +74,37 @@ class UpdateEventParser {
7374
TEMPERATURE.path -> RoomEvent(
7475
key = EventKey.TEMPERATURE_EVENT,
7576
roomId = updateTwinEvent.id,
77+
roomType = if (updateTwinEvent.data.modelId == OPERATING_ROOM_MODEL_ID.id)
78+
ProcessData.RoomType.OPERATING_ROOM
79+
else ProcessData.RoomType.PRE_OPERATING_ROOM,
7680
data = Temperature((updateTwinEvent.data.patch[0].value as Number).toDouble(), TemperatureUnit.CELSIUS),
7781
dateTime = updateTwinEvent.eventDateTime
7882
)
7983
HUMIDITY.path -> RoomEvent(
8084
key = EventKey.HUMIDITY_EVENT,
8185
roomId = updateTwinEvent.id,
86+
roomType = if (updateTwinEvent.data.modelId == OPERATING_ROOM_MODEL_ID.id)
87+
ProcessData.RoomType.OPERATING_ROOM
88+
else ProcessData.RoomType.PRE_OPERATING_ROOM,
8289
data = Humidity(updateTwinEvent.data.patch[0].value as Int),
8390
dateTime = updateTwinEvent.eventDateTime
8491
)
8592
LUMINOSITY.path -> RoomEvent(
8693
key = EventKey.LUMINOSITY_EVENT,
8794
roomId = updateTwinEvent.id,
95+
roomType = if (updateTwinEvent.data.modelId == OPERATING_ROOM_MODEL_ID.id)
96+
ProcessData.RoomType.OPERATING_ROOM
97+
else ProcessData.RoomType.PRE_OPERATING_ROOM,
8898
data = Luminosity((updateTwinEvent.data.patch[0].value as Number).toDouble(), LuminosityUnit.LUX),
8999
dateTime = updateTwinEvent.eventDateTime
90100
)
91101
PRESENCE.path -> {
92102
RoomEvent(
93103
key = EventKey.PRESENCE_EVENT,
94104
roomId = updateTwinEvent.id,
105+
roomType = if (updateTwinEvent.data.modelId == OPERATING_ROOM_MODEL_ID.id)
106+
ProcessData.RoomType.OPERATING_ROOM
107+
else ProcessData.RoomType.PRE_OPERATING_ROOM,
95108
data = Presence(updateTwinEvent.data.patch[0].value as Boolean),
96109
dateTime = updateTwinEvent.eventDateTime
97110
)

0 commit comments

Comments
 (0)