Project : FHIR Swagger Codegen Integration and Strategic Improvements

Project Wiki : https://wiki.openmrs.org/display/projects/OpenMRS+FHIR+Module
Mentor :- Harsha Kumara
Backup Mentor :- Sanatt Abrol

Source Code Repository

Project Description

The purpose of this project is to expand the capabilities and functions of the OpenMRS FHIR module. OpenMRS has recently undertaken a commitment to implement FHIR in order to ensure better interoperability between healthcare systems. The OpenMRS FHIR module was developed as part of these efforts. FHIR specification is continuously subjecting to several development iterations which improves the usability. Swagger also becoming more popular these days. …


GSoC is ending during this week. I have worked on testing the module and the documentation. I have added project documentation in https://wiki.openmrs.org/display/projects/Swagger+SDK+Generation. I’ll add a detail post soon with final progress update.


This week, I revisited my feature and added test case for enhancement that I made in the last week. Since next week is the last week, I’m continue to test the feature and looking for possible improvements that I can make to my feature.

Below is get patients by id operation generated automatically by the swagger SDK generator.

/**
* Build call for patientIdGet
* @param id Id of the Patient resource (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body…

Time flew so fast as GSoC is coming to a end after two weeks. I have added my GSoC midterm presentation to youtube. If you interested please watch following video.

During this week I have made an improvement to FHIR module. Swagger definition of FHIR module doesn’t contain security definitions section. This is an issue when Swagger SDK generation. Because basic authentication scheme isn’t present, client can’t invoke with basic authentication headers. I have added the fix in https://github.com/openmrs/openmrs-module-fhir/pull/160.

Then I add demo client which uses generated Java SDK in https://github.com/eunice18/demo-sdk-client. …


After the second evaluations, my next target is now implementing the demo client which use generated SDK to invoke the OpenMRS FHIR APIs. I have gone through the code of the generated SDK for Java and understand the APIs which required to be called from the demo client. Now I’m going to start a sample project which wraps the SDK to write the client.

Demo Client Flow

Above diagram shows the interconnections between the components when writing the demo client. I’m planning to complete the demo client by next week.


This is a very productive week as I complete both the backend implementation of SDK generation with the front end implementation of the feature. I also added test cases for this feature. Finally all the pull requests are merged now after fixing the review comments.

Building Blocks of SDK Generation

Above diagram showcase the building blocs of the SDK generation. Swagger SDK generation library is used to generate the SDKs for different languages. I have used the existing swagger definition generator to populate the swagger definition for APIs that supported from the FHIR module. This definition inserted to SDK generation library along with the language…


This week, I was little busy with my exam. I informed this to the mentor. Since I have completed the main feature, I’m currently working on improving the user interface and provide support to generate the SDK for all the languages. My goal is to complete this during the next week and complete the task with the testing.

Follow image shows latest languages which support by the Swagger SDK generation library.

Latest supported client and server side SDK languages

After completing the main task by next week, I’ll work on sample Java base SDK which will demonstrate the capability of the generated SDK.


This week I have worked on fixing the comments on my pull request and implement the front end to generate the swagger SDK. I have to learn spring front end development methods to work on this feature. During the end of this week, I was able to download the swagger SDK from the front end.

Popup Dialog to Generate SDK

I have created pull request for front end developments in https://github.com/openmrs/openmrs-module-fhir/pull/157. Currently I’m working improving the user interface. After completing these two tasks, I’m planning to add tests for the implemented functionality.


After several hours of coding, I was able to generate the Swagger SDK from the REST API. I have added a new API, which allow users to generate the swagger SDK for given language.

The REST API can be access from below URL.

http://localhost:8080/openmrs/ms/fhir/fhirCodeGenServelet

This API accepts the language which swagger SDK should be generate. I’m currently working on implementing the front end user interface which allow users to generate the SDK from the UI.

Relevant pull request is added in https://github.com/openmrs/openmrs-module-fhir/pull/156

From next week, I will be able to write a detail blogpost about the feature with the user interface.


This week is the week before the first evaluations. When I’m going through the swagger code generation, I notice that swagger code generator allow users to generate both client side SDK and server side SDK. After discussion with my mentor, we plan to support both the options.

I have made very good progress this week. I was able to generate the basic version of the swagger client side SDK generation. Here is partial of sample code generate from the swagger code generation library. …

Eunice Amoh

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store