DHIS Report Module

Join the DHIS2 Integration discussion on OpenMRS Talk!

This module is an extension of dhis report module developed by hispindia group. This module makes creates a generic module that generates aggregated ADX messages leveraging reporting module that can be exported to DHIS2.

1.What this module does?

As mentioned earlier this is an extension of an earlier module and the documentation has parts of the earlier documentation(The original document is attached below). Just in case you would like to see if the earlier module might cater to your needs. It has an extensive detail on setting up the DHIS server 

This module automates the process of running sql queries against an OpenMRS instance and posting the results to a DHIS2 instance. It even exposes a set of web services that can be consumed through your applications or by using cURL. The module works with OpenMRS 1.9.x and higher.

The module configuration requires 2 things:

  • A report template which is uploaded into the module.
  • A DHIS2 instance (url, username and password).

The DHIS2 instance to which data is being reported should expose the Web-API. The data is sent as XML to the dataValueSets resource, but relying on human-readable "code field" instead of the more obscure uid.

1.1. Report template example:

This is the definition using which data will be POST'ed to a DHIS2 instance. The dataElements tag encompasses all the dataElements and their unique codes that are used in the report to be sent. Similarly, the disaggregations tag encompasses all the categoryOptionsCombo code and uid that are part of the dataElements to be reported.

The annotation contains the query used to generate the dataValue for the dataElement and its disaggregation.

