Skip to content

Commit

Permalink
feat: add room type to room events
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-acampora committed Mar 28, 2023
1 parent d016ee4 commit 1edd90a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/kotlin/entities/events/RoomEvent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -21,6 +22,11 @@ data class RoomEvent<E : Any> (
*/
val roomId: String,

/**
* The type of the room.
*/
val roomType: RoomType,

override val data: E,

override val dateTime: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -73,25 +74,37 @@ 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
)
PRESENCE.path -> {
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
)
Expand Down

0 comments on commit 1edd90a

Please # to comment.