Skip to content

Commit 6490873

Browse files
giacomoaccursiandrea-acampora
authored andcommitted
chore: add entity for surgery report
1 parent ed527de commit 6490873

File tree

12 files changed

+703
-0
lines changed

12 files changed

+703
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 entity.surgeryreport.healthcareuser
10+
11+
import kotlinx.serialization.Serializable
12+
13+
/**
14+
* It represents a Healthcare user of the Healthcare national system.
15+
* Each user is identified by their [taxCode] and has a [name] and a [surname].
16+
*/
17+
@Serializable
18+
data class HealthcareUser(
19+
val taxCode: TaxCode,
20+
val name: String,
21+
val surname: String,
22+
) {
23+
override fun equals(other: Any?): Boolean = when {
24+
other === this -> true
25+
other is HealthcareUser -> this.taxCode == other.taxCode
26+
else -> false
27+
}
28+
29+
override fun hashCode(): Int = this.taxCode.hashCode()
30+
}
31+
32+
/**
33+
* Tax Code of a [HealthcareUser].
34+
* @param[value] the tax code.
35+
*/
36+
@Serializable
37+
data class TaxCode(val value: String) {
38+
init {
39+
// Constructor validation: the code must not be empty
40+
require(this.value.isNotEmpty())
41+
}
42+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 entity.surgeryreport.healthcareuser
10+
11+
import kotlinx.serialization.Serializable
12+
13+
/**
14+
* Id of [HealthcareUser] under a surgery.
15+
* @param[value] the id.
16+
*/
17+
@Serializable
18+
data class PatientID(val value: String) {
19+
init {
20+
// Constructor validation: The id must not be empty
21+
require(this.value.isNotEmpty())
22+
}
23+
}
24+
25+
/**
26+
* [VitalSign]s of a patient.
27+
* - [heartBeat]
28+
* - [diastolicBloodPressure]
29+
* - [systolicBloodPressure]
30+
* - [respiratoryRate]
31+
* - [saturationPercentage]
32+
* - [bodyTemperature]
33+
*/
34+
@Serializable
35+
data class PatientVitalSigns(
36+
val heartBeat: VitalSign.HeartBeat? = null,
37+
val diastolicBloodPressure: VitalSign.DiastolicBloodPressure? = null,
38+
val systolicBloodPressure: VitalSign.SystolicBloodPressure? = null,
39+
val respiratoryRate: VitalSign.RespiratoryRate? = null,
40+
val saturationPercentage: VitalSign.SaturationPercentage? = null,
41+
val bodyTemperature: VitalSign.BodyTemperature? = null,
42+
)
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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 entity.surgeryreport.healthcareuser
10+
11+
import entity.surgeryreport.measurements.Percentage
12+
import entity.surgeryreport.measurements.Temperature
13+
import kotlinx.serialization.Serializable
14+
15+
/**
16+
* Module that wraps all the vital signs for a patient under surgery.
17+
*/
18+
object VitalSign {
19+
/** The [bpm] of the patient. */
20+
@Serializable
21+
data class HeartBeat(val bpm: Int) {
22+
init {
23+
require(this.bpm >= 0) {
24+
"Beat per minute cannot be negative"
25+
}
26+
}
27+
}
28+
29+
/** The Diastolic blood [pressure] of the patient. */
30+
@Serializable
31+
data class DiastolicBloodPressure(val pressure: Int) {
32+
init {
33+
require(this.pressure >= 0) {
34+
"Diastolic blood pressure cannot be negative"
35+
}
36+
}
37+
}
38+
39+
/** The Systolic blood [pressure] of the patient. */
40+
@Serializable
41+
data class SystolicBloodPressure(val pressure: Int) {
42+
init {
43+
require(this.pressure >= 0) {
44+
"Systolic blood pressure cannot be negative"
45+
}
46+
}
47+
}
48+
49+
/** The Respiratory [rate] of the patient. */
50+
@Serializable
51+
data class RespiratoryRate(val rate: Int) {
52+
init {
53+
require(this.rate >= 0) {
54+
"Respiratory rate cannot be negative"
55+
}
56+
}
57+
}
58+
59+
/** The Saturation [percentage] of the patient. */
60+
@Serializable
61+
data class SaturationPercentage(val percentage: Percentage)
62+
63+
/** The body [temperature] of the patient. */
64+
@Serializable
65+
data class BodyTemperature(val temperature: Temperature) {
66+
init {
67+
require(this.temperature.value >= 0) {
68+
"Body temperature cannot be negative"
69+
}
70+
}
71+
}
72+
}
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 entity.surgeryreport.healthprofessional
10+
11+
import kotlinx.serialization.Serializable
12+
13+
/**
14+
* Identification of a health professional working withing the Operating Block.
15+
* @param[value] the id.
16+
*/
17+
@Serializable
18+
data class HealthProfessionalID(val value: String) {
19+
init {
20+
// Constructor validation: the id must not be empty
21+
require(this.value.isNotEmpty())
22+
}
23+
}
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 entity.surgeryreport.measurements
10+
11+
import kotlinx.serialization.Serializable
12+
13+
/**
14+
* It describes aggregate data of type [E].
15+
* It stores the [average], the [std], the [maximum] and the [minimum].
16+
*/
17+
@Serializable
18+
data class AggregateData<out E>(
19+
val average: E,
20+
val std: E,
21+
val maximum: E,
22+
val minimum: E,
23+
)
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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 entity.surgeryreport.measurements
10+
11+
import kotlinx.serialization.Serializable
12+
13+
/**
14+
* Temperature concept.
15+
* It is described by the current temperature [value] expressed in a [unit].
16+
*/
17+
@Serializable
18+
data class Temperature(val value: Double, val unit: TemperatureUnit = TemperatureUnit.CELSIUS)
19+
20+
/**
21+
* This enum describe the possible [Temperature] unit of measurement.
22+
*/
23+
@Serializable
24+
enum class TemperatureUnit {
25+
/**
26+
* Celsius unit.
27+
*/
28+
CELSIUS,
29+
}
30+
31+
/**
32+
* Percentage concept.
33+
* It represents a generic percentage.
34+
* Therefore, its [value] must be within 0 and 100.
35+
*/
36+
@Serializable
37+
data class Percentage(val value: Double) {
38+
init {
39+
// Constructor validation
40+
require(value in 0.0..100.0) { "Value of the percentage must be between 0 and 100" }
41+
}
42+
}
43+
44+
/**
45+
* Humidity concept.
46+
* It is described by the current [percentage] of humidity. So it describes the Relative Humidity.
47+
*/
48+
@Serializable
49+
data class Humidity(val percentage: Percentage)
50+
51+
/**
52+
* Luminosity concept.
53+
* It is described by the current luminosity [value] expressed in a [unit].
54+
*/
55+
@Serializable
56+
data class Luminosity(val value: Double, val unit: LightUnit = LightUnit.LUX) {
57+
init {
58+
// Constructor validation
59+
require(this.value >= 0)
60+
}
61+
}
62+
63+
/**
64+
* This enum describe the possible [Luminosity] unit of measurement.
65+
*/
66+
@Serializable
67+
enum class LightUnit {
68+
/**
69+
* Lux unit.
70+
*/
71+
LUX,
72+
}
73+
74+
/**
75+
* Describe the presence inside a room.
76+
* @param[presenceDetected] true if someone is in the room, false otherwise.
77+
*/
78+
@Serializable
79+
data class Presence(val presenceDetected: Boolean)
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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 entity.surgeryreport.medicaldevice
10+
11+
import kotlinx.serialization.Serializable
12+
13+
/**
14+
* It describes an implantable medical device used during a surgery inside an Operating Room.
15+
* It is identified by its [id] and it is of a particular [type].
16+
*/
17+
@Serializable
18+
data class ImplantableMedicalDevice(
19+
val id: ImplantableMedicalDeviceID,
20+
val type: ImplantableMedicalDeviceType,
21+
) {
22+
override fun equals(other: Any?): Boolean = when {
23+
other === this -> true
24+
other is ImplantableMedicalDevice -> this.id == other.id
25+
else -> false
26+
}
27+
28+
override fun hashCode(): Int = this.id.hashCode()
29+
}
30+
31+
/**
32+
* Identification for [ImplantableMedicalDevice].
33+
* @param[value] the id.
34+
*/
35+
@Serializable
36+
data class ImplantableMedicalDeviceID(val value: String) {
37+
init {
38+
// Constructor validation: the id must not be empty
39+
require(this.value.isNotEmpty())
40+
}
41+
}
42+
43+
/**
44+
* The types of [ImplantableMedicalDevice].
45+
*/
46+
@Serializable
47+
enum class ImplantableMedicalDeviceType {
48+
/** The Catheter is an implantable medical device type. */
49+
CATHETER,
50+
51+
/** The pacemaker is an implantable medical device type. */
52+
PACEMAKER,
53+
}

0 commit comments

Comments
 (0)