Skip to content

Commit 9e1fb25

Browse files
giacomoaccursiandrea-acampora
authored andcommitted
chore: add dto for surgery report
1 parent 6490873 commit 9e1fb25

17 files changed

+691
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package application.presenter.api.report
10+
11+
import application.presenter.api.report.healthcareuser.HealthcareUserApiDto
12+
import application.presenter.api.report.healthcareuser.PatientVitalSignsApiDto
13+
import application.presenter.api.report.measurements.AggregateDataApiDto
14+
import application.presenter.api.report.medicaldevice.ImplantableMedicalDeviceApiDto
15+
import application.presenter.api.report.medicaldevice.MedicalTechnologyUsageApiDto
16+
import application.presenter.api.report.process.SurgicalProcessStepApiDto
17+
import application.presenter.api.report.room.RoomApiDto
18+
import application.presenter.api.report.room.RoomApiDtoType
19+
import application.presenter.api.report.room.RoomEnvironmentalDataApiDto
20+
import application.presenter.api.report.tracking.TrackingInformationApiDto
21+
import kotlinx.serialization.Serializable
22+
23+
/**
24+
* It represents the presentation of a single [entity.report.SurgeryReport] entry.
25+
* The necessary information are the [surgicalProcessID], the [patientId], the [patientName], the [patientSurname],
26+
* the [surgicalProcessDescription] and the [surgeryDate].
27+
*/
28+
@Serializable
29+
data class SurgeryReportEntry(
30+
val surgicalProcessID: String,
31+
val patientId: String,
32+
val patientName: String?,
33+
val patientSurname: String?,
34+
val surgicalProcessDescription: String,
35+
val surgeryDate: String,
36+
)
37+
38+
/**
39+
* It represents the presentation of a [entity.report.SurgeryReport].
40+
* The necessary information are: the [surgicalProcessID], the [surgeryDate], the [surgicalProcessDescription],
41+
* the [inChargeHealthProfessionalID], the [patientID], the [roomsInvolved], the [healthcareUser], the [stepData],
42+
* the [consumedImplantableMedicalDevice], the [medicalTechnologyUsageData], the [healthProfessionalTrackingInformation]
43+
* and the [additionalData].
44+
*/
45+
@Serializable
46+
data class SurgeryReportApiDto(
47+
val surgicalProcessID: String,
48+
val surgeryDate: String,
49+
val surgicalProcessDescription: String,
50+
val patientID: String,
51+
val roomsInvolved: List<RoomApiDto>,
52+
val inChargeHealthProfessionalID: String?,
53+
val healthcareUser: HealthcareUserApiDto?,
54+
val stepData: Map<SurgicalProcessStepApiDto, SurgicalProcessStepAggregateDataApiDto>,
55+
val consumedImplantableMedicalDevice: Set<ImplantableMedicalDeviceApiDto>,
56+
val medicalTechnologyUsageData: Set<MedicalTechnologyUsageApiDto>,
57+
val healthProfessionalTrackingInformation: List<TrackingInformationApiDto>,
58+
val additionalData: String,
59+
)
60+
61+
/**
62+
* Presenter class for the [entity.report.SurgeryProcessStepAggregateData].
63+
* It represents its [startDateTime], [stopDateTime], [patientVitalSignAggregateData] and [environmentalAggregateData].
64+
*/
65+
@Serializable
66+
data class SurgicalProcessStepAggregateDataApiDto(
67+
val startDateTime: String,
68+
val stopDateTime: String?,
69+
val patientVitalSignAggregateData: AggregateDataApiDto<PatientVitalSignsApiDto>,
70+
val environmentalAggregateData: Map<RoomApiDtoType, AggregateDataApiDto<RoomEnvironmentalDataApiDto>>,
71+
)
72+
73+
/**
74+
* Presenter class for the integration of a surgery report with [additionalData].
75+
*/
76+
@Serializable
77+
data class SurgeryReportPatchApiDto(val additionalData: String)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package application.presenter.api.report.apiresponse
10+
11+
import kotlinx.serialization.Serializable
12+
13+
/**
14+
* Module that wraps the REST-API template responses.
15+
*/
16+
object ApiResponses {
17+
/**
18+
* Class that represents an [entry] returned as response by an API.
19+
* It could include also the entry's [url].
20+
*/
21+
@Serializable
22+
data class ResponseEntry<out T>(val entry: T, val url: String?)
23+
24+
/**
25+
* Class that represents an [entry] returned as response by an API.
26+
* Each entry is associated with its [date].
27+
*/
28+
@Serializable
29+
data class ResponseTimedEntry<out T>(val entry: T, val date: String)
30+
31+
/**
32+
* Class that represents a list of [entries] returned as response to an API request.
33+
* As the REST API best-practise recommend it is included also the [total] number of the entries.
34+
*/
35+
@Serializable
36+
data class ResponseEntryList<out T>(val entries: List<T>, val total: Int)
37+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package application.presenter.api.report.healthcareuser
10+
11+
import kotlinx.serialization.Serializable
12+
13+
/**
14+
* Presenter class to serialize [entity.healthcareuser.HealthcareUser] information.
15+
* The necessary information are the [taxCode], the [name] and the [surname].
16+
*/
17+
@Serializable
18+
data class HealthcareUserApiDto(
19+
val taxCode: String,
20+
val name: String,
21+
val surname: String,
22+
)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package application.presenter.api.report.healthcareuser
10+
11+
import application.presenter.api.report.measurements.ValueWithUnit
12+
import kotlinx.serialization.Serializable
13+
14+
/**
15+
* Presenter class to serialize [entity.healthcareuser.PatientVitalSigns].
16+
* It describes the [heartBeat], the [diastolicBloodPressure], the [systolicBloodPressure], the [respiratoryRate],
17+
* the [saturationPercentage] and the [bodyTemperature].
18+
*/
19+
@Serializable
20+
data class PatientVitalSignsApiDto(
21+
val heartBeat: Int? = null,
22+
val diastolicBloodPressure: Int? = null,
23+
val systolicBloodPressure: Int? = null,
24+
val respiratoryRate: Int? = null,
25+
val saturationPercentage: Double? = null,
26+
val bodyTemperature: ValueWithUnit<Double>? = null,
27+
)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package application.presenter.api.report.measurements
10+
11+
import kotlinx.serialization.Serializable
12+
13+
/**
14+
* Presenter class for the [entity.measurements.AggregateData] class.
15+
* It returns the following data: [average], [std], [maximum] and [minimum].
16+
*/
17+
@Serializable
18+
data class AggregateDataApiDto<out E>(
19+
val average: E,
20+
val std: E,
21+
val maximum: E,
22+
val minimum: E,
23+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package application.presenter.api.report.measurements
10+
11+
import kotlinx.serialization.Serializable
12+
13+
/**
14+
* Describes a [value] with a [unit] of measurement.
15+
*/
16+
@Serializable
17+
data class ValueWithUnit<T>(val value: T, val unit: String)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package application.presenter.api.report.medicaldevice
10+
11+
import kotlinx.serialization.Serializable
12+
13+
/**
14+
* Presenter class for the [entity.medicaldevice.ImplantableMedicalDevice] class.
15+
* It returns: the [id] of the implantable medical device and the [type]
16+
*/
17+
@Serializable
18+
data class ImplantableMedicalDeviceApiDto(
19+
val id: String,
20+
val type: ImplantableMedicalDeviceApiDtoType,
21+
)
22+
23+
/**
24+
* Presenter enum class to represent [entity.medicaldevice.ImplantableMedicalDeviceType].
25+
*/
26+
enum class ImplantableMedicalDeviceApiDtoType {
27+
/** The Catheter is an implantable medical device type. */
28+
CATHETER,
29+
30+
/** The pacemaker is an implantable medical device type. */
31+
PACEMAKER,
32+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package application.presenter.api.report.medicaldevice
10+
11+
import kotlinx.serialization.Serializable
12+
13+
/**
14+
* Presenter class for the [entity.medicaldevice.MedicalTechnology] class.
15+
* It returns: the [id], the [name], the [description], the [type] of the medical technology and moreover
16+
* if it is [inUse].
17+
*/
18+
@Serializable
19+
data class MedicalTechnologyApiDto(
20+
val id: String,
21+
val name: String,
22+
val description: String? = null,
23+
val type: MedicalTechnologyApiDtoType,
24+
val inUse: Boolean = false,
25+
)
26+
27+
/**
28+
* Presenter enum to handle medical technology type.
29+
*/
30+
@Serializable
31+
enum class MedicalTechnologyApiDtoType {
32+
ENDOSCOPE,
33+
XRAY,
34+
}
35+
36+
/**
37+
* Presenter class that represent the usage of a [medicalTechnology] in a specific [dateTime].
38+
*/
39+
@Serializable
40+
data class MedicalTechnologyUsageApiDto(
41+
val dateTime: String,
42+
val medicalTechnology: MedicalTechnologyApiDto,
43+
)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package application.presenter.api.report.process
10+
11+
import kotlinx.serialization.Serializable
12+
13+
/**
14+
* Presenter enum class to represent the surgical process states and steps.
15+
*/
16+
@Serializable
17+
enum class SurgicalProcessStepApiDto {
18+
/** Pre-surgery state - patient in preparation step. */
19+
PATIENT_IN_PREPARATION,
20+
21+
/** Surgery state - patient on operating table step. */
22+
PATIENT_ON_OPERATING_TABLE,
23+
24+
/** Surgery state - anesthesia step. */
25+
ANESTHESIA,
26+
27+
/** Surgery state - surgery in progress step. */
28+
SURGERY_IN_PROGRESS,
29+
30+
/** Surgery state - end of surgery step. */
31+
END_OF_SURGERY,
32+
33+
/** Post-surgery state - patient under observation step. */
34+
PATIENT_UNDER_OBSERVATION,
35+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package application.presenter.api.report.room
10+
11+
import application.presenter.api.report.measurements.ValueWithUnit
12+
import kotlinx.serialization.Serializable
13+
14+
/**
15+
* Presenter class to serialize [entity.room.Room] information.
16+
* The necessary information are [id] and [type].
17+
*/
18+
@Serializable
19+
data class RoomApiDto(
20+
val id: String,
21+
val type: RoomApiDtoType,
22+
)
23+
24+
/**
25+
* Presenter enum class to represent the room type.
26+
*/
27+
@Serializable
28+
enum class RoomApiDtoType {
29+
/** Operating room type. */
30+
OPERATING_ROOM,
31+
32+
/** Pre-operating room type. */
33+
PRE_OPERATING_ROOM,
34+
}
35+
36+
/**
37+
* Wraps all the environmental data associated to a Room.
38+
* So it describes:
39+
* - the [temperature] inside the room
40+
* - the [humidity] inside the room
41+
* - the [luminosity] inside the room
42+
* - the [presence] of someone in the room
43+
* All the data may be not present.
44+
*/
45+
@Serializable
46+
data class RoomEnvironmentalDataApiDto(
47+
val temperature: ValueWithUnit<Double>? = null,
48+
val humidity: Double? = null,
49+
val luminosity: ValueWithUnit<Double>? = null,
50+
val presence: Boolean? = null,
51+
)

0 commit comments

Comments
 (0)