Blog

GSoC 2017 Final Report

It’s the end of the GSoC 2017 and here is my final report.

The photo below is from my colleague Ujjwal Arora‘s blog. I hope he doesn’t sue me :D.

gsoc-lh

 

Project Title

Radiology Reporting Enhancements Continuation

Description

The LibreHealth Radiology Module provides features of a Radiology Information System powered by LibreHealth Toolkit. In the past the module could only create free text reports. To report a completed radiology order such as an x-ray examination, users of the module were presented with simple text field that they fill in their reports and on submission this text is stored inside the database as a string. But this was too limiting as radiologists use templates to create reports.

My task as GSoC student was to provide a means where users of this module will be able to use already developed templates to report their observations and store them as Complex Obs. Some of these templates can be downloaded from http://radreport.org/. These templates are in HTML 5 format.

Note support for MRRT report templates was provided last year during GSoC 2016. After GSoC 2016 the module was able to import MRRT report templates but it did not use these templates in the creation of reports yet. https://ivange94blog.wordpress.com/2016/08/20/gsoc-2016-final-evaluation/

Team

  • Student (me)
  • Mentors
    • Judy Gichoya (Radiologist, US)
    • Ankit Rastogi (Medical Doctor, Canada)

I’d also like to acknowledge the org admin for  LibreHealth Robert (Robby) O’Connor for the smooth running of the programming and always making sure we don’t miss any GSoC deadline. Thank you.

Both LibreHealth and the OpenMRS community helped me a lot with my queries. At OpenMRS Daniel Kayiwa was always there to answer my questions on IRC and https://talk.openmrs.org. A lot of other community members in OpenMRS also responded to my queries.

Work Done

Backend work

None of my code has been merged and hardly reviewed. I communicated my progress to my mentors using screenshots of the working software and documentations on my weekly blogs. All the work that was done for the backend can be found in the gsoc2017 branch on my fork of LibreHealth Radiology.

I started the coding phase by trying to make the radiology module a fhir server. I thought it was theoretically impossible as the docs on implementing a fhir server talked of java web applications with their own web.xml deployment descriptor while the radiology module was not a web application on it’s own but need a server which was the actual web application and I may be right. After spending almost half of the first coding phase working on this with no progress, my mentors decided I continue with the primary goals of my GSoC project which was to use MRRT report templates in the creation of reports and also build a new UI for the radiology module. For more information on this, visit the links below

https://gitlab.com/librehealth/lh-radiology/issues/16

https://ivange94blog.wordpress.com/2017/06/04/gsoc-week-1/

https://ivange94blog.wordpress.com/2017/06/13/gsoc-week-2/

https://forums.librehealth.io/t/gsoc-project-radiology-reporting-enhancements-continuation/817/6

https://forums.librehealth.io/t/gsoc-project-radiology-reporting-enhancements-continuation/817/7

The two major changes to the backend was the creation of radiology reports using MRRT report templates and storing them as Complex Obs and refining of the REST API.

Create reports using MRRT templates

Modified the claim report section of the radiology order details page to provide option for creating MRRT reports

Screen Shot 2017-08-26 at 11.54.44 PM

Author report using an imported MRRT report template

Screen Shot 2017-08-27 at 12.07.58 AM

Once your report is saved, you can view it in the editor and can also download a copy of it as html since it’s been stored as Complex Obs and complex obs handles the saving of the report as a file.

I turned off template validation. It was decided that the module will not validate these templates. That validation will be left for radreport.org.

Commit Save radiology reports as complex obs. This commit actually holds a lot more than it’s title suggest. Since my code was not been reviewed and merged during the program, I found my self pushing to this branch and having too many unmerged commits to follow up at once so I had to squash all in one commit.

For documentation on how to use this feature, visit https://ivange94blog.wordpress.com/2017/08/21/creating-a-radiology-report-using-mrrt-report-template-librehealth-radiology/

REST API work

I also worked on the REST API for the radiology module. I faced a lot of difficulties here as the REST module was not properly documented and it was kind of hard to figure things out on my own. I sometimes had to place breakpoints in the code and run it in debug mode and followed the workflow just to understand how things work and how to make modifications. Sometimes I figured things out by a lot of tries and errors.

I implemented the REST endpoint for /radiologyorder to GET/POST/DELETE radiologyorders

Screen Shot 2017-08-27 at 1.27.08 AM

Commit Implement the newDelegate and save methos to create radiology order

Frontend

After research and discussions with my mentors we decided to use Angular 4 for our frontend. Angular 4 is component based and really easy to work with.

