diff options
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala | 18 | ||||
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala | 12 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala index 4999365..f742915 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala @@ -110,7 +110,7 @@ object document { implicit val documentFormat: RootJsonFormat[Document] = new RootJsonFormat[Document] { override def write(document: Document): JsValue = JsObject( - "id" -> document.id.id.toJson, + "id" -> document.id.toJson, "recordId" -> document.recordId.toJson, "physician" -> document.physician.toJson, "typeId" -> document.typeId.toJson, @@ -138,35 +138,35 @@ object document { val physician = fields .get("physician") - .map(_.convertTo[String]) + .flatMap(_.convertTo[Option[String]]) val typeId = fields .get("typeId") - .map(_.convertTo[LongId[DocumentType]]) + .flatMap(_.convertTo[Option[LongId[DocumentType]]]) val provider = fields .get("provider") - .map(_.convertTo[String]) + .flatMap(_.convertTo[Option[String]]) val providerTypeId = fields .get("providerTypeId") - .map(_.convertTo[LongId[ProviderType]]) + .flatMap(_.convertTo[Option[LongId[ProviderType]]]) val institutionName = fields .get("institutionName") - .map(_.convertTo[String]) + .flatMap(_.convertTo[Option[String]]) val meta = fields .get("meta") - .map(_.convertTo[TextJson[Meta]]) + .flatMap(_.convertTo[Option[TextJson[Meta]]]) val startDate = fields .get("startDate") - .map(_.convertTo[LocalDate]) + .flatMap(_.convertTo[Option[LocalDate]]) val endDate = fields .get("endDate") - .map(_.convertTo[LocalDate]) + .flatMap(_.convertTo[Option[LocalDate]]) Document( id = LongId(0), diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala index 66b710e..436fbe9 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala @@ -37,15 +37,15 @@ object extracteddata { case JsObject(fields) => val labelId = fields .get("id") - .map(_.convertTo[LongId[Label]]) + .flatMap(_.convertTo[Option[LongId[Label]]]) val categoryId = fields .get("categoryId") - .map(_.convertTo[LongId[LabelCategory]]) + .flatMap(_.convertTo[Option[LongId[LabelCategory]]]) val value = fields .get("value") - .map(_.convertTo[LabelValue]) + .flatMap(_.convertTo[Option[LabelValue]]) ExtractedDataLabel( id = LongId(0), @@ -118,15 +118,15 @@ object extracteddata { val keywordId = fields .get("keywordId") - .map(_.convertTo[LongId[Keyword]]) + .flatMap(_.convertTo[Option[LongId[Keyword]]]) val evidence = fields .get("evidence") - .map(_.convertTo[String]) + .flatMap(_.convertTo[Option[String]]) val meta = fields .get("meta") - .map(_.convertTo[TextJson[Meta]]) + .flatMap(_.convertTo[Option[TextJson[Meta]]]) val labels = fields .get("labels") |