aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/entities')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/LinkedPatient.scala4
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/UserHistory.scala86
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala4
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala7
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala25
6 files changed, 65 insertions, 63 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/LinkedPatient.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/LinkedPatient.scala
index e82bcc3..1b30c64 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/LinkedPatient.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/LinkedPatient.scala
@@ -11,6 +11,4 @@ object LinkedPatient {
}
}
-case class LinkedPatient(userId: LongId[User],
- patientId: UuidId[Patient],
- trialId: StringId[Trial])
+case class LinkedPatient(userId: LongId[User], patientId: UuidId[Patient], trialId: StringId[Trial])
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala
index 60298b9..34e3741 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala
@@ -8,7 +8,7 @@ import xyz.driver.pdsuicommon.logging._
object PatientLabelEvidenceView {
implicit def toPhiString(x: PatientLabelEvidenceView): PhiString = {
import x._
- phi"PatientLabelEvidenceViewRepository.Row(id=$id, value=$value, documentId=$documentId, " +
+ phi"PatientLabelEvidenceView(id=$id, value=$value, documentId=$documentId, " +
phi"evidenceId=$evidenceId, reportId=$reportId, patientId=$patientId, labelId=$labelId, " +
phi"isImplicitMatch=$isImplicitMatch)"
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/UserHistory.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/UserHistory.scala
index b55369e..4abb205 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/UserHistory.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/UserHistory.scala
@@ -21,7 +21,7 @@ object UserHistory {
def forDocument(executor: LongId[User],
documentId: LongId[Document],
state: UserHistory.State,
- action: UserHistory.Action): UserHistory = UserHistory (
+ action: UserHistory.Action): UserHistory = UserHistory(
id = LongId(0L),
executor = executor,
documentId = Some(documentId),
@@ -32,7 +32,7 @@ object UserHistory {
def forRecord(executor: LongId[User],
recordId: LongId[MedicalRecord],
state: UserHistory.State,
- action: UserHistory.Action): UserHistory = UserHistory (
+ action: UserHistory.Action): UserHistory = UserHistory(
id = LongId(0L),
executor = executor,
recordId = Some(recordId),
@@ -43,7 +43,7 @@ object UserHistory {
def forTrial(executor: LongId[User],
trialId: StringId[Trial],
state: UserHistory.State,
- action: UserHistory.Action): UserHistory = UserHistory (
+ action: UserHistory.Action): UserHistory = UserHistory(
id = LongId(0L),
executor = executor,
trialId = Some(trialId),
@@ -54,7 +54,7 @@ object UserHistory {
def forPatient(executor: LongId[User],
patientId: UuidId[Patient],
state: UserHistory.State,
- action: UserHistory.Action): UserHistory = UserHistory (
+ action: UserHistory.Action): UserHistory = UserHistory(
id = LongId(0L),
executor = executor,
patientId = Some(patientId),
@@ -70,40 +70,40 @@ object UserHistory {
}
object State {
- case object Clean extends State
- case object Organize extends State
- case object Extract extends State
- case object Summarize extends State
+ case object Clean extends State
+ case object Organize extends State
+ case object Extract extends State
+ case object Summarize extends State
case object Criteriarize extends State
- case object Verify extends State
- case object Curate extends State
- case object Review extends State
- case object Flag extends State
+ case object Verify extends State
+ case object Curate extends State
+ case object Review extends State
+ case object Flag extends State
val All: Set[State] = Set[State](Clean, Organize, Extract, Summarize, Criteriarize, Verify, Curate, Review, Flag)
val fromString: PartialFunction[String, State] = {
- case "Clean" => State.Clean
- case "Organize" => State.Organize
- case "Extract" => State.Extract
- case "Summarize" => State.Summarize
+ case "Clean" => State.Clean
+ case "Organize" => State.Organize
+ case "Extract" => State.Extract
+ case "Summarize" => State.Summarize
case "Criteriarize" => State.Criteriarize
- case "Verify" => State.Verify
- case "Curate" => State.Curate
- case "Review" => State.Review
- case "Flag" => State.Flag
+ case "Verify" => State.Verify
+ case "Curate" => State.Curate
+ case "Review" => State.Review
+ case "Flag" => State.Flag
}
def stateToString(x: State): String = x match {
- case State.Clean => "Clean"
- case State.Organize => "Organize"
- case State.Extract => "Extract"
- case State.Summarize => "Summarize"
+ case State.Clean => "Clean"
+ case State.Organize => "Organize"
+ case State.Extract => "Extract"
+ case State.Summarize => "Summarize"
case State.Criteriarize => "Criteriarize"
- case State.Verify => "Verify"
- case State.Curate => "Curate"
- case State.Review => "Review"
- case State.Flag => "Flag"
+ case State.Verify => "Verify"
+ case State.Curate => "Curate"
+ case State.Review => "Review"
+ case State.Flag => "Flag"
}
implicit def toPhiString(x: State): PhiString = Unsafe(Utils.getClassSimpleName(x.getClass))
@@ -117,31 +117,31 @@ object UserHistory {
}
object Action {
- case object Start extends Action
- case object Submit extends Action
+ case object Start extends Action
+ case object Submit extends Action
case object Unassign extends Action
- case object Resolve extends Action
- case object Flag extends Action
- case object Archive extends Action
+ case object Resolve extends Action
+ case object Flag extends Action
+ case object Archive extends Action
val All: Set[Action] = Set[Action](Start, Submit, Unassign, Resolve, Flag, Archive)
val fromString: PartialFunction[String, Action] = {
- case "Start" => Action.Start
- case "Submit" => Action.Submit
+ case "Start" => Action.Start
+ case "Submit" => Action.Submit
case "Unassign" => Action.Unassign
- case "Resolve" => Action.Resolve
- case "Flag" => Action.Flag
- case "Archive" => Action.Archive
+ case "Resolve" => Action.Resolve
+ case "Flag" => Action.Flag
+ case "Archive" => Action.Archive
}
def actionToString(x: Action): String = x match {
- case Action.Start => "Start"
- case Action.Submit => "Submit"
+ case Action.Start => "Start"
+ case Action.Submit => "Submit"
case Action.Unassign => "Unassign"
- case Action.Resolve => "Resolve"
- case Action.Flag => "Flag"
- case Action.Archive => "Archive"
+ case Action.Resolve => "Resolve"
+ case Action.Flag => "Flag"
+ case Action.Archive => "Archive"
}
implicit def toPhiString(x: Action): PhiString = Unsafe(Utils.getClassSimpleName(x.getClass))
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala
index 5474413..5135c21 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala
@@ -4,9 +4,7 @@ import xyz.driver.pdsuicommon.domain.LongId
import xyz.driver.pdsuicommon.logging._
import xyz.driver.pdsuidomain.entities.{Label, RawPatientLabel}
-final case class ExportPatientLabel(id: LongId[Label],
- name: String,
- evidences: List[ExportPatientLabelEvidence])
+final case class ExportPatientLabel(id: LongId[Label], name: String, evidences: List[ExportPatientLabelEvidence])
object ExportPatientLabel extends PhiLogging {
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala
index e6262ed..bd6173b 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala
@@ -6,7 +6,9 @@ import xyz.driver.pdsuidomain.entities.{Patient, RawPatientLabel}
import scala.collection.breakOut
-final case class ExportPatientWithLabels(patientId: UuidId[Patient], labelVersion: Long, labels: List[ExportPatientLabel])
+final case class ExportPatientWithLabels(patientId: UuidId[Patient],
+ labelVersion: Long,
+ labels: List[ExportPatientLabel])
object ExportPatientWithLabels {
@@ -15,8 +17,7 @@ object ExportPatientWithLabels {
phi"ExportPatientWithLabels(patientId=$patientId, version=${Unsafe(labelVersion)}, labels=$labels)"
}
- def fromRaw(patientId: UuidId[Patient],
- rawPatientRefs: List[RawPatientLabel]) = ExportPatientWithLabels(
+ def fromRaw(patientId: UuidId[Patient], rawPatientRefs: List[RawPatientLabel]) = ExportPatientWithLabels(
patientId = patientId,
labelVersion = 1L, // TODO It is needed to replace this mock label version.
labels = rawPatientRefs
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala
index 1655a88..60b74ff 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala
@@ -36,16 +36,21 @@ object ExportTrialWithLabels {
condition = trial.condition,
lastReviewed = trial.lastReviewed,
labelVersion = 1, // TODO It is needed to replace this mock label version.
- arms = rawData.groupBy(_.armId).map { case (armId, rawTrials) =>
- ExportTrialArm(armId, rawTrials.head.armName)
- }(breakOut),
- criteria = rawData.groupBy { x =>
- (x.criterionId, x.labelId)
- }.map {
- case (_, rawTrialLabels) =>
- val armIds = rawTrialLabels.map(_.criterionArmId).toSet
- ExportTrialLabelCriterion.fromRaw(rawTrialLabels.head, armIds)
- }(breakOut)
+ arms = rawData
+ .groupBy(_.armId)
+ .map {
+ case (armId, rawTrials) =>
+ ExportTrialArm(armId, rawTrials.head.armName)
+ }(breakOut),
+ criteria = rawData
+ .groupBy { x =>
+ (x.criterionId, x.labelId)
+ }
+ .map {
+ case (_, rawTrialLabels) =>
+ val armIds = rawTrialLabels.map(_.criterionArmId).toSet
+ ExportTrialLabelCriterion.fromRaw(rawTrialLabels.head, armIds)
+ }(breakOut)
)
}