I had to pick up Angular on the fly. I had no previous experience working with Angular so I started with a course on Udemy. But I didn’t finish the course. Was going to take a while to finish it so I just used the Angular docs.

The code for the new UI is hosted on my github repo

https://github.com/ivange94/lh-radiology-owa

Dashboard

Screen Shot 2017-08-27 at 1.37.03 AM

Add order

Screen Shot 2017-08-27 at 1.38.43 AM

Order detail

Screen Shot 2017-08-27 at 1.40.28 AM

Edit report

Screen Shot 2017-08-27 at 1.41.43 AM.png

Report templates

Screen Shot 2017-08-27 at 1.42.42 AM.png

The above screenshot show some components of the UI.

The UI is simple, user friendly and responsive. And at the back it’s built with reusability in mind.

My next plans

  • code, code, code
  • Run my Java User Group
  • Have fun
  • continue working on LibreHealth Radiology
  • Travel for Open Source Summit North America
  • Travel for QCon San Francisco
  • Mentor Google Code-in 2017
  • Mentor Google Summer of Code 2018

I’m currently the only one contributing code to the radiology module. There’s a lot of work left to make the radiology module ready for it’s first release. I plan to form a team to work on the radiology module. I run a Java User Group in my community and I’ll be bringing in two enthusiastic members from the group to join me work on the module. This will be great a experience for us. For me I’ll be gaining experience running a team and for them it’ll be good learning experience and first time exposure to open source.

Together we’ll

  • Remove the legacyui from the radiology module so the module is left only with the Java API and REST API. We’ll be using the new UI moving forward.
  • Implement REST endpoints for the other radiology resources /radiologyreport, /mrrtreporttemplate and /radiologymodality
  • Clean up the UI code and move it to LibreHealth GitLab repo.
  • Work on packs server integration
  • Design and implement a more feasible solution for FHIR integration with radiology

Commits

Save radiology reports as complex obs

Implement the newDelegate and save methos to create radiology order

https://github.com/ivange94/lh-radiology-owa/commits/master?author=ivange94

Skills Acquired

I picked up Angular 4 on the fly

Learned how to work with minimal supervision

Understood more about the codebase and what improvements are needed.

References

https://forums.librehealth.io/t/gsoc-project-radiology-reporting-enhancements-continuation/817

https://summerofcode.withgoogle.com/projects/#5824169460629504

https://forums.librehealth.io/t/rest-module-does-not-document-post-for-radiologyorderresource/994

https://forums.librehealth.io/t/why-do-i-get-404-on-javascript-files-that-are-present-my-application-root-in-an-angular-2-owa/949

https://forums.librehealth.io/t/caused-by-java-lang-classnotfoundexception-javax-servlet-servletregistration/797/5

https://forums.librehealth.io/t/dependency-issues-with-making-the-radiology-module-a-fhir-server/766

Since LibreHealth Radiology is a fork of the OpenMRS Radiology module. I made use of the OpenMRS forums to get a wider audience to my problems. Below is a list threads I opened in OpenMRS

https://talk.openmrs.org/t/creating-a-radiologyorder-via-rest/12878

https://talk.openmrs.org/t/rest-module-does-not-document-post-for-radiologyorderresource/12830

https://talk.openmrs.org/t/rational-for-defining-the-display-property-on-resources/12818

https://talk.openmrs.org/t/search-concepts-by-concept-class-via-rest/12800

https://talk.openmrs.org/t/why-do-i-get-404-on-javascript-files-that-are-present-my-application-root-in-an-angular-2-owa/12465

https://talk.openmrs.org/t/sdk-failure-when-using-the-watch-goal/11969

https://talk.openmrs.org/t/help-understanding-how-datadelegatingcrudresource/11898

https://talk.openmrs.org/t/reports-saved-a-complex-obs-dont-show-up-on-obs-section-on-patient-dashboard/11889

https://talk.openmrs.org/t/can-a-module-have-its-own-database-configs-different-from-core/11782

https://talk.openmrs.org/t/help-understand-how-openmrs-works-with-fhir/10730

 

Advertisements

Creating a Radiology Report using MRRT Report template LibreHealth Radiology

Introduction

As of last year the LibreHealth Radiology module which was at that time under OpenMRS supported MRRT report templates. But these templates where not used in the creation of reports yet. This year during GSoC coding phase one, the MRRT templates are been used in creation of radiology reports.

This feature is not stable yet but for the purpose of GSoC evaluations I’m documenting it though a lot will change after GSoC evaluations are over. But the workflow will stay the same. The changes to be made about this feature will not be visible to end users but developers. The current way the report templates are been stored adds unnecessary complexity to the codebase and I already made a proposal to my mentors about refactoring and it was approved.

