aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala
diff options
context:
space:
mode:
authorKseniya Tomskikh <ktomskih@datamonsters.co>2017-10-18 13:51:47 +0700
committerKseniya Tomskikh <ktomskih@datamonsters.co>2017-10-18 13:51:47 +0700
commit15d74838eb592c58bb0a912380f0ec1f537be333 (patch)
tree0d50474a49c0e18ef49641d06422f23891af6aa7 /src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala
parent2a9bada86658ef15793f99f1867e23f3b31e7032 (diff)
downloadrest-query-15d74838eb592c58bb0a912380f0ec1f537be333.tar.gz
rest-query-15d74838eb592c58bb0a912380f0ec1f537be333.tar.bz2
rest-query-15d74838eb592c58bb0a912380f0ec1f537be333.zip
TRIAL-54 Study designs as enum
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