Sample Report Template
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<reportTemplates>
    <dataElements>
        <dataElement code="ANC8146" uid="zajzl4FQFoI" name="ANC Insecticide Treated Bed nets distributed"/>
        <dataElement code="ANC8139" uid="Y5PjM4bF5rx" name="ANC 4th standard visit"/>
        <dataElement code="ANC8147" uid="pRqsvVsrDJV" name="ANC deworming performed"/>
        <dataElement code="ANC8137" uid="A2JDrKjR3nr" name="ANC First standard visit 1st trimester"/>
        <dataElement code="ANC8142" uid="Arr4LIIOlo4" name="ANC high risk pregnancies referred"/>
        <dataElement code="ANC8140" uid="FWuzAt99w1y" name="ANC high risk pregnancy detected_including pregnancy under 15 years"/>
        <dataElement code="ANC8153" uid="oSLpODeimyD" name="ANC HIV tested "/>
        <dataElement code="ANC8154" uid="z7BziiaCvq3" name="ANC HIV tested positive "/>
        <dataElement code="ANC8409" uid="LrqWgXVEIo5" name="ANC HIV tested who recieved their results"/>
        <dataElement code="ANC8136" uid="ri0XrmXSpEC" name="ANC New Registrations"/>
        <dataElement code="ANC8152" uid="jimOjhBpQlC" name="ANC new registrations anaemia Severe &lt;7gm /dl"/>
        <dataElement code="ANC8149" uid="D702xSW9bHo" name="ANC new registrations screened for malnutrition_MUAC"/>
        <dataElement code="ANC8150" uid="MTe1TWLuUAv" name="ANC new registrations screened who were malnourished_MUAC &lt; 21 cm"/>
        <dataElement code="ANC8151" uid="Y4xlw0XUzhR" name="ANC new registrations tested for anaemia"/>        
		<dataElement code="ANC8145" uid="viftAbwOnMH" name="ANC new registrations who received full course of Iron and Folic Acid supplements _90 tablets"/>
        <dataElement code="ANC8615" uid="IJClrFpibZP" name="ANC new registrations with anaemia Moderate 7 to 9.9 gm/dl"/>
        <dataElement code="ANC8138" uid="MRXI1XoFG1G" name="ANC standard visit during 9th month"/>
        <dataElement code="ANC8156" uid="FqDAfzXHRJo" name="ANC syphilis tested "/>
        <dataElement code="ANC8157" uid="A5HjXlj1bhf" name="ANC syphilis tested positive "/>
        <dataElement code="ANC8143" uid="THmwuhMFSm5" name="ANC TT 1given"/>
        <dataElement code="ANC8144" uid="Ea8PwlCJhtl" name="ANC TT 2 to 5 given"/>
        <dataElement code="ANC9078" uid="ytgZGZscGM3" name="ANC TT new registrations fully vaccinated"/>
        <dataElement code="ANC1" uid="nvVDDkfbbhf" name="ANC1"/>
        <dataElement code="ANC4" uid="OWeOBFxrvrv" name="ANC4"/>
        <dataElement code="ANC8141" uid="IuaAd6Quvp1" name="ANC pregnancy under 15 years"/>
        <dataElement code="PNC8208" uid="KGTnFcKWiMp" name="Low birth weight infants discharged from Kangaroo Mother care followed up at HC_baby"/>
        <dataElement code="PNC8205" uid="dEX7M3L2XT4" name="PNC complication referred_mother or infant"/>
        <dataElement code="PNC8206" uid="pGIpti2thOZ" name="PNC complication referred_mother or infant_Baby"/>
        <dataElement code="PNC8207" uid="J6AtcHTRPQt" name="PNC complication referred_mother or infant_Mother"/>
        <dataElement code="PNC8204" uid="x6yegTNkNjF" name="PNC mothers malnourished_MUAC &lt; 21 cm"/>
        <dataElement code="PNC8202" uid="PFJOGl2YIwj" name="PNC mothers recieved vitamin A "/>
        <dataElement code="PNC8203" uid="hBqhJXgWIZE" name="PNC new registration mothers MUAC screened for malnutrition "/>
        <dataElement code="PNC9112" uid="ZvM3oVLLjZf" name="PNC new registrations_Baby"/>
        <dataElement code="PNC9111" uid="A646Ehb1mVm" name="PNC new registrations_Mother"/>
        <dataElement code="PNC9098" uid="UvJbYove50G" name="PNC standard visit 1 within 3 days of birth_Baby"/>
        <dataElement code="PNC9106" uid="ppl1tmbPKwx" name="PNC standard visit 1 within 3 days of birth_Mother"/>
        <dataElement code="PNC9105" uid="hpIXHGIvszO" name="PNC standard visit 2 between 4-9 days of birth_Baby"/>
        <dataElement code="PNC9102" uid="Cbpa87fOtlB" name="PNC standard visit 2 between 4-9 days of birth_Mother"/>
        <dataElement code="PNC9097" uid="kXC0ONrnfjC" name="PNC standard visit 3 between 10 days and 6 weeks of birth_Baby"/>
        <dataElement code="PNC9113" uid="o562S1JTRoD" name="PNC standard visit 3 between 10 days and 6 weeks of birth_Mother"/>
        <dataElement code="PNC8201" uid="VQtPPcfowOz" name="PNC standard visits between 4-10 days of birth "/>
        <dataElement code="PNC8200" uid="LSYlyBiCCon" name="PNC standard visits within 3 days of birth"/>
        <dataElement code="POP" uid="xX6RDH6AZTK" name="Population"/>
    </dataElements>
    <disaggregations>
        <disaggregation code="YtbnZipIBx3" uid="YtbnZipIBx3" name="(default)"/>
        <disaggregation code="HgRodT2oZlq" uid="HgRodT2oZlq" name="(Male)"/>
        <disaggregation code="PfaFHAfpd2X" uid="PfaFHAfpd2X" name="(Female)"/>
        <disaggregation code="BNTdWBe0N1F" uid="BNTdWBe0N1F" name="(default)"/>
    </disaggregations>
    <reportTemplate>
        <name>ANC and PNC consultations</name>
        <uid>ygTEbJWQhqf</uid>
        <code>ANC_PNC</code>
        <periodType>Monthly</periodType>
        <dataValueTemplates>
            <dataValueTemplate dataElement="ANC8143" disaggregation="BNTdWBe0N1F">
                <annotation>select count(distinct person_id) from obs where voided = 0 and value_coded = 54 and
                    obs_datetime &gt;= :startOfPeriod and obs_datetime &lt;= :endOfPeriod and location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8156" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o INNER JOIN encounter e ON o.encounter_id =
                    e.encounter_id AND o.concept_id = 6981 AND e.encounter_type in (46,53) AND o.value_datetime &gt;=
                    :startOfPeriod AND o.value_datetime &lt;=:endOfPeriod and o.location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8152" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o INNER JOIN encounter e ON o.encounter_id =
                    e.encounter_id WHERE o.concept_id = 8618 AND e.encounter_type in (46,53) AND o.obs_datetime &gt;=
                    :startOfPeriod AND o.obs_datetime &lt;=:endOfPeriod and o.location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8157" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o INNER JOIN encounter e ON o.encounter_id =
                    e.encounter_id AND o.concept_id = 1478 AND o.value_coded = 703 AND e.encounter_type in (46,53) AND
                    o.value_datetime &gt;= :startOfPeriod AND o.value_datetime &lt;=:endOfPeriod and o.location_id
                    =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8149" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o INNER JOIN encounter e ON o.encounter_id =
                    e.encounter_id WHERE o.concept_id = 1290 AND e.encounter_type IN (43, 50) AND o.obs_datetime &gt;=
                    :startOfPeriod AND o.obs_datetime &lt;=:endOfPeriod and o.location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8144" disaggregation="BNTdWBe0N1F">
                <annotation>select count(distinct person_id) from obs where value_coded in(11041,11042,11043,11044) and
                    obs_datetime &gt;= :startOfPeriod and obs_datetime &lt;= :endOfPeriod and location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8146" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o INNER JOIN encounter e ON o.encounter_id =
                    e.encounter_id WHERE o.concept_id = 8405 AND o.value_coded = 1065 AND e.encounter_type in (41, 48)
                    AND o.obs_datetime &gt;= :startOfPeriod AND o.obs_datetime &lt;=:endOfPeriod and o.location_id
                    =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8151" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o INNER JOIN encounter e ON o.encounter_id =
                    e.encounter_id WHERE o.concept_id = 1290 AND e.encounter_type in (46,53) AND o.obs_datetime &gt;=
                    :startOfPeriod AND o.obs_datetime &lt;=:endOfPeriod and o.location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8150" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o INNER JOIN encounter e ON o.encounter_id =
                    e.encounter_id WHERE o.concept_id = 10972 AND e.encounter_type IN (43, 50) AND o.obs_datetime &gt;=
                    :startOfPeriod AND o.obs_datetime &lt;=:endOfPeriod and o.location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8136" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct e.patient_id) FROM encounter e where e.encounter_type IN (42, 49) and
                    e.encounter_datetime &gt;= :startOfPeriod AND e.encounter_datetime &lt;=:endOfPeriod and
                    e.location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8138" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o INNER JOIN encounter e on o.encounter_id =
                    e.encounter_id AND concept_id IN (8149, 8521, 8522) AND e.encounter_type = 43 and o.obs_datetime
                    &gt;= :startOfPeriod AND o.obs_datetime &lt;=:endOfPeriod and o.location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8615" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o INNER JOIN encounter e ON o.encounter_id =
                    e.encounter_id WHERE o.concept_id = 1290 AND e.encounter_type in (46,53) AND o.obs_datetime &gt;=
                    :startOfPeriod AND o.obs_datetime &lt;=:endOfPeriod and o.location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8154" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o INNER JOIN encounter e ON o.encounter_id =
                    e.encounter_id WHERE concept_id = 2169 AND value_coded = 703 AND e.encounter_type in (46,53) AND
                    o.obs_datetime &gt;= :startOfPeriod AND o.obs_datetime &lt;=:endOfPeriod and o.location_id
                    =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8141" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct e.patient_id) FROM encounter e INNER JOIN person p ON e.patient_id =
                    p.person_id WHERE DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), p.birthdate)), '%Y')+0 &lt; 15 AND
                    e.encounter_type IN (42, 49) AND e.encounter_datetime &gt;= :startOfPeriod AND e.encounter_datetime
                    &lt;=:endOfPeriod and e.location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8409" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o INNER JOIN encounter e ON o.encounter_id =
                    e.encounter_id AND o.concept_id = 6549 AND e.encounter_type in (46,53) AND o.value_datetime &gt;=
                    :startOfPeriod AND o.value_datetime &lt;=:endOfPeriod and o.location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8153" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o INNER JOIN encounter e ON o.encounter_id =
                    e.encounter_id WHERE concept_id = 1837 AND e.encounter_type in (46,53) AND o.value_datetime &gt;=
                    :startOfPeriod AND o.value_datetime &lt;=:endOfPeriod and o.location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8137" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o WHERE o.concept_id = 1279 and o.value_numeric
                    &lt;= 13 and o.obs_datetime &gt;= :startOfPeriod AND o.obs_datetime &lt;=:endOfPeriod and
                    o.location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC8142" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o where concept_id = 1739 and o.person_id IN
                    (SELECT person_id FROM obs WHERE concept_id = 8156) and o.obs_datetime &gt;= :startOfPeriod AND
                    o.obs_datetime &lt;=:endOfPeriod and o.location_id =:locationId
                </annotation>
            </dataValueTemplate>
            <dataValueTemplate dataElement="ANC9078" disaggregation="BNTdWBe0N1F">
                <annotation>SELECT count(distinct o.person_id) FROM obs o INNER JOIN encounter e ON o.encounter_id =
                    e.encounter_id WHERE o.concept_id = 8538 AND o.value_coded = 1065 AND e.encounter_type IN (41, 48)
                    AND o.obs_datetime &gt;= :startOfPeriod AND o.obs_datetime &lt;=:endOfPeriod and o.location_id
                    =:locationId
                </annotation>
            </dataValueTemplate>
        </dataValueTemplates>
    </reportTemplate>
