From 1edd90ab9ddf33a0330619472908c1a6c5a0b798 Mon Sep 17 00:00:00 2001 From: Andrea Acampora Date: Tue, 28 Mar 2023 15:24:19 +0200 Subject: [PATCH] feat: add room type to room events --- src/main/kotlin/entities/events/RoomEvent.kt | 6 ++++++ .../digitaltwins/parser/UpdateEventParser.kt | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/main/kotlin/entities/events/RoomEvent.kt b/src/main/kotlin/entities/events/RoomEvent.kt index 8703a2fb..025bfe77 100644 --- a/src/main/kotlin/entities/events/RoomEvent.kt +++ b/src/main/kotlin/entities/events/RoomEvent.kt @@ -9,6 +9,7 @@ package entities.events import entities.events.EventProperties.EventKey +import entities.process.ProcessData.RoomType /** * The event of change of humidity in a room of the operating block. @@ -21,6 +22,11 @@ data class RoomEvent ( */ val roomId: String, + /** + * The type of the room. + */ + val roomType: RoomType, + override val data: E, override val dateTime: String diff --git a/src/main/kotlin/infrastructure/digitaltwins/parser/UpdateEventParser.kt b/src/main/kotlin/infrastructure/digitaltwins/parser/UpdateEventParser.kt index 81517516..b6a31b97 100644 --- a/src/main/kotlin/infrastructure/digitaltwins/parser/UpdateEventParser.kt +++ b/src/main/kotlin/infrastructure/digitaltwins/parser/UpdateEventParser.kt @@ -26,6 +26,7 @@ import entities.process.PatientData.PatientData import entities.process.PatientData.RespiratoryRate import entities.process.PatientData.Saturation import entities.process.PatientData.SystolicPressure +import entities.process.ProcessData import entities.process.ProcessData.MedicalTechnologyUsage import entities.process.ProcessData.ProcessInfo import infrastructure.digitaltwins.events.TwinProperties.DTModelID.MEDICAL_TECHNOLOGY_MODEL_ID @@ -73,18 +74,27 @@ class UpdateEventParser { TEMPERATURE.path -> RoomEvent( key = EventKey.TEMPERATURE_EVENT, roomId = updateTwinEvent.id, + roomType = if (updateTwinEvent.data.modelId == OPERATING_ROOM_MODEL_ID.id) + ProcessData.RoomType.OPERATING_ROOM + else ProcessData.RoomType.PRE_OPERATING_ROOM, data = Temperature((updateTwinEvent.data.patch[0].value as Number).toDouble(), TemperatureUnit.CELSIUS), dateTime = updateTwinEvent.eventDateTime ) HUMIDITY.path -> RoomEvent( key = EventKey.HUMIDITY_EVENT, roomId = updateTwinEvent.id, + roomType = if (updateTwinEvent.data.modelId == OPERATING_ROOM_MODEL_ID.id) + ProcessData.RoomType.OPERATING_ROOM + else ProcessData.RoomType.PRE_OPERATING_ROOM, data = Humidity(updateTwinEvent.data.patch[0].value as Int), dateTime = updateTwinEvent.eventDateTime ) LUMINOSITY.path -> RoomEvent( key = EventKey.LUMINOSITY_EVENT, roomId = updateTwinEvent.id, + roomType = if (updateTwinEvent.data.modelId == OPERATING_ROOM_MODEL_ID.id) + ProcessData.RoomType.OPERATING_ROOM + else ProcessData.RoomType.PRE_OPERATING_ROOM, data = Luminosity((updateTwinEvent.data.patch[0].value as Number).toDouble(), LuminosityUnit.LUX), dateTime = updateTwinEvent.eventDateTime ) @@ -92,6 +102,9 @@ class UpdateEventParser { RoomEvent( key = EventKey.PRESENCE_EVENT, roomId = updateTwinEvent.id, + roomType = if (updateTwinEvent.data.modelId == OPERATING_ROOM_MODEL_ID.id) + ProcessData.RoomType.OPERATING_ROOM + else ProcessData.RoomType.PRE_OPERATING_ROOM, data = Presence(updateTwinEvent.data.patch[0].value as Boolean), dateTime = updateTwinEvent.eventDateTime )