DHISReport DHIS2 WebAPI Project

Hello Everyone, The discussions related to DHISReport DHIS2 WebAPI shall be done here. This talk thread is dedicated to discuss and understand the requirements of the project in details.

3 Likes

Hi Team, Would it be possible to export the DHIS2 report from an instance of OpenMRS and be able to import it offline into an instance of DHIS2 if both share the same facility directory? Kayode

1 Like

hello everyone, In the DRM-4, we will be working on automating the process of creating report definItion XML by importing the from the DHIS2 implementation. As part of this project, we can also add few more rest call to integrate DHIS2 Web API with the DHIS Report Module in a better way.

Please let me know your thoughts on which features can be added to the module. @maurya @jamesm you might know about user’s requirements, please let me know your views on this.

P.S. Features that DHIS2 Web API provide can be found here.

Hello @kayodu,

Yes, it is possible, but currently the end user needs to do a REST call using cURL and get the import file. A download option is requested at DRM-8, you can follow the updates for the feature on the issue page.

1 Like

@pralay, these were the resources that were needed to map OpenMRS Period Indicator Reports to DHIS2 Datasets.

2 Likes

Thanks @pascal for sharing the resources you used with @pralay.

@pralay, The key is to eliminate the manual upload of report definition and also being able to sychronize the data elements in OpenMRS and DHIS2 when there are changes.

@maurya, is it possible to have a short session with @pralay to refine the requirements for the Dhisreport webapi project?

2 Likes

@jamesm, yes we can setup a call. I’ll send an invite and we can proceed further.

Hello everyone,

Here is the current status of the Project:

0. Test DHIS2 Connection with OpenMRS

A User can now test if OpenMRS instance is connected with DHIS2 instance with the click of a button.

1. We can import all the report definitions from DHIS2 instance on click of a button.

We can now get all the report definitions and store them in OpenMRS instance. The metadata transference is done behind the scenes.

2. We can map OpenMRS Locations to DHIS2 ORG Units.

The feature to map OpenMRS Locations to DHIS2 ORG Units is made very simple. The user is provided with two drop down menu with OpenMRS Locations in one and DHIS2 ORG Units in other. He/She can select proper locations and click “Map Locations” Button.

3. No need to create a CODE Attribute for locations to map the ORG Units.

In the older version of this module, we had to create CODE Attribute in OpenMRS Locations to map the DHIS2 ORG units. Now this step can be avoided and mapping can be done as mentioned in point #2.

4. View the mapped locations, i.e. We can see which OpenMRS Location is Mapped to DHIS2 ORG unit.

The user can see the which OpenMRS Locations is mapped to which DHIS2 ORG Units. The new tab is created for mapping purpose.

If anyone is interested in finding out more about these features then you may visit my blog.

I’ll be writing documentations for these features in next week.

1 Like

The documentation for following features is attached. The direct link to the documentation is here.

  1. Test connectivity of OpenMRS instance with DHIS2 instance.

  2. Import Report Definitions from DHIS2 instance.

  3. Map OpenMRS Location with DHIS2 ORG Units.

  4. View Mapped OpenMRS locations.

Please let me know your views on the Documentation.

GSoC_Documentation.pdf (746.7 KB)

2 Likes

GSoC week 6 Update:

In this week I have worked mostly on writing test cases for the package org.openmrs.module.dhisreport.api.impl

The package requires good understanding of the working of MVC Pattern along with OpenMRS API.

The few methods, for which I am writing the test cases are

  • evaluateReportDefinition

  • generateReportingReportDefinition

  • saveReportTemplates

  • unMarshallandSaveReportTemplates

  • getLocationByOrgUnitCode

The work on these module is not complete yet, but I am looking forward to complete it by the end of this week.

Hello Everyone,

I have worked on this project last summer under the mentorship of @maurya. I would like to continue the work on this module.

I was trying to find the ideas to work on DHIS2 Module. @maurya a few weeks back we had a small discussion over ADX standard which needs to be modified and few other things that need to be fixed. Can you please give me some more information about the issue so we can brainstorm over the solution?

Any Suggestions or ideas are most welcome.

1 Like

This is strange because when i installed the DHIS2 Reporting module it looks OK but when i click on the DHIS2 tab i am getting error. HTTP Status 500 - Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()Lorg/hibernate/classic/Session;

type Exception report

message Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()Lorg/hibernate/classic/Session;

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()Lorg/hibernate/classic/Session; org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1287) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) javax.servlet.http.HttpServlet.service(HttpServlet.java:624) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:60) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:72) org.openmrs.module.owa.filter.OwaFilter.doFilter(OwaFilter.java:57) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70) org.openmrs.module.xforms.web.XformsFilter.doFilter(XformsFilter.java:69) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70) org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:54) org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:108) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

root cause

java.lang.NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()Lorg/hibernate/classic/Session; org.openmrs.module.dhisreport.api.db.hibernate.HibernateDHIS2ReportingDAO.getAllReportDefinitions(HibernateDHIS2ReportingDAO.java:145) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) com.sun.proxy.$Proxy615.getAllReportDefinitions(Unknown Source) org.openmrs.module.dhisreport.api.impl.DHIS2ReportingServiceImpl.getAllReportDefinitions(DHIS2ReportingServiceImpl.java:216) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) com.sun.proxy.$Proxy616.getAllReportDefinitions(Unknown Source) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:121) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) com.sun.proxy.$Proxy617.getAllReportDefinitions(Unknown Source) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) com.sun.proxy.$Proxy617.getAllReportDefinitions(Unknown Source) org.openmrs.module.dhisreport.web.controller.ReportController.listReports(ReportController.java:87) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:177) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) javax.servlet.http.HttpServlet.service(HttpServlet.java:624) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:60) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:72) org.openmrs.module.owa.filter.OwaFilter.doFilter(OwaFilter.java:57) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70) org.openmrs.module.xforms.web.XformsFilter.doFilter(XformsFilter.java:69) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70) org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:54) org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:108) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.68 (Ubuntu) logs.

This module needs to be updated to support platform 2.x

You would start this by creating a ticket: https://wiki.openmrs.org/display/docs/Tickets

@dkayiwa - was a ticket ever created? I can’t find one on Jira when I searched with “DHIS2”

If you cannot find it, probably it was not created.