</reportTemplates>

The report templates part is divided into three sections

    1. Data elements
    2. Disaggregations
    3. Report template

1.1.1 Data elements

List all the needed data elements, like “history of diagnosis of hypertension.” There may be several data
elements inside the Data Elements section.

1.1.2 Disaggregations

List all the needed category option combos or category combos, like “male_uncategorized_member”;
there may be multiple disaggregation tags inside the disaggregations.

1.1.3 Report template

This section may have multiple entries depending on the number of different types of reports (data sets)
that need to be generated.

    • name 
    • uid 
    • code 
    • periodType
    • dataValueTemplates 

      • dataValueTemplate 

      • annotation

1.2 Skills/knowledge required

    •  Familiarity with OpenMRS concept dictionary
    • Some knowledge of MySQL databases
    • MySQL database querying skills
    • Compiling OpenMRS module code
    • Software installation and configuration

1.3 Other requirements

    •  DHIS 2 implementation guide (For new DHIS 2 instance implementation)
    • OpenMRS step-by-step implementation guide for implementers (For new OpenMRS instance implementation)
    • OpenMRS demo data for testing or demonstration purposes (optional)
    • Internet connectivity, to access instructions for deploying the applications 
    • SQL editor that is compatible with the OpenMRS database platform, such as MySQL Workbench, phpMyAdmin, etc.

