Skip to content

Commit

Permalink
chore: add model data for patient
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-acampora committed Mar 24, 2023
1 parent 91ed793 commit 464f585
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions src/main/kotlin/entity/patient/PatientData.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* Copyright (c) 2023. Smart Operating Block
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/

package entity.patient

/** Module with all necessary data for [Patient]. */
object PatientData {

/** The [id] of the [Patient]. */
data class PatientId(val id: String) {
init {
require(this.id.isNotEmpty()) {
"Patient id code can not be empty!"
}
}
}

/** The [bpm] of the [Patient]. */
data class HeartBeat(val bpm: Int) {
init {
require(this.bpm >= 0) {
"Beat per minute cannot be negative"
}
}
}

/** The Diastolic blood [pressure] of the [Patient]. */
data class DiastolicBloodPressure(val pressure: Int) {
init {
require(this.pressure >= 0) {
"Diastolic blood pressure cannot be negative"
}
}
}

/** The Systolic blood [pressure] of the [Patient]. */
data class SystolicBloodPressure(val pressure: Int) {
init {
require(this.pressure >= 0) {
"Systolic blood pressure cannot be negative"
}
}
}

/** The Respiratory [rate] of the [Patient]. */
data class RespiratoryRate(val rate: Int) {
init {
require(this.rate >= 0) {
"Respiratory rate cannot be negative"
}
}
}

/** The Saturation [percentage] of the [Patient]. */
data class SaturationPercentage(val percentage: Int) {
init {
require(this.percentage >= 0) {
"Saturation percentage cannot be negative"
}
}
}

/** The [degree] of body temperature of the [Patient] with the specific temperature [unit]. */
data class BodyTemperature(val degree: Double, val unit: TemperatureUnit = TemperatureUnit.CELSIUS) {
init {
require(this.degree >= 0) {
"Body temperature cannot be negative"
}
}
}

/** The Temperature Unit. */
enum class TemperatureUnit {
CELSIUS
}

/** Wrap all the medical data of the [Patient] such as:
* the [heartBeat],
* the [diastolicBloodPressure],
* the [systolicBloodPressure],
* the [respiratoryRate],
* the [saturationPercentage],
* the [bodyTemperature]. */
data class MedicalData(
val heartBeat: HeartBeat? = null,
val diastolicBloodPressure: DiastolicBloodPressure? = null,
val systolicBloodPressure: SystolicBloodPressure? = null,
val respiratoryRate: RespiratoryRate? = null,
val saturationPercentage: SaturationPercentage? = null,
val bodyTemperature: BodyTemperature? = null
)
}

0 comments on commit 464f585

Please sign in to comment.