This is the better one. It’s identical

Mapping OpenMRS Report with a DHIS2 DataSet

This is the 8th week of my GSoC project. The major task for the week was Mapping DataSets and Data Value Templates with OpenMRS reports.

Read my previous article to get an idea about how these mappings works,

First, I had to map a Data Set with an OpenMRS Period Indicator Report. A Period Indicator Report is a special type of OpenMRS report which has three parameters; start date, end date, and location. As same as a DHIS2 DataSet does.

Every report has an attribute named UUID. I used the UUID to map a report with a Data Set. A UUID is something interesting to talk about. UUID stands for universally unique identifier. It looks like a 32-character sequence of letters separated using dashes. Here are some examples,

1a813c76–3b4a-469f-be69–68f658df4186
aa1e777b-baf6–42ab-b4b9-b9d13889cae7

Creating a random UUID with java is much simple as,

The interesting thing is every UUID comes with a promise; no two UUIDs are identical. The chance of having a duplicate is very rare. In other words, the annual risk of a given person being hit by a meteorite is estimated to be one chance in 17 billion, which means the probability is about 0.00000000006. It is equivalent to the odds of creating a few tens of trillions of UUIDs in a year and having one duplicate. Interesting eh? So, the UUIDs are a great way to give entities a unique id. [1][2]

Anyway, after mapping the reports, the next task was mapping report indicators with Data Value Templates. In the previous implementation, Data Value Templates had an attribute to store Report’s UUID. Since the reports have been mapped with Data Sets, that attribute becomes redundant. Therefore I removed it. Also, the report indicators are mapped using the label of the indicator; which is not unique at all. I removed it and added a new attribute to store the UUID of the corresponding indicator.

Next week I’m planning to complete the exporting data to DHIS2. With that, I can complete the functionality of the module end to end.

[1] P. Leach, M. Mealling, R. Salz. (2015) A Universally Unique IDentifier (UUID) URN Namespace. Available at: https://www.hjp.at/doc/rfc/rfc4122.html [Accessed 27 Jul. 2020].

[2] www.h2database.com. Universally Unique Identifiers (UUID). [online] Available at: http://www.h2database.com/html/advanced.html#uuid [Accessed 27 Jul. 2020].