1.4 DHIS 2 (Initial Setup)

Deploy DHIS 2 using the instructions in the DHIS 2 implementation guide. This guide is available in
DHIS 2 website. Select server set-up option during DHIS 2 installation if you plan to use
the DHIS 2 instance over time. This option ensures that the configurations made are maintained in the
database.

2. Installing the DHIS 2 reporting module

  1.  Make sure the following are in place: Login to OpenMRS and open the Administration page by clicking on Administration tab.Select Manage Modules link.
    1. A running instance of OpenMRS
    2. DHIS 2 reporting module file (dhisreport-1.1-SNAPSHOT.omod)
    3. Access to OpenMRS administration privileges
  2. On Manage Modules page, Click Add or Upgrade Module button.
  3. A dialog box for adding or upgrading module will open.Upload DHIS 2 reporting module's omod
  4.  Once DHIS 2 Reporting Module is uploaded, it will appear on the Manage Modules page.
  5. When you go back to the Administration page, you will be able to see the DHIS 2 Reporting Module link.

If you install the updated version of DHIS2 Reporting Module(dhisreport-2.0.omod) then only one link would appear under "DHIS2 Reporting Module" Heading, which is "DHIS Reporting Home".

The Administration page should look as follows:

 

3. DHIS 2 Reporting Module features

This module has four main features.

  1. Import/Export report definitions
  2. Configure DHIS 2 connections
  3. Reports
  4. Report Mapping
  5. Synchronize reports

To view these features click the Manage module link under the DHIS 2 Reporting Module on the administration page.

This will open DHIS 2 reporting module page.

Each feature has a link associated with its function.

  • Import/Export report definitions - to upload the XML file(Report Template) to create the report definition.
  • Configure DHIS2 connection - to configure connection between OpenMRS and DHIS 2 server.
  • Reports link - to access available reports that can be sent to DHIS 2.
  • Synchronize Reports – to update reporting template with DHIS 2 instance

NOTE: The module will only display reports whose definitions have been uploaded in the XML file using Import/Export report definitions link.

