# GSoC 2020: Improving OpenMRS DHIS2 Integration

**URL:** <https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623>\
**Category:** GSoC\
**Tags:** module\
**Created:** [May 22, 2020, 2:53am UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623 "2020-05-22T02:53:05Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayasanka](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jayasanka/32/22204_2.png) [@jayasanka](https://talk.openmrs.org/u/jayasanka)\
**Post date:** [May 22, 2020, 2:53am UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623/1 "2020-05-22T02:53:05Z")

</div>

Hello there,

I’m using this thread to update my progress on $subject. You can find a quick introduction to this project here:

> **[Improved OpenMRS DHIS2 Integration](https://docs.google.com/document/d/1wEPKfPMBaQN0ZEqDqjEJ1rYIPCrkX5Uj8k1Ve5SOz4s/edit?usp=sharing)**
>
> Google Summer of Code | 2020 IMPROVED OPENMRS DHIS2 INTEGRATION Project Introduction Prepared By: Jayasanka Weerasinghe Content Introduction	2 Project Objectives	4 Gathering Requirement	4 The User Interface Upgrade	5 Making the...

I’ve scheduled a weekly meeting for this project. Event Link:

[![](https://www.google.com/calendar/images/ext/gc_button1_en.gif)](https://calendar.google.com/event?action=TEMPLATE&tmeid=MnNqb2Q2ZnVmZ2ltYmc2cnJwNmxxcDNvNXVfMjAyMDA1MjRUMTEzMDAwWiBqYXlhc2Fua2Euc2Fja0Bt&tmsrc=jayasanka.sack%40gmail.com)

---

<div class="post-metadata">

**Author:** ![jayasanka](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jayasanka/32/22204_2.png) [@jayasanka](https://talk.openmrs.org/u/jayasanka)\
**Post date:** [May 22, 2020, 2:55am UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623/2 "2020-05-22T02:55:07Z")

</div>

**1st GSoC Weekly Call**

Held on: 2020-05-17T11:30:00Z

Attendees: @akshika47 @heliostrike @jayasanka

**Meeting minutes**

1. Meeting began with a quick bout of introductions from mentors.
2. Continue the discussion on the requirement gathering process on talk thread. [GSoC 2020: Improving OpenMRS DHIS2 Integration - Requirement gathering](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration-requirement-gathering/28378)
3. Try to contact a few hospitals this week.
4. Clarify how to initiate the OWA for the DHIS2 Reporting module.
5. Meeting ended on a positive note, looking forward to a great GSoC.

**Tasks for the Week:**

1. Continue the Requirement Gathering discussion. ✅
2. Try to contact a few hospitals. ✅
3. Clarify how to initiate the OWA for the DHIS2 Reporting module ✅
4. Join [ETL/ELT Stand Up](https://talk.openmrs.org/t/2020-05-20-etl-elt-stand-up/28415) to get an idea of how meetings are conducted. ✅

> _LEGEND:_
> 
> ✅ - Completed
> 
> 🔛 - Ongoing

---

<div class="post-metadata">

**Author:** ![akshika47](https://talk.openmrs.org/user_avatar/talk.openmrs.org/akshika47/32/11494_2.png) [@akshika47](https://talk.openmrs.org/u/akshika47)\
**Post date:** [May 22, 2020, 9:44am UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623/3 "2020-05-22T09:44:06Z")

</div>

This is a good practice @jayasanka

---

<div class="post-metadata">

**Author:** ![jayasanka](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jayasanka/32/22204_2.png) [@jayasanka](https://talk.openmrs.org/u/jayasanka)\
**Post date:** [May 25, 2020, 3:59am UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623/4 "2020-05-25T03:59:15Z")

</div>

**2nd GSoC Weekly Call**

Held on: 2020-05-24T11:30:00Z

Attendees: @heliostrike @jayasanka

**Meeting minutes**

1. Reviewed the draft mail which was prepared to send implementors
2. Had a discussion on Micro-Frontend architecture

**Tasks for the next week**

1. Get the draft mail reviewed ✅
2. Contact implementors 🔛
3. Continue the discussion on OWA and clarify how to initiate the UI ✅

> _LEGEND:_
> 
> ✅ - Completed
> 
> 🔛 - Ongoing

---

<div class="post-metadata">

**Author:** ![jayasanka](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jayasanka/32/22204_2.png) [@jayasanka](https://talk.openmrs.org/u/jayasanka)\
**Post date:** [June 8, 2020, 1:49pm UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623/5 "2020-06-08T13:49:33Z")

</div>

Update for the 1st week (2020-05-31T18:30:00Z - 2020-06-06T18:30:00Z):

1. According to the thread most of them recommended using micro frontends. I went through the architecture and learned a lot from that. 🙂 I was able to set up the micro frontend on the openMRS reference application. Then I faced the following problem:

> [@2019-11-13: OpenMRS University: OpenMRS Dev Set up for FHIR Module and Microfrontends](https://talk.openmrs.org/t/2019-11-13-openmrs-university-openmrs-dev-set-up-for-fhir-module-and-microfrontends/25459/5):
>
> I set up this but I’m having the following questions. It isn’t available on HTTPS but with HTTP. May I know how to setup https? Or is it a typo? 2. When I generate the import-map.json along with the frontend content using packmap it builds the UI same as in this tutorial: But it’s different than [https://openmrs-spa.org/openmrs/spa/home](https://openmrs-spa.org/openmrs/spa/home). So I enabled the dev tools and override the import map with [this map](https://openmrs-spa.org/openmrs/frontend/import-map.json) ([openmrs…](http://openmrs-spa.org)

1. In the meanwhile, I started a thread to check if there’s a way to get a cloud server to host a DHIS2 instance or gain access to already created one. Didn’t receive a good response yet.

> [@Is there a way to get a cloud server to host a DHIS2 instance?](https://talk.openmrs.org/t/is-there-a-way-to-get-a-cloud-server-to-host-a-dhis2-instance/28848):
>
> Hi all, I’m working on my GSoC Project; [GSoC 2020: Improving OpenMRS DHIS2 Integration](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623). Currently, I have set up a DHIS2 instance on my local machine for testing purposes. But, it is a resource-consuming setup and a little bit hard to run other applications with that. May I know is there a way to get a cloud server to host the DHIS2?

1. Received only two responses from the implementors. [OpenMRS Requirement Gathering for DHIS2 Module](https://docs.google.com/forms/d/1PRnvbA3dLgqolsHPGCgmAdDXXdR9_yrwEKtQTV7RKLo/edit#responses). I will update the thread with a summary and ask Jeniffer to send her the implementors list.

**Blog Posts:**

[https://medium.com/@jayasanka\_sack/get-set-ready-code-efd7cc4cbe1a](https://medium.com/@jayasanka_sack/get-set-ready-code-efd7cc4cbe1a)

[https://medium.com/@jayasanka\_sack/code-is-on-fire-literally-figuratively-dc1d3db4078b](https://medium.com/@jayasanka_sack/code-is-on-fire-literally-figuratively-dc1d3db4078b)

---

<div class="post-metadata">

**Author:** ![jayasanka](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jayasanka/32/22204_2.png) [@jayasanka](https://talk.openmrs.org/u/jayasanka)\
**Post date:** [June 8, 2020, 1:58pm UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623/6 "2020-06-08T13:58:08Z")

</div>

**GSoC Mentoring Weekly Call**

Held on: 2020-06-07T15:30:00Z

Attendees: @akshika47@jayasanka

**Meeting minutes**

1. Reviewed the current progress
2. I was asked to join ongoing calls related to DHIS2

**Tasks for the next week**

1. Collect more implementor contacts and reach them 🔛
2. Join ongoing calls related to DHIS2 🔛
3. Connect to local DHIS2 instance and test it with the current implementation ✅
4. Initiate a basic frontend UI module 🔛

> _LEGEND:_
> 
> ✅ - Completed
> 
> 🔛 - Ongoing

---

<div class="post-metadata">

**Author:** ![jayasanka](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jayasanka/32/22204_2.png) [@jayasanka](https://talk.openmrs.org/u/jayasanka)\
**Post date:** [June 24, 2020, 2:51pm UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623/7 "2020-06-24T14:51:45Z")

</div>

**GSoC Mentoring Weekly Call**

Held on: 2020-06-20T15:30:00Z

Attendees: @akshika47 @jayasanka

**Meeting minutes**

- Reviewed the current progress
- Discussed with the data model of DHIS2 and the visualization
- Planned to come up with a new database structure to store disaggregations

**Tasks for the next week**

- Comeup with model and DB structure to store disaggregations ✅
- Start implementing the proposed model 🔛

> _LEGEND:_
> 
> ✅ - Completed
> 
> 🔛 - Ongoing

---

<div class="post-metadata">

**Author:** ![jayasanka](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jayasanka/32/22204_2.png) [@jayasanka](https://talk.openmrs.org/u/jayasanka)\
**Post date:** [June 24, 2020, 3:01pm UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623/8 "2020-06-24T15:01:10Z")

</div>

Updates for 2nd and 3rd week ( 2020-06-07T18:30:00Z - 2020-06-20T18:30:00Z)

1. Post data to the DHIS2 instance using ADX format

> [@DHIS2 Reporting module crashes when trying to post](https://talk.openmrs.org/t/dhis2-reporting-module-crashes-when-trying-to-post/28956):
>
> Hi all, I set up the DHIS2 Reporting module recently and tried to post data from the module. When I select the “Post to DHIS2” option and click the “Generate” button the page gets crashed immediately. I created an issue explaining the bug: When I’m digging into the code I found that we need to fix the following in order to fix this. The content type of the request payload is incorrect. (It should be application/adx+xml) JAXB mapping for the response payload is incompatible The UI should u…

Tickets:

> **[Jira](https://openmrs.atlassian.net/browse/DRM-47)**

> **[Jira](https://openmrs.atlassian.net/browse/DRM-48)**

> **[Jira](https://openmrs.atlassian.net/browse/DRM-49)**

> **[Jira](https://openmrs.atlassian.net/browse/DRM-50)**

1. Post data and from using the module and visualized it on the DHIS2 visualizer app. Did a background study on the DHIS2’s model structure.

 ![image](https://talk.openmrs.org/uploads/default/original/2X/2/2037b5d3c5fb3266435ccb11cf9af9bd46da1184.jpeg)

Related discussions:

> **[Query failed, likely because the requested analytics table does not exist](https://community.dhis2.org/t/query-failed-likely-because-the-requested-analytics-table-does-not-exist/39586)**
>
> Hi all, I get this error when I’m trying to visualize data using the Data Visualizer app. I checked the DB and there’s no table named analytics. The UI shows a “No Data” message and there’s an error throwing from the backend. Could someone...

**Blog posts** :

[https://medium.com/@jayasanka\_sack/dont-just-sit-there-do-something-the-answers-will-follow-193f7411e206](https://medium.com/@jayasanka_sack/dont-just-sit-there-do-something-the-answers-will-follow-193f7411e206)

[https://medium.com/@jayasanka\_sack/to-understand-something-visualize-it-39f641baf678](https://medium.com/@jayasanka_sack/to-understand-something-visualize-it-39f641baf678)

---

<div class="post-metadata">

**Author:** ![jayasanka](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jayasanka/32/22204_2.png) [@jayasanka](https://talk.openmrs.org/u/jayasanka)\
**Post date:** [June 27, 2020, 8:31am UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623/9 "2020-06-27T08:31:02Z")

</div>

@akshika47 could you please review and merge the following PRs?

- [https://github.com/openmrs/openmrs-module-dhisreport/pull/71](https://github.com/openmrs/openmrs-module-dhisreport/pull/71)
- [https://github.com/openmrs/openmrs-module-dhisreport/pull/70](https://github.com/openmrs/openmrs-module-dhisreport/pull/70)

Issues:

- [https://issues.openmrs.org/browse/DRM-51](https://issues.openmrs.org/browse/DRM-51)
- [https://issues.openmrs.org/browse/DRM-51](https://issues.openmrs.org/browse/DRM-51)

---

<div class="post-metadata">

**Author:** ![jayasanka](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jayasanka/32/22204_2.png) [@jayasanka](https://talk.openmrs.org/u/jayasanka)\
**Post date:** [July 9, 2020, 7:26am UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623/10 "2020-07-09T07:26:33Z")

</div>

Updates for the 4th and 5th week ( 2020-06-21T18:30:00Z - 2020-07-04T18:30:00Z)

1. Create a new DB structure and a class structure to support ADX disaggregations

> [@Support ADX disaggregations with DHIS2 Reporting Module](https://talk.openmrs.org/t/support-adx-disaggregations-with-dhis2-reporting-module/29154):
>
> Hi all, The current module doesn’t support ADX disaggregations. In order to do that we need to map DHIS2’s Categories and CategoryOptions within the module. The next thing is the current import format is not compatible with the exported metadata information of DHIS2. We have to fix it at all. This is the current DB: There’s an existing ticket that suggested a structure. [https://issues.openmrs.org/projects/DRM/issues/DRM-43](https://issues.openmrs.org/projects/DRM/issues/DRM-43) But according to the [DHIS2 ADX documentation](https://docs.dhis2.org/master/en/developer/html/webapi_adx_data_format.html) we don’t need t…

1. Configure Travis build and reformat the code

> **[Jira](https://openmrs.atlassian.net/browse/DRM-51)**

> **[Jira](https://openmrs.atlassian.net/browse/DRM-52)**

> <https://github.com/openmrs/openmrs-module-dhisreport/pull/71>
>
> \## The issue I worked on
> See https://issues.openmrs.org/browse/DRM-52
> 
> \## Des…cription of what I changed
> \- Create a Travis configuration file
> \- Edit the .gitignore file to remove it from the ignored list

> <https://github.com/openmrs/openmrs-module-dhisreport/pull/70>
>
> \## Issue I worked on
> 
> See https://issues.openmrs.org/browse/DRM-51
> 
> \## Descr…iption of what I changed
> \- Configure the Maven build to reformat source code to comply with \[Google Java Style\](https://google.github.io/styleguide/javaguide.html).
> \- Reformat the code

**Blog posts:**

[https://medium.com/@jayasanka\_sack/taming-the-beast-4c7722997a67](https://medium.com/@jayasanka_sack/taming-the-beast-4c7722997a67)

[https://medium.com/@jayasanka\_sack/to-commit-or-not-to-commit-e40c5f77869c](https://medium.com/@jayasanka_sack/to-commit-or-not-to-commit-e40c5f77869c)

---

<div class="post-metadata">

**Author:** ![jayasanka](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jayasanka/32/22204_2.png) [@jayasanka](https://talk.openmrs.org/u/jayasanka)\
**Post date:** [July 14, 2020, 5:53am UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623/11 "2020-07-14T05:53:11Z")

</div>

Updates for the 6th week ( 2020-07-05T18:30:00Z - 2020-07-11T18:30:00Z )

1. Implement the new model structure to support ADX disaggregations and remove some previous implementations.

> [@Support ADX disaggregations with DHIS2 Reporting Module](https://talk.openmrs.org/t/support-adx-disaggregations-with-dhis2-reporting-module/29154/6):
>
> Hello there, We have to remove existing implementations that aren’t compatible with the new ADX disaggregations. The current implementation is designed according to the DFX structure but later on, it has changed to ADX while keeping the same. It supports only non disaggregated data. Unfortunately, the current implementation isn’t expandable because it is incompatible with the latest DHIS2’s data structure. In order to implement it, we have to remove some previous implementations. Also, there a…

1. Import a Dataset from the metadata XML file

**Tickets:**

> **[Jira](https://openmrs.atlassian.net/browse/DRM-53)**

> **[Jira](https://openmrs.atlassian.net/browse/DRM-54)**

> **[Jira](https://openmrs.atlassian.net/browse/DRM-56)**

**Pull Requests:**

> <https://github.com/openmrs/openmrs-module-dhisreport/pull/72>
>
> \## The issue I worked on
> See https://issues.openmrs.org/browse/DRM-53
> 
> \## Des…cription of what I changed:
> \- Remove previous implementations which aren't compatible with ADX profile changes
> \- Remove unused classes and imports
> \- Remove unnecessary system outs.

> <https://github.com/openmrs/openmrs-module-dhisreport/pull/73>
>
> \## The issue I worked on
> See https://issues.openmrs.org/browse/DRM-54
> 
> \## Des…cription of what I changed:
> 
> \- Implement new model classes
> \- Add SQL queries to create the DB
> \- Implement Hibernate mappings

> <https://github.com/openmrs/openmrs-module-dhisreport/pull/74>
>
> \## The issue I worked on
> See https://issues.openmrs.org/browse/DRM-56
> 
> \## Des…cription of what I changed:
> \- Add JAXB annotations to the Metadata and Dataset classes
> \- Create a view to upload the XML file
> \- Create a new controller to the view
> \- Unmarshal the XML file and save the dataset on the DB 
> 
> !\[Kapture 2020-07-13 at 15 24 28\](https://user-images.githubusercontent.com/33048395/87291689-52143180-c51d-11ea-9739-5809307fe276.gif)

**Related other discussions:**

> **[Is it possible to generate a Data Value Set Template for ADX?](https://community.dhis2.org/t/is-it-possible-to-generate-a-data-value-set-template-for-adx/39632/4)**
>
> Hi. There is currently no functionality to generate the datavalue template. It can be done quite easily externally by downloading the required metadata definition for dataste, dataelements and categories. If you have a need for this core...

**Blog posts:**

[https://medium.com/@jayasanka\_sack/the-breakup-f0db46659b71](https://medium.com/@jayasanka_sack/the-breakup-f0db46659b71)

Tasks for the next week:

1. Import Data Elements ✅
2. Import Categories ✅
3. Import Category Options ✅
4. Generate Data Value Templates ✅

---

<div class="post-metadata">

**Author:** ![jayasanka](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jayasanka/32/22204_2.png) [@jayasanka](https://talk.openmrs.org/u/jayasanka)\
**Post date:** [July 23, 2020, 4:20pm UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623/13 "2020-07-23T16:20:47Z")

</div>

Updates for the 6th week ( 2020-07-12T18:30:00Z - 2020-07-18T18:30:00Z )

- Generated JAXB classes to fully unmarshal the import file using XJC. XJC compiles an XML schema file into fully annotated Java classes.
- Create methods to extract and save,
  1. Data Elements
  2. Data Set
  3. Categories
  4. Category Options
  5. Disaggregations

- Create a new DAO method to save Disaggregations
- Create a new DAO method to find a Dissagregation using a Category and a Category Option
- Implement a method to generate Data Value Template
- Implement a recursive method to generate Disaggregation combinations for a given Data Element
- Remove irrelevant field “name” from Data Value Template
- Fix wrong field “dataelement\_id” in Data Value Template’s mapping file
- Implement DAO methods to
  1. save a Data Value Template
  2. remove Data Value Templates of a given Dataset
  3. get Disaggregations of a given Category

**Pull Requests:**

> <https://github.com/openmrs/openmrs-module-dhisreport/pull/75>

> <https://github.com/openmrs/openmrs-module-dhisreport/pull/76>

> <https://github.com/openmrs/openmrs-module-dhisreport/pull/77>

**Blog posts:**

> **[The Blueprint](https://medium.com/@jayasanka_sack/the-blueprint-184e23be9363)**
>
> This is the seventh week of my GSoC project. Yet another challenging week of my GSoC journey. The major task for this week was completing…

---

<div class="post-metadata">

**Author:** ![jayasanka](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jayasanka/32/22204_2.png) [@jayasanka](https://talk.openmrs.org/u/jayasanka)\
**Post date:** [August 6, 2020, 1:30pm UTC](https://talk.openmrs.org/t/gsoc-2020-improving-openmrs-dhis2-integration/28623/14 "2020-08-06T13:30:18Z")

</div>

Updates for 2020-07-19T18:30:00Z - 2020-08-05T18:30:00Z

- Create a new view to list imported Data Sets
- Create a new controller to handle reports
- Create a new DAO method to get all Data Sets
- Modify the local header with new links and fix broken HTML tags
- Remove irrelevant JSP pages
- Create DAO methods to
  - Find Data Value Templates by a Data Set
  - Find a dataset by UUID

- Create a new service to update the report of a Data Set
- Create a new view to map Report with a DataSet
- Create a DAO method to find a DataValueTemplate by id
- Create a service to update the Report Indicator of a DataValue Template
- Create a view to mapping DataValueTemplates with Report Indicators
- Exclude dependencies which included `javax.xml.namespace.QName`
- Create new Controller and Service methods to
  - Execute the mapped Report Definition
  - Map Report result with Data Value Templates
  - Generate ADX output
  - Post data to connected DHIS2 instance

**Pull Requests:**

> <https://github.com/openmrs/openmrs-module-dhisreport/pull/78>

> <https://github.com/openmrs/openmrs-module-dhisreport/pull/79>

> <https://github.com/openmrs/openmrs-module-dhisreport/pull/80>

> <https://github.com/openmrs/openmrs-module-dhisreport/pull/81>

**Blog posts:**

> **[This is the better one. It’s identical.](https://medium.com/@jayasanka_sack/this-is-the-better-one-its-identical-43fceb99db0)**
>
> Mapping OpenMRS Report with a  DHIS2 DataSet

> **[Sam’s Patrol is not Sam’s Patrol!](https://medium.com/@jayasanka_sack/sams-patrol-is-not-sam-s-patrol-a0502026ba31)**
>
> Generating ADX output with OpenMRS DHIS2 Reporting Module