Procedure

Get the module

This code is not yet merged into LibreHealth so you’d have to clone of my own version of the code from https://gitlab.com/ivange94/lh-radiology/ and checkout the gsoc2017 branch and build then deploy to a running LibreHealth Toolkit 2.0 server. Also install the Open Web Apps Module and the Webservices module.

Configurations

Before you can go ahead and use the module to create orders and reports there are some configurations that need to be made before you can create orders and reports.

You need to set your orderable concepts before you can create an order.

Also you need to set a complex concept for the reporting tool to use when creating radiology reports. Radiology reports are saved as complex obs. To create complex obs you need to have at least one complex concept in your system. With my new proposal to change how the reports and templates are been stored, you won’t need to configure this. It will be removed but for now just bare with it.

Set Orderable Concepts

The screenshot below shows the property you need to set.

Screen Shot 2017-08-19 at 9.55.46 PM

You need to set the UUID of all concept classes you’ll want to be orderable. For this tutorial we are going to use the concept class Test

Procedure

Go to Administration/Manage Concept Classes and click on the Test concept class then copy the UUID.

Go to Administration/Settings/Radiology and paste the UUID in the Radiology Concept Classes box as shown above.

Set Complex Obs for Reports

As mentioned above, reports are saved as complex obs. For this there needs to be at least one complex concept in the system. You normally add concepts via a concept dictionary but for this we’ll go ahead and create one just for testing purposes.

Create a complex concept

Go to Dictionary and click add new concept. For testing purposes you can name your concept anything. The most important thing is to make sure it’s datatype is set to Complex and the handler is set to TextHandler

Screen Shot 2017-08-21 at 12.06.57 PM

Save your concept and copy it’s UUID

Screen Shot 2017-08-21 at 12.09.53 PM.png

Go to Administration/Settings/Radiology and paste the UUID to the complex class box

Screen Shot 2017-08-21 at 12.12.10 PM

You are now set up to create Orders and Reports.

Create an Order

In the Radiology dashboard under the Orders tab

Screen Shot 2017-08-21 at 12.22.41 PM

Click on Add Radiology Order to add a new order. To be able to report this order you must set it’s status to Completed.

Screen Shot 2017-08-21 at 12.32.59 PM.png

Under the report section you’ll notice a dropdown with a default of Free Text Report. We are going to create an MRRT report and for that you need to have an MRRT Report template.

You can add an MRRT template by importing it from the Report Templates Tab on the Radiology dashboard

Screen Shot 2017-08-21 at 12.35.36 PM

When creating a report select MRRT Report and search for a template to use for your report. I have one template in my system so I’ll search of Cardiac MRI

Screen Shot 2017-08-21 at 12.39.09 PM

Select your template and click claim report. You’ll be presented with a template editor that uses the template you selected.

Screen Shot 2017-08-21 at 12.40.21 PM

Enter principal results interpreter/Provider and complete your report.

GSoC Final Coding Phase Week 1

The first week of the final coding phase just concluded and for this phase my job was to fetch actual data from the backend via REST.

The screenshot below shows actual orders that are fetched from the backend via REST

Screen Shot 2017-08-06 at 2.51.27 PM

And below are reports fetched from the backend

Screen Shot 2017-08-06 at 2.51.41 PM

More work still needs to be done on how the data is displayed on the tables. I intend to make the table paginated so that it will reduce the load time when reports are been fetched. There are some angular components for data tables that implement pagination but I’ll implement mine. I’ve tried a couple that didn’t work and were not very user friendly.

The app currently only interacts with the backend by fetching data. The next step is adding data. The starting point is radiology orders. And that is the complicated one as during the order creation process a lot of REST calls have to be made to the backend.

When creating an order, you need a patient, provider, imaging procedure, etch and all have these have to be obtained via REST search. See order dialog below

Screen Shot 2017-08-06 at 2.51.59 PM

Once we are able to add orders via REST, the next hard part to implement via REST is Report Template import.

Commits this week

https://github.com/ivange94/lh-radiology-owa/commit/7c54d68b30bb34e713c6a76c59022ccda2a35783

https://github.com/ivange94/lh-radiology-owa/commit/9099e3d994919577fca1810fccf2b0169cb128d0

https://github.com/ivange94/lh-radiology-owa/commit/46bfed004007a54ac49a9eca66fc7d784d96211e

 

 

GSoC Coding Phase 2 Week 3 & 4

Second Evaluation for GSoC just ended and for this coding phase I have bootstrap the new UI for radiology and fix all bugs I was having with the UI and now ready to use real data from the database with the Angular HTTPModule.

