aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala
diff options
context:
space:
mode:
authorKseniya Tomskikh <ktomskih@datamonsters.co>2017-09-27 17:23:30 +0700
committerGitHub <noreply@github.com>2017-09-27 17:23:30 +0700
commit2d72ce34d6ea12cd863ae0a8747e65bd1d2a1487 (patch)
tree370967f105524266dc94770863645c314b3c7a03 /src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala
parent68b02317d9a296da8c4b8e389b726c1a122a5b5e (diff)
parentf10c767bf16f14921a194936188c47dd138ffee7 (diff)
downloadrest-query-2d72ce34d6ea12cd863ae0a8747e65bd1d2a1487.tar.gz
rest-query-2d72ce34d6ea12cd863ae0a8747e65bd1d2a1487.tar.bz2
rest-query-2d72ce34d6ea12cd863ae0a8747e65bd1d2a1487.zip
Merge pull request #31 from drivergroup/PDSUI-2275v0.3.23
PDSUI-2275 Added delivery methods to intervention type entrypoint
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala166
1 files changed, 165 insertions, 1 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala
index 5dada55..d0eefa9 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala
@@ -2,10 +2,174 @@ package xyz.driver.pdsuidomain.entities
import xyz.driver.pdsuicommon.domain.{LongId, StringId}
import xyz.driver.pdsuicommon.logging._
+import xyz.driver.pdsuidomain.entities.InterventionType.DeliveryMethod
+import xyz.driver.pdsuidomain.entities.InterventionType.DeliveryMethod._
-final case class InterventionType(id: LongId[InterventionType], name: String)
+sealed trait InterventionType {
+ val id: LongId[InterventionType]
+ val name: String
+ val deliveryMethods: Set[DeliveryMethod]
+}
object InterventionType {
+
+ final case object RadiationTherapy extends InterventionType {
+ val id: LongId[InterventionType] = LongId[InterventionType](1)
+ val name: String = "Radiation therapy"
+ val deliveryMethods: Set[DeliveryMethod] = commonMethods
+ }
+
+ final case object Chemotherapy extends InterventionType {
+ val id: LongId[InterventionType] = LongId[InterventionType](2)
+ val name: String = "Chemotherapy"
+ val deliveryMethods: Set[DeliveryMethod] = commonMethods
+ }
+
+ final case object TargetedTherapy extends InterventionType {
+ val id: LongId[InterventionType] = LongId[InterventionType](3)
+ val name: String = "Targeted therapy"
+ val deliveryMethods: Set[DeliveryMethod] = commonMethods
+ }
+
+ final case object Immunotherapy extends InterventionType {
+ val id: LongId[InterventionType] = LongId[InterventionType](4)
+ val name: String = "Immunotherapy"
+ val deliveryMethods: Set[DeliveryMethod] = commonMethods
+ }
+
+ final case object Surgery extends InterventionType {
+ val id: LongId[InterventionType] = LongId[InterventionType](5)
+ val name: String = "Surgery"
+ val deliveryMethods: Set[DeliveryMethod] = commonMethods
+ }
+
+ final case object HormoneTherapy extends InterventionType {
+ val id: LongId[InterventionType] = LongId[InterventionType](6)
+ val name: String = "Hormone therapy"
+ val deliveryMethods: Set[DeliveryMethod] = commonMethods
+ }
+
+ final case object Other extends InterventionType {
+ val id: LongId[InterventionType] = LongId[InterventionType](7)
+ val name: String = "Other"
+ val deliveryMethods: Set[DeliveryMethod] = commonMethods
+ }
+
+ final case object Radiation extends InterventionType {
+ val id: LongId[InterventionType] = LongId[InterventionType](8)
+ val name: String = "Radiation"
+ val deliveryMethods: Set[DeliveryMethod] = Set(
+ ExternalRadiationTherapy,
+ Brachytherapy,
+ SystemicRadiationTherapyIV,
+ SystemicRadiationTherapyOral,
+ ProtonBeamTherapy
+ )
+ }
+
+ final case object SurgeryProcedure extends InterventionType {
+ val id: LongId[InterventionType] = LongId[InterventionType](9)
+ val name: String = "Surgery/Procedure"
+ val deliveryMethods: Set[DeliveryMethod] = Set(
+ RadioFrequencyAblationRFA,
+ Cryoablation,
+ TherapeuticConventionalSurgery,
+ RoboticAssistedLaparoscopicSurgery
+ )
+ }
+
+ def typeFromString: PartialFunction[String, InterventionType] = {
+ case "Radiation therapy" => RadiationTherapy
+ case "Chemotherapy" => Chemotherapy
+ case "Targeted therapy" => TargetedTherapy
+ case "Immunotherapy" => Immunotherapy
+ case "Surgery" => Surgery
+ case "Hormone therapy" => HormoneTherapy
+ case "Other" => Other
+ case "Radiation" => Radiation
+ case "Surgery/Procedure" => SurgeryProcedure
+ }
+
+ sealed trait DeliveryMethod
+ object DeliveryMethod {
+ case object IntravenousInfusionIV extends DeliveryMethod
+ case object IntramuscularInjection extends DeliveryMethod
+ case object SubcutaneousInjection extends DeliveryMethod
+ case object IntradermalInjection extends DeliveryMethod
+ case object SpinalInjection extends DeliveryMethod
+ case object Oral extends DeliveryMethod
+ case object Topical extends DeliveryMethod
+ case object TransdermalPatch extends DeliveryMethod
+ case object Inhalation extends DeliveryMethod
+ case object Rectal extends DeliveryMethod
+ case object ExternalRadiationTherapy extends DeliveryMethod
+ case object Brachytherapy extends DeliveryMethod
+ case object SystemicRadiationTherapyIV extends DeliveryMethod
+ case object SystemicRadiationTherapyOral extends DeliveryMethod
+ case object ProtonBeamTherapy extends DeliveryMethod
+ case object RadioFrequencyAblationRFA extends DeliveryMethod
+ case object Cryoablation extends DeliveryMethod
+ case object TherapeuticConventionalSurgery extends DeliveryMethod
+ case object RoboticAssistedLaparoscopicSurgery extends DeliveryMethod
+
+ def fromString: PartialFunction[String, DeliveryMethod] = {
+ case "Intravenous Infusion (IV)" => IntravenousInfusionIV
+ case "Intramuscular Injection" => IntramuscularInjection
+ case "Subcutaneous Injection" => SubcutaneousInjection
+ case "Intradermal Injection" => IntradermalInjection
+ case "Spinal Injection" => SpinalInjection
+ case "Oral" => Oral
+ case "Topical" => Topical
+ case "Transdermal Patch" => TransdermalPatch
+ case "Inhalation" => Inhalation
+ case "Rectal" => Rectal
+ case "External Radiation Therapy" => ExternalRadiationTherapy
+ case "Brachytherapy" => Brachytherapy
+ case "Systemic Radiation Therapy (IV)" => SystemicRadiationTherapyIV
+ case "Systemic Radiation Therapy (Oral)" => SystemicRadiationTherapyOral
+ case "Proton Beam Therapy" => ProtonBeamTherapy
+ case "Radio-Frequency Ablation (RFA)" => RadioFrequencyAblationRFA
+ case "Cryoablation" => Cryoablation
+ case "Therapeutic Conventional Surgery" => TherapeuticConventionalSurgery
+ case "Robotic Assisted Laparoscopic Surgery" => RoboticAssistedLaparoscopicSurgery
+ }
+
+ def methodToString(x: DeliveryMethod): String = x match {
+ case IntravenousInfusionIV => "Intravenous Infusion (IV)"
+ case IntramuscularInjection => "Intramuscular Injection"
+ case SubcutaneousInjection => "Subcutaneous Injection"
+ case IntradermalInjection => "Intradermal Injection"
+ case SpinalInjection => "Spinal Injection"
+ case Oral => "Oral"
+ case Topical => "Topical"
+ case TransdermalPatch => "Transdermal Patch"
+ case Inhalation => "Inhalation"
+ case Rectal => "Rectal"
+ case ExternalRadiationTherapy => "External Radiation Therapy"
+ case Brachytherapy => "Brachytherapy"
+ case SystemicRadiationTherapyIV => "Systemic Radiation Therapy (IV)"
+ case SystemicRadiationTherapyOral => "Systemic Radiation Therapy (Oral)"
+ case ProtonBeamTherapy => "Proton Beam Therapy"
+ case RadioFrequencyAblationRFA => "Radio-Frequency Ablation (RFA)"
+ case Cryoablation => "Cryoablation"
+ case TherapeuticConventionalSurgery => "Therapeutic Conventional Surgery"
+ case RoboticAssistedLaparoscopicSurgery => "Robotic Assisted Laparoscopic Surgery"
+ }
+ }
+
+ val commonMethods = Set[DeliveryMethod](
+ IntravenousInfusionIV,
+ IntramuscularInjection,
+ SubcutaneousInjection,
+ IntradermalInjection,
+ SpinalInjection,
+ Oral,
+ Topical,
+ TransdermalPatch,
+ Inhalation,
+ Rectal
+ )
+
implicit def toPhiString(x: InterventionType): PhiString = {
import x._
phi"InterventionType(id=$id, name=${Unsafe(name)})"