3.1 Importing the Report Definitions

    1. Go to OpenMRS administration page and click on Manage Module under DHIS2 Reporting Module.
    2. Click on the Import/Export report definitions link to open Upload Report Definitions page.
    3. Upload the report definition XML file(the sample report Template provided in this document can be used for testing).

3.2 Configuring the DHIS 2 Connection

    1. Go to Manage Module link under DHIS2 Reporting Module
    2. Click the Configure DHIS2 connection link. 
    3. Set the connection to the DHIS 2 server:
    4. Enter the DHIS 2 URL.
    5. Enter DHIS 2 username and password.
    6. Click Save button.

3.3.1 Preview report generated

    1.  Go to Manage Module link under DHIS2 Reporting Module. 
    2. Click the Reports link.
    3. Click to select one of the report definitions link. If you are using the sample report template then it would be ANC and PNC consultations.

    4. Fill the parameters of the report to be generated:The details and status of the report will be displayed as shown below. 

      1.  Enter the report period. (Mostly a monthly or a weekly period)

      2. The default action is Preview.
      3. Click Generate button to view the report.

NOTE: Because preview option was selected, the data will not be posted to DHIS 2 server but will be displayed in OpenMRS for verification. Mock data was used when developing this guide. Even if some of the names used are real, the data or reports displayed are based on mock data.


 

3.3.2 Post report to DHIS

    1. Click to select one of the report definition links.
    2. Fill the parameters to generate and post the report to DHIS 2.
      1. Select a location to generate and post report from.

      2. Enter the report date.

      3. Change the default action from Preview to Post to DHIS.  Note: If Post to DHIS option is not available, it means that the connection link to DHIS 2 is not set.

      4. Click Generate button to view the report. 

      5. The details and status of the report will be displayed as shown below if you successfully imported the XML file.

3.3.2.1 Posting same report more than once

If the same report is generated and posted again, data value count will show “imports = 0” and “updates=8” to ensure that no double entry/posting happened. Note: If data was updated after posting the report for the month, the report can be posted again. In this case there will be a non-zero number on data value count for imports and updates.

If you post a report to DHIS 2 and receive the report result with no data elements values,  check the report sent to confirm that queries are saved.

3.3.3 To check the report:

    1. Click Manage Reports link to access the reports, and then select the report that was sent and had no data values.
    2. If the page opened does not have SQL statements as shown in the image below, it means that the queries were not saved.

    3. Click on Edit link for each data element to add SQL statement, and then run the report again. A report definition with queries is shown.

3.3.4 To Edit a Report Code through GUI:

 

    1.  Go to the DHIS2 Reporting Module. [DHIS2 Reporting Module>Manage module]
    2. Click the Reports link.  (Alternatively - DHIS Reporting Home under DHIS reporting Module in the Administration page)
    3. Click on the report you would like to edit the code of.
    4. Once the report is opened click on the edit icon(paper and pencil) beside the report code. This will convert the report code portion into a text box, edit the code and click on save beside the text box.

3.4 Report Mapping

Objective of report mapping is to map DHIS2 Report Data Elements with Report Data Indicators of Reporting module.

3.4.1 Report Mapping Steps

    1. Go to Manage Reports section

    2. Select Map Report

    3. Click on the edit icon under the Action column

    4. Select a period-Indicator report from the list

    5. Click on Save

    6. Details will appear in a table, with report data indicators on the right hand side and indicators will be added to the selection list

    7. Select a suitable indicator from the list

    8. Click on the immediate map link next to it, which concludes the mapping process.

    9. Thus it is possible to post or preview the mapped report.

    10. If it is required to revert back to the first query, select Default from the list and click on the Map link

3.4.2 Editing Mapped SQL Queries

    1. Go to Manage report section

    2. Click on the report name

    3. It will be redirected to the query editing section

    4. If the mapped indicator is an SQL Cohort indicator, it is possible to change the query from this interface

    5. If it is another indicator, it will show that the indicator is mapped and it does not allow to edit

    6. If the edit option is available, click on edit

    7. Change the SQL query

    8. Click on Save link

3.4.3 Prioritizing Report Rendering

    1. Go to Manage Report section

    2. Click on Post/Preview section

    3. Select Frequency as “Monthly”

    4. Select a month from the date picker

    5. In the priority section, out of the two choices SQL or Reporting, select SQL

    6. Click on the Generate button

    7. Report will be generated giving priority to the edited SQL queries

    8. To generate giving priority to report module mappings, follow all of the above steps from (a) to (d) of (3.4.3.) section and select Reporting instead of SQL

    9. Report will be generated giving priority to mapped report indicators

