diff options
author | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-10-19 17:34:26 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-19 17:34:26 +0700 |
commit | c04b779341e9d54e5b519db085420c9a1ea66610 (patch) | |
tree | 3101844311cddfb7e9efa953311ca1f725c2350a /src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala | |
parent | 12cee94e187ada6413adc78e0fcc46ed930c306a (diff) | |
parent | 828cccb152ed525f6decf859283cc1b2589d106c (diff) | |
download | rest-query-c04b779341e9d54e5b519db085420c9a1ea66610.tar.gz rest-query-c04b779341e9d54e5b519db085420c9a1ea66610.tar.bz2 rest-query-c04b779341e9d54e5b519db085420c9a1ea66610.zip |
Merge pull request #49 from drivergroup/TRIAL-54v0.9.3
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.scala | 15 |
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 |