aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidence.scala
blob: fb403391f0ea642918b0116c80ea90442ca796dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package xyz.driver.pdsuidomain.entities.export.patient

import xyz.driver.pdsuicommon.domain._
import xyz.driver.pdsuicommon.logging._
import xyz.driver.pdsuidomain.entities.{ExtractedData, RawPatientLabel}

final case class ExportPatientLabelEvidence(id: LongId[ExtractedData],
                                            value: FuzzyValue,
                                            evidenceText: String,
                                            document: ExportPatientLabelEvidenceDocument)

object ExportPatientLabelEvidence {

  implicit def toPhiString(x: ExportPatientLabelEvidence): PhiString = {
    import x._
    phi"ExportPatientLabelEvidence(id=${Unsafe(id)}, value=$value, " +
      phi"evidenceText=${Unsafe(evidenceText)}, document=$document)"
  }

  def fromRaw(x: RawPatientLabel) = ExportPatientLabelEvidence(
    id = x.evidenceId,
    value = x.value,
    evidenceText = x.evidenceText,
    document = ExportPatientLabelEvidenceDocument(
      x.documentId,
      x.requestId,
      x.documentType,
      x.providerType,
      x.startDate
    )
  )
}