I was also able to deploy my app as an Open Web Apps. In the another blog post, I’ll give a tutorial for creating an Open Web App with Angular 2 and successfully deploy it.

This session was the most interesting one. I was able to pickup Angular 2 on the fly and build my UI.

You can access the code of my work so far from https://github.com/ivange94/lh-radiology-owa

Below is a screencast of the new UI

GSoC Coding Phase 2 Week 2

The second week of GSoC coding phase 2 just ended. This week has mostly been about learning Angular 2.

I also took some time out to follow up on my US nonimmigrant visa to attend the Open Source Summit North America. I traveled to the capital city for my visa interview on Friday July 7th as I had my interview on Monday the 10th of July. It was an 8 hours bus ride. My visa interview was successful and on I collected my visa the next day July 11 and since it was already late to return home, I traveled back to my city the next day July 12.

During this time I was also learning angular from the angular.io. At the same time working on the UI. Built some components already.

New Radiology dashboard built with Angular 2. The header and the footer are separate reusable components and the dashboard itself is another component. It’s still not complete though.

Screen Shot 2017-07-17 at 10.31.20 AM

 

 

New report authoring.

Screen Shot 2017-07-17 at 10.32.09 AM

GSoC Coding Phase 2 Week 1

It’s a little over a week since the GSoC first evaluation ended on June 30th, 2017. Glad to say I passed the first evaluation with good remarks from my mentors. The radiology back end code can now save radiology reports using MRRT templates. That’s a great achievement.

For the phase 2 of the program I’ll be working on a new UI for radiology. We’ll be leaving the legacy OpenMRS UI and build a new user interface based on web components. The initial idea was to use Polymer for this but Angular 2 changed the story. Angular 2 is component based and perfect fit for out goals.

The front end will be an Open Web App which is supported by the LH Toolkit thanks to the OpenMRS Open Web Apps module. The web app will be an Angular 4 + Twitter bootstrap project. And it will communicate with Toolkit via REST.

I’m fairly new to all the technologies to be used for the front end so I started off by enrolling to an Angular 4 course on Udemy using my GSoC stipend. I also watched some videos about twitter bootstrap. I’m also learning Angular 2 from the angular.io tutorials. I’ve still not covered enough angular to complete the front end but I’m making much progress with angular and I’m confident to meet my 2nd evaluation goals.

I’ve setup an Angular project for LibreHealth Radiology and hosted it on GitHub. I’ll be updating the app as I get more understanding of Angular while moving on with the course.

GSoC First Evaluation Report

Introduction

The first coding phase of GSoC just ended and here is my report.

The milestone for this phase was to make it possible to create radiology reports using MRRT report templates. And I’m happy to say the milestone was achieved and it’s now possible to create MRRT reports instead of the traditional free text reports. First I’ll demonstrate how to use it then I’ll go throw my implementation details.

Create an MRRT Report

This still in development so you’ll have to build the radiology module to test this. To build it clone my repo on gitlab

git clone https://gitlab.com/ivange94/lh-radiology.git

Then checkout the gsoc2017 branch

cd lh-radiology

git checkout gsoc2017

Now build a the .omod file

mvn clean install

You can now deploy your module to toolkit/core server. To setup a server see standard OpenMRS or LibreHealth Toolkit documentation for instructions. The following instructions assume you already have a server running OpenMRS 2.0.5. For rapid development I setup my server using the OpenMRS SDK. The server runs openmrs version 2.0.5. But any 2.x version should work fine.

To create a radiology report using an MRRT template, first you have to make sure you have at least one MRRT template imported into the system. To import a template, visit the Report Templates Tab on the radiology dashboard. And click on upload new template and select your template file.

Screen Shot 2017-06-28 at 9.13.37 PM

Now if template import is successful then you are one step closer to been ready to use these templates to create a radiology report.

These reports are saved as html files on the file system. We needed to make it possible to query these reports when querying observations for a patient. So instead of the radiology module taking care of saving the file, it’s uses an OpenMRS API Complex Obs. All the radiology module has to do is create a complex obs and set it’s complex data to the contents of the report and hand it over to the openmrs api to save the complex obs with the report. To use complex obs you must have at least one complex concept in the system. Concepts are normally added via a standard concept dictionary or via metadata sharing module. But for development and testing you can go ahead and manually create a complex concept. For that click on the ‘Dictionary’ link on the home page and click add new concept.

Screen Shot 2017-06-28 at 9.29.35 PM

The concept data type must be complex and handler TextHandler

Screen Shot 2017-06-28 at 9.32.16 PM

Save the concept and proceed to creating your report.

To create a report you need a completed radiology order obviously. We are reporting the findings of performing a radiology procedure after all.

