Skip to content

Developer guide

Gilbert Agbodamakou edited this page Jun 10, 2020 · 15 revisions

Introduction

This guide provides instructions on how to deploy, configure and use the OpenMRS module "PosttoOpenHIM".

Prerequisites

PosttoOpenHIM has been built for OpenMRS 1.9.11. This version of OpenMRS is required to be able to modify this module. PosttoOpenHIM development environment requires:

  • Git
  • JDK 1.7
  • Maven
  • MySql 5.6
  • OpenMRS SDK
  • An IDE

Please follow this OpenMRS wiki to start with the building of OpenMRS modules:

https://wiki.openmrs.org/display/docs/Creating+Modules

Dependencies

PosttoOpenHIM uses the two following modules as dependencies:

The OpenMRS event module:

https://wiki.openmrs.org/display/docs/Event+Module

The OpenMRS web rest service API:

https://wiki.openmrs.org/display/docs/REST+Web+Services+API+For+Clients

Project structure

This OpenMRS project is a Maven project containing 2 Maven modules.

  • Post to OpenHIM API: This module is a non-web specific 'maven module' project, this module contains the source code concerning the PosttoOpenHIM module

  • Post to OpenHIM OMOD: This module defines the final .omod file that will be uploaded to the targeted OpenMRS instance.

Note: the project contains 3 pom.xml Maven build files. Pom.xml files describe the project or the modules and contain information about the build and the dependencies. We have one pom.xml file for the global project and one for each module (located in the Project file folder and in the modules folders).

Post to OpenHIM API

The "Post to OpenHIM API" module contains the following objects (path: rhies_PosttoOpenHIM_Module/tree/master/api/src/main/java/):

  • org.openmrs.module.posttoopenhim package:

    • PostToOpenHIMActivator: This pseudo MAIN Class of the module contains:

      • The started procedure: Triggered when the module starts, it uses the initiate OpenMRS global properties useful for the settings of the module
      • The setDaemonToken procedure: This is where the patient and encounter listeners are registered
    • PostToOpenhimConstants: This class contains all the constants useful for the module

  • org.openmrs.module.posttoopenhim.api package:

    • ModuleProperties: This class helps to retrieve OpenMRS global properties
    • Tunnel: This is where Patient and Context information is retrieved and sent to the targeted OpenHIM address
  • org.openmrs.module.posttoopenhim.api.impl package: This package contains the classes for:

    • Patients events listeners
    • Context events listeners
    • OpenMRS services
  • Other sources/src/main/resources/moduleApplicationContext.xml resource file: contains the declaration of the listeners created on org.openmrs.module.posttoopenhim.api.impl

Post to OpenHIM OMOD

The "Post to OpenhIM OMOD" module contains the following objects:

  • org.openmrs.module.posttoopenhim.web.controller packages:
    • PosttoOpenhIMController class: This class configured as controller using annotation and mapped with the URL. Used as a template, we are not using web requests in this project.

Getting Started

To get started please, check the README file

Installation

The deployment documentation about this PosttoOpenHIM module can be found in the Installation guide.

How to update the sending of OpenMRS event to OpenHIM?

The PosttoOpenHIM module is a generic module

Once you uploaded the PosttoOpenhim and have it running:

  1. Open OpenMRS and get connected.
  2. Go on Administration Tab
  3. Go the Maintenance section
  4. Click on Advanced Settings
  5. Ctrl+F and Search "PosttoOpenhim" to quickly jump into the PostToOpenhim setting section
  • On OpenHIM Openmrs host section: Put the base address to OpenMRS ex: https://localhost:8080/
  • On OpenMRS PostToOpenhim user name section: Put the OpenMRS user account to use by the module
  • On OpenMRS postToOpenhim user password section: Put the OpenMRS user password to use by the module
  • On OpenHIM client ID section: Put the OpenHIM client Id ex: openmrs
  • On OpenHIM Openmrs client Basic Auth Password section: Put the OpenHIM client chosen authentification password
  • On OpenHIM patient report URL: Put the address to reach the channel created to receive patient information ex: http://openhim-core:5001/patient/
  • On OpenHIM context report URL: Put the address to reach the channel created to receive forms information: https://openhim-core:5001/context/
  • On Openmrs PostToOpenhim forms Put the name of the forms to push to OpenHIM,";" separator is used to separate forms
  1. Save the settings

Document version

Last update: 04/06/2020 Version: 1.0