[GSoC][LibreHealth] Work accomplished on FHIR Analytics during GSoC 2018

It has been a wonderful GSoC 2018. I would like to thank my mentors Namratanehete, Saptarshi and Judy for giving me the opportunity to work with LibreHealth on this GSoC 2018.

Image result for gsoc librehealth

Project Objective

The main objective of this project is to research and develop component to work on FHIR analytic capabilities. FHIR(Fast Healthcare Interoperability Resources) is the latest standard to be developed under the HL7 organization. FHIR is targeting to overcome the limitations of HL7 and CDA standards. FHIR is becoming more and more popular. FHIR has more than thirty well defined resources which addresses several clinical domain objects. Patient, Observation, Encounter and MedicationRequest are some of main FHIR resources.

It’s a major requirement to work on the analytic capabilities of FHIR data to extract useful information. FHIR resources are designed to contain many information on single resource. When it come to analytic, it’s often required to combine multiple resources and query data. In this project I have used Bunsen along with Apache Spark to power the FHIR analytic. Bunsen is a open source library which provide encoders for FHIR resources which provide the facility to load FHIR data into Apache Spark. LibreHealth is developing new platform based on FHIR specification which uses Cassandra as the underline data source. Analytic module is using Cassandra as the data source. Analytic module will be park of the platform which allow users to exchange data via FHIR specification and perform FHIR analytic through this module.Here is the architecture of the module.

LibreHealth FHIR Analytics

FHIR Analytic Module Provide functionality query FHIR data through Spark SQL which is famous SQL like language query for Apache Spark. FHIR analytic module also provide user interface to perform analytic on resource wise for five main FHIR resources.

FHIR Analytic Using Spark SQL

LibreHealth FHIR Analytic Module Provide UI to execute Spark SQL against the data available in the system. For example if someone want’s to get the patients which have observations valueQuantity greater than 15. Then following Spark SQL will get the required data.

SELECT patient.id, observation.id, observation.subject, observation.valueQuantity FROM patient inner join observation where observation.subject.reference == patient.id and observation.valueQuantity.value > 15
Query Results

FHIR Resource Base Analytics

Someone might find difficulties in writing Spark SQL queries. Hence Analytic module provide simple UI for perform analytics on key FHIR Resources such as Patient, Encounter, Observation, DiagnosticReport and MedicationRequest. Here is the patient demographics based search UI. User can search for exact match or contains search by using contains checkbox. Also user can do a search with combine attributes or individual attributes.

Patient Query User Interface
Patient Query Results

Data Upload User Interface

FHIR Analytic Module provide functionality to upload data from file system. User can upload a FHIR Resource or a Bundle and perform analytic on top of this resource.

Data Upload User Interface

Project Discussion Forums

Project Code Base

Github User : https://gitlab.com/kavindya89/

Blog Posts

Platform Module Integration

I have worked on integrating the platform module and analytic module together. Platform module is targeting to provide capability to perform CRUD operations on FHIR resources which powered by SprinD Data and Cassandra. Since this module is also a new GSoC project and it’s is developing by Yash who is a another GSoC student. Finally we need to merge these two modules together and use single data source to perform CRUD operations on FHIR resource and the analytic. I have worked on this task and integrate the code base of both of these modules. Currently I’m progressing on using single data source for both of the modules.

Next Tasks

  • Complete the task of using single data source for both platform and analytic module
  • Working on bug fixes


  • Improving the user interfaces and add more core FHIR resources
  • Improving the test coverage
  • Upgrading libraries to latest version

Final Note

It has been a great pleasure to work with LibreHealth during GSoC 2018. I have worked on completely new project which is started from the scratch. Even though GSoC is coming to a end, I’ll be continue to working on FHIR Analytic module and improve it. I have learn lot of new technologies which I haven’t worked before. It’s a great experience for me. Again I should thank my mentors Namratanehete, Saptarshi and Judy for continuously giving their suggestions and guidance to success this project. I should thank LibreHealth community for their support. Finally I thank Google for organizing GSoC and wish more and more success.