Screen Shot 2017-06-28 at 9.35.24 PM

Save your order and you can now claim your report. If you you used the old version of the module you’ll release a drop down that specifies the kind of report you want to create. If you select Free text then you’ll proceed with creating a normal radiology report with using a template file. But if you select MRRT, you’ll be presented with a search box to search a template to use.

Screen Shot 2017-06-28 at 9.39.59 PM

Click on a template from the suggestions

Screen Shot 2017-06-28 at 9.41.23 PM

Click on claim report and you’ll be presented with a report editor that uses the MRRT template as a starting point.

Screen Shot 2017-06-28 at 9.47.16 PM

Fill your report and save it by hitting Complete.

See my next blog post about my implementation of the above feature.

GSoC Week 3

The third week of GSoC ended a few days ago and this my report. During week two updates I reported that I was able to save radiology reports as files on the file system but I didn’t use Complex Obs for that. But due to the different advantages we’ll have in saving as complex obs including making it possible to query a report when all observations on patients are been queried, my mentor Judy requested I save it as an obs and since this is a file we have to use complex obs since it handles files well.

Here is my merge request https://gitlab.com/librehealth/lh-radiology/merge_requests/14.

To see it work you need at least one complex concept in the system. This concept will normally be added via a standard concept dictionary but for development purposes you can go ahead and manually create a complex concept and copy it’s uuid as shown on the screenshot. Make sure to select TextHandler

Screen Shot 2017-06-20 at 8.01.55 AM

Then copy the uuid of your complex concept and paste it to the radiology global property Complex Concept. For that go to Administration -> Settings -> Radiology  and you’ll see a setting called Complex Concept and paste your uuid there. See screenshot below

Screen Shot 2017-06-20 at 8.11.16 AM.png

Now you can go ahead claim a report for a completed order or just create your new order and set it’s status to completed then claim the report. After saving the report you can see your obs by going to

Administration -> Manage Observations search observations by patient name and you’ll see a link to your report file.

Screen Shot 2017-06-20 at 8.15.35 AM.png

Next steps

The system currently saves only free text reports as complex obs. I’m adding support for saving MRRT reports too. I have already worked on the backend code for handling reports created with MRRT templates and I’m now working on the front end to have something that I can demo.

GSoC Week #2

GSoC Week 2 just ended and I did not accomplish much. I spent a lot of time on making the radiology module a fhir server. I’m moving back to primary goals of my GSoC project this week by moving on the next phase of my timeline which says radiology reports should be stored as files. Here is my first commit to that end https://gitlab.com/librehealth/lh-radiology/merge_requests/12. Right now when  a report is saved, the contents of the report are been saved in a file on the server and the location of this file is saved in a RadiologyReport.path.

I did not use Complex Obs for this but as per the discussions here https://gitlab.com/librehealth/lh-radiology/issues/17, last comment, saving it as complex obs will make it easier for users to see completed report from patient dashboard obs section.

GSoC Week #1

Official coding for GSoC began 30th of May and here is an update of what I have been doing.

My task is to make the radiology module a fhir server. I am following this tutorial http://hapifhir.io/doc_jpa.html and using this code https://github.com/jamesagnew/hapi-fhir/tree/master/hapi-fhir-jpaserver-example as reference. I kept on having issues with making the radiology module a fhir server. After implementing all the classes in radiology as documented in the fhir docs, my builds kept failing. Also the tutorial does not explain much about the different parts of the example server code on github so I have to make guesses about some things. So I decided to build a fhir server from scratch out of radiology just so I can understand the differents parts of the fhir server architecture. The problem I’ve been having so far is knowing which dependencies I should declare in my pom. The code on github is a multi module maven project and some dependencies in the parent pom have nothing to do with setting up a fhir jpa but they are declared in the pom just because another module needs them. Also there are some dependencies that are declared in the pom that are not directly used in the code.

I joined the fhir mailing list and posted the problems I was having there and though my problem was not directly solved I was pointed to another sample code that sets up a fhir server. https://github.com/nhsconnect/careconnect-java-examples. This is easier to work with as it’s not a multi module project hence all dependencies in the pom will probably be what’s necessary to setup a fhir server. And this has been helpful, I am beginning to understand why I kept on having build failures and trying to resolve them. But still the same I still have to figure things out just by looking at the code.

Here is the link to fhir server I’m working on https://github.com/ivange94/fhir-example-server. I used spring boot. I’ve just implemented the single class necessary to setup a fhir server(a class that extends one of the dstu base classes in this case dstu3). Now when I run the tests spring is unable to initialize the application context due to some missing dependencies. Currently working on that.