3.4.4 View History and Details of the Mapped Report

    1. Generate any report required

    2. Go to the view Report link

    3. It will be redirected to the report details page of the reporting module

    4. Select Report History link to get the history of the generated reports


 

3.4.5 Deleting an SQL query

    1. Follow all the steps given in (3.4.2) section except step (g), where it is required to delete the whole query instead of changing, and proceed.

    2. Go back to Manage report section

    3. Links regarding the report will be indicated in red

    4. Go to Post/Preview section

    5. It will display the unmapped report and it will not allow to generate the report

    6. Go back to Manage report section

    7. Select Map report link

    8. Unmapped report will be indicated in red

    9. The particular unmapped report should be mapped before generating the report again

 

 

4. Location Attribute configuration

This is the major difference between the original Dhisreport module and this SHR version of the Dhisreport module. In the original version the location for which the report is to be generated is to be specified. In this version for all the locations in the SHR having the location CODE setup(ORG UNIT ID in terms of DHIS terminology). How to setup the location CODE is specified below.

This module searches all the locations having an attribute "CODE" and for the report to be run against a specific Location the attribute CODE must be set to the ORG UNIT of the DHIS server to which this data is being posted. For this setup there are two parts:

4.1. Setting up the Location Attribute "CODE"

    1. Go to Administration tab.
    2. Select Manage Location Attribute Types under Locations heading.

    3. Click on add location attribute type and give the attribute name as CODE as shown in the image and select the datatype as Free Text and save the Location attribute type.

4.2. Adding the CODE value to the Location

    1. Go to Administration tab.
    2. Select Manage Locations under Locations heading. It opens up the list of locations added in this server. Click on the location you want the report to run against if it is present in the list. If not please create the location by clicking on Add location link. Even if you are creating a new location or editing a previously existing location there will be a textbox beside "CODE" text where you can enter the ORG UNIT ID value.

That's it. For each report run through the interface of this module, they will run against each Location having the CODE attribute value setup.

5. Web Services:

This module provides a set of web services that allow the data to be consumed/accessed directly through cURL commands or even through web application.

The results are returned with a namespace not recognized by browsers leading to not showing up in Chrome and Firefox - you can view them by seeing the page source. The results are displayed in Internet Explorer without any issues. Results can be viewed directly through cURL requests as well.

List of web services web services:

NOTE: {openmrs server} refers to the server location i.e in case of a local setup the the sever url will be http://localhost:8080/openmrs.

5.1 Available reports to run:  {openmrs sever}/ws/dhisreport/getReports

This service returns the list of reports that are available/loaded in the OpenMRS system. These are the reports that you can run on this server.

5.2 Locations having CODE's: {openmrs sever}/ws/dhisreport/getLocations

This service returns the list of locations that have the "CODE" attribute vaue set in the OpenMRS system. These are the locations against which the list of available reports can run.

5.3 Report Results for a Location: {openmrs sever}/ws/dhisreport/runReport/{report code}/{location code}/{time period}

This returns the same xml that is sent to the dhis server through the GUI but only for a single Location. The parameters for this web services are Report Code,Organization Unit ID/CODE, time period. The {report code}, {location code}, {time period} have to be replaced with their corresponding values. If you are not aware of report code and location code, you can always query them using the previous two services and use them here. The only time period type allowed in this webservice is a monthly time period which must be represented in "yyyymm" format i.e. "201409" would refer to September,2014. 

 

NOTE: If you are running these webservices in a browser then you have to be logged into the system first. If you would like to access this in a cURL command then the command would need the username and password.

A sample cURL command would be as this : curl -i -u admin:Admin123  http://localhost:8080/openmrs/ws/dhisreport/getReports.

How to access the module:

The module is available in the OpenMRS module Repository here.

 The module code is available here.

Release Notes:

DHIS Report 2.0:

  • Generates basic ADX messages
  • Uses Reporting Module to generate aggregate values
  • Posts ADX messages to DHIS2 server through UI
  • Able to persist DHIS2 server details
  • minor UI modifications

Want to participate?

Weekly Scrum Meetings - Friday 2 PM EST - https://www.uberconference.com/srimauryakummamuru - 716-293-5737 - pin (08028)