aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala
diff options
context:
space:
mode:
authorAleksandr <ognelisar@gmail.com>2017-10-19 18:16:10 +0700
committerAleksandr <ognelisar@gmail.com>2017-10-19 18:16:10 +0700
commit0eb0f1b877237fe20069e66ca460549e5e96377c (patch)
tree806dbe37cbbfe732a334963335d61863de6f0765 /src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala
parente916240b94c4bf30b8d23f547b9931adb004e1e7 (diff)
parentc04b779341e9d54e5b519db085420c9a1ea66610 (diff)
downloadrest-query-0eb0f1b877237fe20069e66ca460549e5e96377c.tar.gz
rest-query-0eb0f1b877237fe20069e66ca460549e5e96377c.tar.bz2
rest-query-0eb0f1b877237fe20069e66ca460549e5e96377c.zip
Merge branch 'master' into TRIAL-55
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala
index f02bedc..5e743b7 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala
@@ -5,6 +5,9 @@ import xyz.driver.pdsuicommon.logging._
import xyz.driver.pdsuidomain.entities.InterventionType.DeliveryMethod
import xyz.driver.pdsuidomain.entities.InterventionType.DeliveryMethod._
+import scalaz.syntax.equal._
+import scalaz.Scalaz.stringInstance
+
sealed trait InterventionType {
val id: LongId[InterventionType]
val name: String
@@ -78,16 +81,8 @@ object InterventionType {
)
}
- 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
+ def typeFromString(txt: String): Option[InterventionType] = {
+ All.values.find(_.name === txt)
}
sealed trait DeliveryMethod