Sunday, June 14, 2020

How to add FHIR module into the OpenMRS Platform?

What is OpenMRS?




A few decades back,  all the medical reports of patients were recorded as paper records. It could not be easy to manage and had to spend more time when working on them. When modern technology came, Health Care Applications were created and used to effectively record and manage patient medical records. Some of the Health Care applications are created as free and open source applications. OpenMRS is one of the open-source EMR tools that have been developed and implemented since 2004. It is used by healthcare workers over 5,500 health facilities around the world including 169 countries.


OpenMRS Architecture


Architecture · GitBook


OpenMRS is a framework which builds upon Java and other related frameworks such as Hibernate and Spring MVC. It is based on a modular architecture. which consists of a core application and optional modules to provide additional functionalities to the core workflows. The reason to pull out some functionalities into modules from OpenMRS Core is, users can upgrade those modules with new features without waiting for the next OpenMRS Release.


One of the following ways can be used to try the OpenMRS application. 

  • OpenMRS Standalone Installation
  • OpenMRS SDK Installation
  • OpenMRS Manual Installation by Building Source Code


Installing the FHIR module locally along with the OpenMRS-Core


Install OpenMRS Core


Prerequisite - 

Install JDK 1.6 or above
Install Maven
Install MySQL  


Steps


1. Clone the openmrs-core git repository into the local machine.
    git clone https://github.com/openmrs/openmrs-core.git

2. Checkout into its 2.3.x branch.
     cd openmrs-core 
     git checkout 2.3.x

3. Build the project using Maven.
        mvn clean package   

This command will generate the openmrs.war file in  openmrs-core/webapp/target/ directory. It can be deployed into a web server like jetty or tomcat.

4. You can easily deploy the openmrs.war into the jetty application server using the following commands.
  cd openmrs-core/webapp

   mvn jetty:run


You can access the application at localhost:8080/openmrs

This OpenMRS-Core does not include all the modules in OpenMRS. Even it does not include the User Interface Module. Because of that, you can see a basic UI as follows.



Add modules into OpenMRS Platform


Stop the running server by pressing Ctrl + C keys in the running terminal.

You can add modules into the OpenMRS-Core and run the full Reference Application.

You can get those modules from here. In that page, you can find a link like "Download Reference Application (version number) Addons". You should get the correct version of the reference application that corresponds to the platform version that you are running. The Reference Application 2.10.0 is relevant to the OpenMRS Core application which builds from 2.3.x git branch. So you need to click Download Reference Application 2.10.0 Addons and download them into your local machine. 

Then Unzip that file and go to referenceapplication-package-2.10.0/modules directory. The file extension for OpenMRS modules is ".omod” . Copy all the omod files in here. Then put them into one of the following directories according to your operating system. 
  • In Linux - ~/.OpenMRS/modules
  • In WIndows - Windows + R > %appdata%>OpenMRS>Modules

Now your OpenMRS-Core application consists of several modules. Restart the server by running mvn jetty:run command in webapp directory in the project. You can access the OpenMRS User interface and other modules after adding these modules. 




This Reference Application 2.10.0 Addons contains the FHIR Module 1.20.0. You can access its endpoint using localhost:8080/openmrs/ws/fhir URL pattern. As an example, you can retrieve the patient details in FHIR format by patient id using the following URL.

http://localhost:8080/openmrs/ws/fhir/Patient?_id=00b8fdd1-7c6b-418c-8371-501d43564c5e

The FHIR1 module is deprecated and now the implementations are doing on the FHIR2 module. You can add new FHIR2 module into your OpenMRS reference application.

Add OpenMRS FHIR2 module


You cannot have both the FHIR1 and FHIR2 modules installed on the same system at the same time. So first you have to delete fhir-1.20.0.omod file from one of the following directories according to your operating system. 

  • In Linux - ~/.OpenMRS/modules
  • In WIndows - Windows + R > %appdata%>OpenMRS>Modules

Then you have to get source code from Github and build it.

1. Get Source code. 

2. Checkout to its master branch. 
         git checkout master

3. Build the project. 
         mvn clean install

After building the application, fhir2-1.0.0-SNAPSHOT.omod file will be created in the openmrs-module-fhir2/omod/target directory

4. Copy the fhir2-1.0.0-SNAPSHOT.omod file and paste it into one of the following directories according to your operating system.
  • In Linux - ~/.OpenMRS/modules
  • In WIndows - Windows + R > %appdata%>OpenMRS>Modules

5. Run the OpenMRS Core project using following commands. 
  cd openmrs-core/webapp
  mvn jetty:run

Now your OpenMRS reference application consists with FHIR2 module and you can access its resources using http://localhost:8080/openmrs/ws/fhir2/R4 URL Pattern. As an example, you can retrieve the patient details in FHIR format by patient name using the following URL.

localhost:8080/openmrs/ws/fhir2/R4/Patient?name=Andrew

You can find available resources in FHIR2 Module from here. https://wiki.openmrs.org/display/projects/OpenMRS+FHIR+Module

And you can get the FHIR conformance statement for the FHIR module using the following URL.


 FHIR conformance statement gives information about the following things.
  • Available resource types (ex - patient, location)
  • search parameters (ex - name, address-city)
  • Search parameter data types




Source of the article -























No comments:

Post a Comment

How to send Slack notification using a Python script?

 In this article,  I am focussing on sending Slack notifications periodically based on the records in the database. Suppose we have to monit...