Project: Implement Spring Data to LibreHealth Toolkit

toolkit
gsoc2018-project
gsoc2018

(Yash D. Saraf) #1

This thread is for discussions regarding GSoC project: Project: Implement spring data to the LibreHealth toolkit For the proposal see: https://goo.gl/96nfEu

This project’s purpose is to replace or rather migrate the existing persistence schema of LibreHealth toolkit which uses hibernate mappings to a more modular spring data persistence mechanism.


(Yash D. Saraf) #2

@sunbiz @namratanehete @prashadi I’m creating a spring boot app with spring starter, I’ve added
devtools, reactive web and lombok.
For reactive NoSQL databases, spring starter offers Redis, MongoDB, Cassandra and Couchbase. Which one should I go with?


(Namratanehete) #3

I think Cassandra and Couchbase is good option. But I would like you to do comparison of both databases and how does they work with Spark?

@sunbiz do you have any suggestions?


(Prashadi) #4

I’ll too check on the behavior of spark with these databases.


(Yash D. Saraf) #5

From reading up on both the dbs I’ve gathered this,

  1. Both Cassandra and Couchbase are schema free,
  2. Cassandra uses a Wide column store where data is stored in rows in sort of a key-value format with columns grouped into a column family, whereas Couchbase uses a Document store where JSON objects are stored and views are defined over those objects.
  3. Cassandra is entirely free whereas Couchbase has an Enterprise edition which is paid.
  4. Cassandra is highly scalable but Coucbase makes up for it in better read/write latencies.

However, I would like to build a sample app using each of them with spark to come to a conclusion.


(Saptarshi Purkayastha) #6

I recommend Cassandra. Implementing the app on Cassandra or CouchDB might be worth a try, but there are enough benchmarks out there that show Cassandra’s improved scalability for concurrent transactions, scalability across multiple nodes etc. And not to mention Spark deployments over Cassandra are very popular.

Though what really convinces me: Cassandra is on Java. If we are a Java platform, I don’t think we should add an Erlang dependency (Couchbase) unless it’s critically important. That’s my two cents!


(Prashadi) #7

Cassandra would be a good solution. Cassandra scalability is very high. There are several connectors which we can use to plug cassandara and spark. Datastax cassandra connector seems very popular https://github.com/datastax/spark-cassandra-connector


(Yash D. Saraf) #8

I guess we have enough reasons to use Cassandra over Couchbase. I’ll setup a spring reactive project using Cassandra in a gitlab repository.

Update: I’d also like to point out that Spring Data Rest does not work with Spring Reactive Web (webflux). https://jira.spring.io/browse/DATAREST-933
This is not a big issue since the new functional framework kind of reduces the load of rewriting similar controller functions.


(Saptarshi Purkayastha) #9

Yes, we will have very little to do with requiring Spring data REST, mainly because at the moment the Jackson bindings are synchronous or blocking IO.

Getting a quick-win with the HAPI-JPA style app, that uses their existing libraries, with Spring data JPA should be our first pass with Cassandra as the database. This could possibly be done even before we begin the coding phase. Then we can try to make it reactive. @yashdsaraf , does that sound like a good plan to you for your GSoC project?


(Prashadi) #10

@sunbiz @namratanehete

For my project, I will follow the below steps.

Hope my approach is correct.


(Yash D. Saraf) #11

@sunbiz From what I understand, I should clone HAPI JPA example and migrate it to Spring Data JPA with Cassandra, is this right?


(Saptarshi Purkayastha) #12

Yes, only as an sample app. So that we can do the same thing in our spring boot app.


(Yash D. Saraf) #13

Okay, I’m on it. :slight_smile:


(Prashadi) #14

@yashdsaraf please share the link of the gitlab project that you work on. So I can clone and start work. :slight_smile:


(Yash D. Saraf) #15

@prashadi Here’s the repo url https://gitlab.com/yashdsaraf/hapi-spring-jpa-fhir.git It’s just the https://github.com/yashdsaraf/hapi-fhir/tree/master/hapi-fhir-jpaserver-example as is right now, I’ll push the changes for Spring jpa later today. Also what’s your gitlab username? I’ll add you as a developer to the repo.


(Prashadi) #16

Great @yashdsaraf. My github username is kavindya89.


(Yash D. Saraf) #17

@sunbiz The example app uses DAOs from HAPI JPA server. Instead of using these I have to create Repository interfaces for all structures using spring data’s CRUDRepository right? Also am I supposed to migrate only the DSTU3 structures or older ones as well? Sorry for the nitty-gritty questions, I’d really like to be sure I’m headed in the right direction :sweat_smile:


(Saptarshi Purkayastha) #18

No problem with the nitty-gritty questions. But I’d like you to express your opinion and ask us for feedback.

I think only the DSTU3 structures are fine.

Yes, you create your own instead of using the dependencies that they use in the example jpa pom


(Prashadi) #19

According to my search, STU3 are the current mature structures and we should go with that. FHIR specification working on new R4 standard which is targeting to release fully on October.


(Lenya Hope Nembi) #20

@yashdsaraf, @prashadi please I have some doubt which needs clarifications. Firstly, since we are migrating from openmrs.librehealth to FHIR, will the implementation of the Spring Data for Toolkit be in the current toolkit repo or will you guys be creating a completely new app? Secondly, will your project include REST endpoints for Radiology Study, Procedure Request, Radiology Report and Report Template?