DHIS2 User Manual

DHIS2 Documentation Team

2.8-SNAPSHOT

Warranty:  THIS DOCUMENT IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS MANUAL AND PRODUCTS MENTIONED HEREIN, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

License:  Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the source of this documentation, and is available here online: http://www.gnu.org/licenses/fdl.html.

Revision History
Revision 525
Version 2.8-SNAPSHOT 2012-05-17 12:32:05

Table of Contents

About this guide
1. What is DHIS 2?
1.1. Background of The District Health Information Software – Version 2
1.2. Purpose of DHIS2
1.3. Difference between Aggregated and Patient data in a HMIS
1.4. Use of DHIS2 in HMIS: data collection, processing, interpretation, and analysis.
1.5. Overview of DHIS2
1.5.1. Overview of DHIS2 modules
1.5.2. Web-based versus standalone HMIS and their suitability
1.5.3. Free and Open Source Software (FOSS): benefits and challenges
1.5.4. Understanding platform independence
1.5.5. Auxiliary software that can be used with DHIS2
2. Getting started with DHIS 2
2.1. Getting started with DHIS 2
2.1.1. Prerequisites
2.1.2. Starting the DHIS 2 Live package
2.1.3. Working directly with the H2 database
2.1.4. Downloading and installing the server version
2.2. Logging on to DHIS 2
2.3. Creating new users and roles
2.3.1. Open User Menu
2.3.2. Define a new role
2.3.3. Add New User
2.4. Logging out of DHIS 2
2.5. Quick intro to designing a DHIS 2 database
2.5.1. The organisational hierarchy
2.5.2. Data Elements
2.5.3. Datasets and data entry forms
2.5.4. Validation rules
2.5.5. Indicators
2.5.6. Report tables and reports
2.5.7. GIS
2.5.8. Charts and dashboard
3. Organisation units
3.1. The organisational hierarchy
3.2. Organisation unit maintenance
3.2.1. Organisation units
3.2.2. Organisation unit group sets
3.2.3. Organisation unit groups
3.2.4. Organisation unit level
3.2.5. Hierarchy operations
4. Data elements
4.1. Data element maintenance
4.1.1. Data elements
4.1.2. Data element groups
4.1.3. Data element group editor
4.1.4. Data element group sets
4.1.5. Data element categories
4.1.6. Data element category combinations
4.1.7. Data dictionaries
4.1.8. Translations
5. Datasets and data entry forms
5.1. Datasets
5.1.1. Dataset management
5.2. Data Entry Forms
5.2.1. Section forms
5.2.2. Adding a new section form
5.2.3. Custom Forms
5.2.4. Data set assignment editor
6. User management
6.1. Creating new users and roles
6.1.1. User maintenance
6.1.2. User role management
6.1.3. User management
6.1.4. User group management
6.1.5. User by organisation unit
7. Dashboards
7.1. Setting up the dashboard
7.2. Messages and feedback
8. Data entry
8.1. Learning Objectives
8.2. Data entry with DHIS 2
8.2.1. Selecting the data entry form
8.2.2. Entering data
8.2.3. Validating data in the form
8.2.4. Offline data entry
9. Using Data Quality functionality
9.1. Overview of data quality checks
9.2. Data quality checks
9.3. Running Validation Rule Analysis
9.4. Std Dev Outlier Analysis
9.5. Min-Max Outlier Analysis
9.6. Gap Analysis
9.7. Follow-Up Analysis
10. Setting up Data Quality functionality
10.1. Learning Objectives
10.2. Overview of data quality check
10.3. Data quality checks
10.4. Data quality check at the point of data entry
10.4.1. Setting the minimum and maximum value range manually
10.4.2. Generated min-max values
10.5. Validation Rule
10.6. Validation Rule Group
11. Indicators
11.1. Indicator maintenance
11.1.1. Indicators
11.1.2. Indicator types
11.1.3. Indicator groups
11.1.4. Indicator group editor
11.1.5. Indicator group sets
12. Using reporting functionality
12.1. Reporting functionality in DHIS 2
12.2. Using standard reports
12.3. Using report tables
12.4. Using dataset reports
12.5. Using resources
12.6. Using data visualizer
12.7. Using the dashboard
12.8. Using reporting rate summary
12.9. Using organisation unit distribution reports
12.10. Using web pivot table
12.11. Using data mart management
13. Setting up report functionality
13.1. Data sources for reporting
13.1.1. Types of data and aggregation
13.1.2. Data mart
13.1.3. Resource tables
13.1.4. Report tables
13.2. How to create report tables
13.2.1. General options
13.2.2. Selecting data
13.2.3. Selecting report parameters
13.2.4. Data element dimension tables
13.2.5. Report table - best practices
13.3. Report table outcome
13.4. Standard reports
13.4.1. What is a standard report?
13.4.2. Designing Standard reports in iReport
14. Using Data Visualizer
14.1. Data Visualizer overview
14.2. Selecting chart type
14.3. Selecting series, category and filter
14.4. Selecting indicators and data elements
14.5. Selecting reporting rates
14.6. Selecting periods
14.7. Selecting organisation units
14.8. Selecting chart options
14.9. Displaying a chart
14.10. Displaying a data table
14.11. Downloading chart as image or PDF
14.12. Saving chart as favorite
14.13. Exiting the data visualizer module
15. Using GIS
15.1. GIS module overview
15.2. Thematic mapping
15.2.1. Thematic layer 1 and 2
15.2.2. Facility layer
15.2.3. Symbol layer
15.3. Tools
15.3.1. Register favorite map views
15.3.2. Register legend sets
15.3.3. Exporting/saving map images
15.3.4. Measure distance
16. Setting up GIS
16.1. Context
16.2. Importing coordinates
16.3. Administering the GIS module
16.3.1. Register overlays
17. Import and export
17.1. What is import and export?
17.2. Exporting data
17.2.1. Exporting from DHIS 2
17.2.2. Exporting data to other DHIS 2 systems
17.2.3. Exporting metadata to other DHIS 2 systems
17.2.4. DHIS 1.4 Metadata export
17.2.5. DHIS 1.4 Detailed Metadata Export
17.2.6. PDF Metadata Export
17.3. Importing data
17.3.1. Importing data from another DHIS 2 instance
17.3.2. Importing data from DHIS 1.4
17.4. Importing CSV data
17.5. Importing XML data
18. Data Administration
18.1. Data browser
18.2. Data integrity
18.2.1. Data elements without data set
18.2.2. Data elements without groups
18.2.3. Data elements violating exclusive group sets
18.2.4. Data elements assigned to data sets with different period types
18.2.5. Data sets not assigned to organisation units
18.2.6. Indicators with identical formulas
18.2.7. Indicators without groups
18.2.8. Invalid indicator numerators
18.2.9. Invalid indicator denominators
18.2.10. Indicators violating exclusive group sets
18.2.11. Organisation units with cyclic references
18.2.12. Orphaned organisation units
18.2.13. Organisation units without groups
18.2.14. Organisation units violating compulsory group sets
18.2.15. Organisation units violating exclusive group sets
18.2.16. Organisation unit groups without group sets
18.2.17. Validation rules without groups
18.2.18. Invalid validation rule left side expressions
18.2.19. Invalid validation rule right side expressions
18.3. Data Archive
18.4. Beneficiary Data Archive
18.5. Maintenance
18.6. Resource tables
18.7. SQL View
18.7.1. Creating a new SQL view
18.7.2. SQL View management
18.8. Organisation unit merge
18.9. Duplicate data elimination
18.10. Data statistics
18.11. Lock exceptions
18.12. Zero value storage
18.13. Organisation unit pruning
18.14. Min-Max Value Generation
18.15. Constant
18.16. Option sets
18.17. Cache Statistics
18.18. Dynamic attributes
18.19. Scheduling
19. Settings
19.1. User settings
19.1.1. User general settings
19.1.2. User message settings
19.2. System settings
19.2.1. System general settings
19.2.2. System appearance settings
19.2.3. System email settings
20. DHIS Mobile
20.1. Introduction
20.2. Mobile browser based data entry
20.2.1. Getting started with mobile browser data entry
20.3. J2ME GPRS/3G Client
20.3.1. Data connection availability
20.3.2. J2ME GPRS 3G facility reporting client
20.3.3. J2ME GPRS 3G program reporting client
20.3.4. Detailed configuration of data sets and reporting forms
20.3.5. Mobile application setup
20.4. Legacy J2ME client with SMS transport
20.4.1. Build DHIS2 with the dhis-web-mobile module
20.4.2. Install the GSM modem
20.4.3. Register users
20.4.4. Install the mobile application on a phone
20.4.5. Using the system
21. Data dimensions in DHIS2
21.1. The core building blocks describing the data
21.2. The data element dimension
21.2.1. Data element categories
21.2.2. Data element group sets
21.3. The organisation unit dimension
21.3.1. Organisation unit group sets and groups
21.3.2. Best practice on the use of group sets and groups
21.4. The time (period) dimension
21.4.1. Period Types
21.4.2. Relative periods
21.4.3. Aggregation of periods
21.5. Data collection vs. data analysis
21.5.1. Data collection and storage
21.5.2. Input != Output
21.6. Some more examples
21.7. How this works in pivot tables
21.8. From paper for to multidimensional datasets - lessons learned
21.8.1. From tables to category combinations - designing multidimensional data sets
22. Web API
22.1. Introduction
22.2. Authentication
22.3. Date and period format
22.4. Example: Sending data values
22.5. Example: Sending large bulks of data values
22.6. Example: Reading data values
22.7. Example: Writing and reading messages
22.8. Example: Embedding reports in web pages
22.9. Example: Embedding charts with the Visualizer Plugin
A. DHIS 2 Documentation Guide
A.1. DHIS 2 Documentation System Overview
A.2. Introduction
A.3. Getting started with Launchpad
A.4. Getting the document source
A.5. Editing the documentation
A.6. Using images
A.7. Linking documents together
A.8. Handling multilingual documentation
A.9. Building the documentation
A.9.1. Building the documentation with Apache maven
A.9.2. Building with xmlto
A.10. Committing your changes back to Launchpad
B. MyDatamart User Manual
B.1. Overview
B.2. Installation
B.3. The Mydatamart application
B.3.1. Maintaining the local datamart
B.3.2. Working with Excel
B.3.3. Troubleshooting
B.3.4. History and Background
C. R and DHIS 2 Integration
C.1. Introduction
C.2. Using ODBC to retrieve data from DHIS2 into R
C.3. Using R with MyDatamart
C.4. Mapping with R and Postgresql
C.5. Using R, DHIS2 and the Google Visualization API
D. DHIS 2 Workbook
D.1. Introduction
D.2. Data Visualizer
E. DHIS Technical Architecture Guide
E.1. Overview
E.2. Technical Requirements
E.3. Project Structure
E.4. The Data Model
E.5. The Persistence Layer
E.6. The Business Layer
E.6.1. The JDBC Service Project
E.6.2. The Import-Export Project
E.6.3. The Data Mart Project
E.6.4. The Reporting Project
E.6.5. The System Support Project
E.7. The Presentation Layer
E.7.1. The Portal
E.8. Framework Stack
E.8.1. Application Frameworks
E.8.2. Development Frameworks
DHIS2 Glossary
Bibliography
Index

List of Figures

1.1. The health information cycle
B.1. Mydatamart desktop icon
B.2. Mydatamart on first open
B.3. Creating a new datamart
B.4. Logging in to dhis2 server
B.5. Setting analysis parameters
B.6. Downloading data
B.7. Selecting views
B.8. Datamart connections
B.9. Pivot report wizard
B.10. Data flows using DHIS2
B.11. Using a local datamart
E.1. Data value structure

List of Tables

17.1. CSV format of DHIS 2
20.1.
21.1.
21.2. Example of detailed storage of data values when using data element categories "Place of Service" and "Age" (simplified for readability compared to the actual database table)
21.3.
21.4.
21.5.
22.1. Period format
22.2. Import parameters
22.3. Data value set query parameters
22.4. Visualizer plugin configuration

About this guide

The DHIS2 documentation is a collective effort and has been developed by the development team and users. While the guide strives to be complete, there may be certain functionalities which have been omitted or which have yet to be documented. This section explains some of the conventions which are used throughout the document.

DHIS2 is a browser-based application. In many cases, screeenshots have been included for enhanced clarity. Shortcuts to various functionalities are displayed such as "Maintenance->Data administration". The "->" character indicates that you should choose "Maintenance" and then click on "Data administration" in the menu which appears through the browser.

Different styles of text have been used to highlight important parts of the text or particular types of text, such as source code. Each of the conventions used in the document are explained below.

[Note]Note

A note contains additional information which should be considered or a reference to more information which may be helpful.

[Tip]Tip

A tip can be a useful piece of advice, such as how to perform a particular task more efficiently.

[Important]Important

Important information should not be ignored, and usually indicates something which is required by the application.

[Caution]Caution

Information contained in these sections should be carefully considered, and if not heeded, could result in unexpected results in analysis, performance, or functionality.

[Warning]Warning

Information contained in these sections, if not heeded, could result in permanent data loss or affect the overall usability of the system.

Program listings usually contain some type of computer code.
They will be displayed with a shaded background and a different font. 

Commands will be displayed in bold text, and represent a command which would need to be executed on the operating system or database.

Links to external web sites or cross references will be displayed in blue text, and underlined like this..

Bibliographic references will displayed in square brackets like this [Store2007]. A full reference can be found in the bibliography contained at the end of this document.

Chapter 1. What is DHIS 2?

1.1. Background of The District Health Information Software – Version 2

After reading this chapter you will be able to understand:

  • What is DHIS2 and what purpose it serves with respect to health management information systems (HMIS)?

  • What is the difference between patient based and aggregate data?

  • What are the different modules in DHIS 2?

  • What is Free and Open Source Software (FOSS), platform (in)dependency, and its implications for HMIS?

  • What is FOSS, platform (in)dependency, and their implications for HMIS?

Computer based HMIS allows for a transition from a data (and paper) based HMIS to and action led HMIS. Particular strengths of a computer based HMIS enumerated below:

  • Promotes streamlining and standardisation of data records.

  • Allows creation of an integrated warehouse, which supports combining data from different sources and conducting cross analysis.

  • Facilitates Rationalisation of reporting flows

  • Supports customised reporting.

  • Makes possible various kinds of indicator based analysis

  • Allows integration of various software applications such as GIS and Excel.

  • Provides functionality to conduct data quality validation.

  • Allows immediate on-line transmission of data / reports as and when required by the user

The District Health Information Software – Version 2 (DHIS 2) is Free and Open Source Software (FOSS) HMIS designed and developed under a global research and development initiative (called Health Information Systems Project – HISP) originating from the Department of Informatics, University of Oslo, Norway. The first version of DHIS application (DHIS 1.3/1.4) was developed and subsequently upgraded on an ongoing base continuously upgraded in South Africa by HISP South Africa since 1997. This version was developed on Microsoft Office platform, and distributed freely. This application is currently the national standard in South Africa and being used in all the health facilities in the country. DHIS1.4 is being used in many countries in Africa such as Ethiopia, Nigeria, Botswana, Tanzania, Zambia, and various other countries.

In 2005, based on the various comments and feedback from the field level use, the University of Oslo initiated the process of developing the second version of DHIS. DHIS 1.4 was used primarily as the basis for the functional requirements. Using a modular structure DHIS2, was developed based on data warehousing principles. DHIS2 is built on free and open source (FOSS) Java based frameworks. It is platform independent, can run on both on-line and offline modes, is multi-language enabled and integrated with various other applications such as Geographic Information Systems and Microsoft Excel.

The documentation provided in herewith, will attempt to provide a comprehensive overview of the application. Given the abstract nature of the application, this manual will not serve as a complete step-by-step guide of how to use the application in each and every circumstance, but rather will seek to provide illustrations and examples of how DHIS2 can be implemented in a variety of situations through generalized examples.

1.2. Purpose of DHIS2

The purpose of DHIS2 can be summarised as follows:

  1. Provide a comprehensive HMIS solution based on data warehousing principles and a modular structure which can easily be customised to the needs of different health systems - nations, states, districts, and facilities.

  2. Provide data entry facilities which can either be in the form of standard (scroll down) lists (of data elements), or can be customised to replicate paper forms – to make easy the process of data entry.

  3. Provide different kinds of tools for data validation and improvement of data quality.

  4. Provide different tools for reporting – both for automated routine reports and analysis reports, and in addition provide the user with functionality and flexibility to make their user defined reports.

  5. A dashboard for monitoring and evaluation of health programs that can allow for the generation and analysis of different indicators, and also carry out data quality analysis.

  6. Systems management functions to carry out various operations to manage hierarchy of organisation units, addition/deletion/modification of data elements etc.

  7. Functionality to design and modify indicators.

  8. Functionalities of export-import, so that data entered on an offline version can be exported to the district or higher level systems. Export import can also be made in relation to other applications such as Excel and Epi Info.

  9. Integration with other software systems – such as RIMS.

  10. Provision of Geographic Information Systems (GIS).

  11. User management module for passwords, security, and access control.

  12. Further modules can be developed (such as for human resources management) and integrated as per user needs.

In summary, DHIS2 provides a comprehensive HMIS solution for the reporting and analysis needs of health facilities at any level. It is a tried and tested application in various countries, and also adopted by WHO for their HMN implementations in various countries.

1.3. Difference between Aggregated and Patient data in a HMIS

Patient data is data relating to a single patient, such as his/her diagnosis, name, age, earlier medical history etc. This data is typically based on a single patient-health care worker interaction. For instance, when a patient visits a health care clinic, a variety of details may be recored, such as the patient's temperature, their weight, and various blood tests. Should this patient be diagnosed as having "Vitamin B 12 deficiency anaemia, unspecified" corresponding to ICD-10 code D51.9, this particular interaction might eventually get recorded as an instance of "Anaemia" in an aggregate based system. Patient based data is important when you want to track longitudinally the progress of a patient over time. For example, if we want to track how a patient is adhering to and responding to the process of TB treatment (typically taking place over 6-9 months), we would need patient based data.

Aggregated data is the consolidation of data relating to multiple patients, and therefore cannot be traced back to a specific patient. They are merely counts, such as incidences of Malaria, TB, or other diseases. Typically, the routine data that a health facility deals with is this kind of aggregated statistics, and is used for the generation of routine reports and indicators, and most importantly, strategic planning within the health system. Aggregate data cannot provide the type of detailed information which patient level data can, but is crucial for planning and guidance of the performance of health systems.

Patient data is highly confidential and therefore must be protected so that no one other than doctors can get it. When in paper, it must be properly stored in a secure place. For computers, patient data needs secure systems with passwords and restrained access.

Security concerns for aggregated data are not as crucial as for patient data, as it is usually impossible to identify a particular person to a aggregate statistic . However, data can still be misused and misinterpreted by others, and should not be distributed without adequate data dissemination policies in place.

1.4. Use of DHIS2 in HMIS: data collection, processing, interpretation, and analysis.

The wider context of HMIS can be comprehensively described through the information cycle presented in Figure 1.1 below. The information cycle pictorially depicts the different components, stages and processes through which the data is collected, checked for quality, processed, analysed and used.

Figure 1.1. The health information cycle

The health information cycle

DHIS2 supports the different facets of the information cycle including:

  • Collecting data.

  • Running quality checks.

  • Data access at multiple levels.

  • Reporting.

  • Making graphs and maps and other forms of analysis.

  • Enabling comparison across time (for example, previous months) and space (for example, across facilities and districts).

  • See trends (displaying data in time series to see their min and max levels).

As a first step, DHIS2 serves as a data collection, recording and compilation tool, and all data (be it in numbers or text form) can be entered into it. Data entry can be done in lists of data elements or in customised user defined forms which can be developed to mimic paper based forms in order to ease the process of data entry.

As a next step, DHIS2 can be used to increase data quality. Firstly, at the point of data entry, a check can be made to see if data falls within acceptable range levels of minimum and maximum values for any particular data element. Such checking, for example, can help to identify typing errors at the time of data entry. Further, user can define various validation rules, and DHIS2 can run the data through the validation rules to identify violations.

When data has been entered and verified, DHIS2 can help to make different kinds of reports. The first kind are the routine reports that can be predefined, so that all those reports that need to be routine generated can be done on a click of a button. Further, DHIS2 can help in the generation of analytical reports through comparisons of for example indicators across facilities or over time. Graphs, maps, reports and health profiles are among the outputs that DHIS2 can produce, and these should routinely be produced, analysed, and acted upon by health managers.

1.5. Overview of DHIS2

1.5.1. Overview of DHIS2 modules

DHIS2 is based on a modular approach of design. A module can be seen as an independent component of application that is capable of both processing inputs as well as outputs, that is used to communicate with other modules. The modules are flexible enough to allow changes in one module without having any effect on other modules. As long as input and output stays the same, it doesn't matter what happens inside a module. A module can then be changed without affecting other modules, which will be working as long as the output from the first module comes out as normal. This modular feature allows DHIS2 to be constantly upgraded in terms of functionality, integrated with other applications such as Excel pivot tables and GIS. Thus modularity allows DHIS2 to be flexible, and changes can take place in the different modules without affecting others.

Currently, DHIS2 has several modules for functions such as data entry, data quality checks, report generation etc. These modules have been categorised and presented under two core categories namely Maintenance and Services. The Services module supports data record, analysis, report generation etc. And the Maintenance module allows you to set the content and structure of the Services module. Each of these modules will be discussed at greater length in this document.

1.5.2. Web-based versus standalone HMIS and their suitability

DHIS2 can run both as a web based and offline application. As a web based application, the DHIS2 application can run on a central server and make use of client-server architecture. For example, at the state level, the DHIS2 can run on a server, and the different districts act as clients, drawing upon the server application through the Internet for local use of the application.

In a standalone application, the DHIS2 can run as an independent application on individual computers in different sites such as PHCs, CHCs etc. So, if computerisation is taking place at the Block level, then the DHIS 2 will be installed separately on each of the block level computers. The disadvantage of a standalone application is that of platform dependency – where the application needs to be configured to the platform on each of the respective machines. A thick client requires a local run-time environment. For example a Windows Form application will only run on a Windows platform with the .Net framework installed. The major advantage of the offline version is that it can run without any dependency on the Internet. This allows the application to run in remote locations where there is limited or no Internet connectivity.

The main advantage of a web based solution is that it is centralised, which enables easy, on-line updating and deployment of the application. The only requirements on the clients’ side are to have web browser installed on the used computer and have an Internet connection. The hardware on the server is often more powerful than the single computer. Another advantage of the web application is that is platform independent, allowing the same software to be accessed through a web browser regardless of the client’s operating system.

Where connectivity is available, and there is need for centralised management, a web based application is useful, and a standalone application is preferred when these conditions are not available or required. However, in most cases, a mix of these two approaches would be required, with a server based deployment working for district-state-national level processing, and a standalone deployment at lower levels where connectivity is limited. The advantage of such an approach is that it is flexible, inclusive, and scalable because as facilities get Internet connectivity they can be hooked up to the network.

1.5.3. Free and Open Source Software (FOSS): benefits and challenges

Software carries the instructions that tell a computer how to operate. The human authored and human readable form of those instructions is called source code. Before the computer can actually execute the instructions, the source code must be translated into a machine readable (binary) format, called the object code. All distributed software includes the object code, but FOSS makes the source code available as well.

Proprietary software owners license their copyrighted object code to a user, which allows the user to run the program. FOSS programs, on the other hand, license both the object and the source code, permitting the user to run, modify and possibly redistribute the programs. With access to the source code, the users have the freedom to run the program for any purpose, redistribute, probe, adapt, learn from, customise the software to suit their needs, and release improvements to the public for the good of the community. Hence, some FOSS is also known as free software, where “free” refers, first and foremost, to the above freedoms rather than in the monetary sense of the word.

Within the public health sector, FOSS can potentially have a range of benefits, including:

  • Lower costs as it does not involve paying for prohibitive license costs.

  • Given the information needs for the health sector are constantly changing and evolving, there is a need for the user to have the freedom to make the changes as per the user requirements. This is often limited in proprietary systems.

  • In the health sector, including in NRHM; a key agenda is that of integration, which involves the technical linking of different pieces of software (for example, DHIS 2 and RIMS). For this, the source code needs to be made available to the developers to create the integration. This availability is often not possible in the case of proprietary software. And when it is, it comes at a high cost and contractual obligations.

  • FOSS applications like DHIS2 typically are supported by a global network of developers, and thus have access to cutting edge research and development knowledge.

1.5.4. Understanding platform independence

All computers have an Operating System (OS) to manage it and the programs running it. The operating system serves as the middle layer between the software application, such as DHIS2, and the hardware, such as the CPU and RAM. DHIS2 runs on the Java Virtual Machine, and can therefore run on any operating system which supports Java. Platform independence implies that the software application can run on ANY OS - Windows, Linux, Macintosh etc. DHIS2 is platform independent, and is extremely useful in the context of public health, where multiple operating systems may be in use.

1.5.5. Auxiliary software that can be used with DHIS2

A variety of auxiliary software can be run with DHIS2, such as GIS (for mapping), JasperReports (for reporting), Excel (for analysis through pivot table operations), OpenMRS (for patient based management). Being based on Open Standards and an Open Architecture, DHIS2 can build bridges to speak to the other systems. Further, auxiliary modules can be developed and integrated with the core DHIS2 application.

Chapter 2. Getting started with DHIS 2

2.1. Getting started with DHIS 2

After reading this chapter you will be able to understand:

  • Start DHIS 2 from the desktop

  • How to log-in from the desktop

  • Create new users and user roles

  • What steps are needed to design a DHIS 2 database for your organisation

2.1.1. Prerequisites

You must be sure that you have a current version of the Java Runtime installed on your machine. Depending on your operating system, there are different ways of installing Java. The reader is referred to this website for detailed information on getting java installed.

2.1.2. Starting the DHIS 2 Live package

The DHIS 2 Live package is the easiest way to get started with DHIS 2. DHIS 2 Live is appropriate for a stand-alone type of installation. Simply download the application from here. Once the file is downloaded, you can simply double-click the downloaded file, and get started using DHIS 2.

2.1.2.1. Starting up with a blank database

The live package comes with a demo database just like what you see on the online demo (which is based on the national Sierra Leone HMIS), and if you want to start with a blank system/database and build up your own system then you need to do the following:

1) Stop the DHIS 2 live if it is already running. Right click on the tray icon and select Exit. The tray icon is the green symbol on the bottom right of your screen (on Windows) which should say' DHIS 2 Server running' if you hold your mouse pointer over it.

2) Open the folder where the DHIS 2 live package is installed and locate the folder called "conf".

3) In conf/ open the file called 'hibernate.properties' in a text editor (notepad or similar) and do the following modification: locate the string 'jdbc:h2:./database/dhis2' and replace the 'dhis2' part with any name that you want to give to your database (e.g. dhis2_test).

4) Save and close the hibernate.properties file.

5) Start DHIS 2 Live by double-clicking on the file dhis2-live.exe in the DHIS 2 Live installation folder or by using a desktop shortcut or menu link that you might have set up.

6) Wait for the browser window to open and the login screen to show, and then log in with username: admin and password: district

7) Now you will see a completely empty DHIS 2 system and you should start by adding your users, organisational hierarchy, data elements, and datasets etc. Please refer to the other sections of the user manual for instructions on how to do this.

2.1.3. Working directly with the H2 database

DHIS 2 Live uses an embedded H2 database. This has several advantages - there is no need to install a separate database engine such as PostgresSql or MySql, and backup can be made by just copying the file. The whole db exists in memory, which means high performance. The disadvantage is need for RAM. It is also not suitable for mulitiuser server installations.

In general, it is recommended to work with the database through the DHIS 2 user interface, but in some situations one may need to manipulate the data directly. If one downloads H2 separately, it comes with a web interface. It can also be manipulated using OpenOffice.org, using the following procedure. This assumes that dhis2-live is located in the user's Linux home directory (represented by ~). Substitute the absolute path to your dhis2-live installation.

  • Start OpenOffice Word Processor and select Tools - Options, then Java - Class Path ... and click on Add Archive...

  • Select the following file (version may differ): ~/dhis2-live/webapps/dhis/WEB-INF/lib/h2-1.1.119.jar

  • Close OpenOffice completely and then open OpenOffice.org Database. Select connect to an existing database - JDBC

  • Datasource URL is h2:~/dhis2-live/database/dhis2;AUTO_SERVER=TRUE, and JDBC driver class is org.h2.Driver

  • User name is sa, password not needed. Finally, select a name and folder for the .odb file.

More tips

2.1.4. Downloading and installing the server version

The server version can be downloaded from dhis2.org/download. For detailed information on how to install it please refer to the installation chapter in the implementation manual.

2.2. Logging on to DHIS 2

Regardless of whether you have installed the server version of the desktop Live version, you will use a web-browser to log on to the application. DHIS 2 should be compatible with most modern web-browsers, although you will need to ensure that Java Script is enabled.

To log on to the application just enter http://localhost:8080/dhis if you are using the DHIS 2 live package, or replace localhost with the name or IP address of the server where the server version is installed.

Once you have started DHIS 2, either on-line or offline, the displayed screen will prompt you to enter your registered ‘user name’ and ‘password’. After entering the required information click on log-in button to log into the application. The default user name and password are 'admin' and 'district'. They should be changed immediately upon logging on the first time.

2.3. Creating new users and roles

This section will describe how to add new users to the DHIS 2 application.

2.3.1. Open User Menu

To create or find a user begin with clicking on the ‘user’ module displayed in the drop down menu of the Maintenance module located on the main tool bar on the top part of the displayed screen.

User names already registered will appear as a list as seen in the screen shot below.

You can search for specific user names in the user list by entering the name in the ‘filter by user name’ field as shown above.

2.3.2. Define a new role

As part of creating a user name you are required to define the user role. Do so by clicking on the ‘user role’ appearing on the left side of the displayed screen. This will lead you to the Role Management page where you will have to click on Add new to create a new role.

The following screen will open and here in the first text box you need to give Name of the Role such as Super User, Admin User, etc. The second text box called ‘Description’ gives more information about the type of User Role that is being created for e.g. State Admin User, District Data Entry.

Next you will specify the particular data set(s) that are to be made available to the particular role. You will also need to specify the type of ‘authority’ to be given to the particular user. For each of the three options namely Datasets, Reports and Authorities user can select multiple options from the scroll down menu provided against each field. A user can choose multiple options either by moving them one-by-one.

In order for particular users to be able to enter data, you must add them to both a dataset as well as an organisational unit level. You can also select multiple datasets individually by pressing the Ctrl key on the keyboard and clicking on individual datasets.

Finally when you have entered the required fields click on Save which is located on the lower part of the displayed screen. The desired user role and related authorisation will be saved to the database, and can then be assigned to a particular user.

2.3.3. Add New User

Under particular user role there can be more than one user. To add new users go to the User options under the Maintenance module.

To add a new user, just follow these steps:

  • Click on the Add New button.

  • Enter New User details like User name, Password, Confirm password, Surname, First name and Email in new user’s option tabs.

  • Click on Add button for confirmation of new user details and follow the user error while creation of new user.

  • The recently created new user can be seen in main’ User management Screen

  • You can edit (like password, surname….etc) and delete the details of new/old users by selecting corresponding User’s Edit and Delete Buttons.

  • Click on Save tab after editing all details of a particular selected user.

2.4. Logging out of DHIS 2

Just click on the Log out link in the top right corner to exit the application.

2.5. Quick intro to designing a DHIS 2 database

The DHIS 2 application comes with a set of tools for data collection, validation, reporting and analysis, but the contents of the database, e.g. what to collect, who should collect it and on what format will depend on the context of use. This metadata need to be populated into the application before it can be used, and this can be done through the user interface and requires no programming or in-depth technical skills of the software. We call this initial process database design or customisation.

This section will provide a very quick and brief introduction to DHIS 2 database design and mainly explain the various steps needed to prepare a new DHIS 2 system for use. How to do each step is explained in other chapters, and best practices on design choices will be explained in an implementers manual (expected during first half of 2011). Here are the steps to follow:

1. Set up an organisational hierarchy

2. Define data elements

3. Define data sets and data entry forms

4. Define validation rules

5. Define indicators

6. Define report tables and design reports

7. Set up the GIS module

8. Design charts and customise the dashboard

2.5.1. The organisational hierarchy

The organisational hierarchy defines the organisation using the DHIS 2, the health facilities, administrative areas and other geographical areas used in data collection and data analysis. This dimension to the data is defined as a hierarchy with one root unit (e.g. Ministry of Health) and any number of levels and nodes below. Each node in this hierarchy is called an organisational unit in DHIS 2. The design of this hierarchy will determine the geographical units of analysis available to the users as data is collected and aggregated in this structure. There can only be one organisational hierarchy at the same time so its structure needs careful consideration. Additional hierarchies (e.g. parallel administrative boundaries to the health care sector) can be modelled using organisational groups and group sets, but the organisational hierarchy is the main vehicle for data aggregation on the geographical dimension. Typically national organisational hierarchies in public health have 4-6 levels, but any number of levels is supported. The hierarchy is built up of parent-child relations, e.g. a Country or MoH unit (the root) might have e.g. 8 parent units (provinces), and each province again ( at level 2) might have 10-15 districts as their children. Normally the health facilities will be located at the lowest level, but they can also be located at higher levels, e.g. national or provincial hospitals, so skewed organisational trees are supported (e.g. a leaf node can be positioned at level 2 while most other leaf nodes are at level 5). Typically there is a geographical hierarchy defined by the health system. e.g. where the administrative offices are located (e.g. MoH, province, district), but often there are other administrative boundaries in the country that might or might not be added, depending on how its boundaries will improve data analysis. When designing the hierarchy the number of children for any organisational unit may indicate the usefulness of the structure, e.g. having one or more 1-1 relationships between two levels is not very useful as the values will be the same for the child and the parent level. On the other extreme a very high number of children in the middle of the hierarchy (e.g. 50 districts in a province) might call for an extra level to be added in between to increase the usefulness of data analysis. The lowest level, the health facilities will often have a large number of children (10-60), but for other levels higher up in the hierarchy approx. 5-20 children is recommended. To few or too many children might indicate that a level should be removed or added. Note that it is quite easy to make changes to the upper levels of the hierarchy at a later stage, the only problem is changing organisational units that collect data (the leaf nodes), e.g. splitting or merging health facilities. Aggregation up the hierarchy is done based on the current hierarchy at any time and will always reflect the most recent changes to the organisational structure. Refer to the chapter on Organisation Units to learn how to create organisational units and to build up the hierarchy.

2.5.2. Data Elements

The Data Element is perhaps the most important building block of a DHIS 2 database. It represents the "WHAT" dimension, it explains what is being collected or analysed. In some contexts this is referred to an indicator, but in DHIS 2 we call this unit of collection and analysis a data element. The data element often represents a count of something, and its name describes what is being counted, e.g. "BCG doses given" or "Malaria cases". When data is collected, validated, analysed, reported or presented it is the data elements or expressions built upon data elements that describes the WHAT of the data. As such the data elements become important for all aspects of the system and they decide not only how data is collected, but more importantly how the data values are represented in the database, which again decides how data can be analysed and presented.

It is possible to add more details to this "WHAT" dimension through the disaggregation dimension called data element categories. Some common categories are Age and Gender, but any category can be added by the user and linked to specific data elements. The combination of a data element's name and its assigned category defines the smallest unit of collection and analysis available in the system, and hence describes the raw data in the database. Aggregations can be done when zooming out of this dimension, but no further drill-down is possible, so designing data elements and categories define the detail of the analysis available to the system (on the WHAT dimension). Changes to data elements and categories at a later stage in the process might be complicated as these will change the meaning of the data values already captured in the database (if any). So this step is one of the more decisive and careful steps in the database design process.

One best practice when designing data elements is to think of data elements as a unit of data analysis and not just as a field in the data collection form. Each data element lives on its own in the database, completely detached from the collection form, and reports and other outputs are based on data elements and expressions/formulas composed of data elements and not the data collection forms. So the data analysis needs should drive the process, and not the look an feel of the data collection forms. A simple rule of thumb is that the name of the data element must be able to stand on its own and describe the data value also outside the context of its collection form. E.g. a data element name like "Total referrals" makes sense when looking at it in either the "RCH" form or the "OPD" form, but on its own it does not uniquely describe the phenomena (who are being referred?), and should in stead be called "Total referrals from Maternity" or "Total referrals from OPD". Two different data elements with different meanings, although the field on the paper form might only say "Total referrals" since the user of the form will always know where these referrals come from. In a database or a repository of data elements this context is no longer valid and therefore the names of the data elements become so important in describing the data.

Common properties of data elements can be modelled through what is called data element groups. The groups are completely flexible in the sense that they are defined by the user, both their names and their memberships. Groups are useful both for browsing and presenting related data, but can also be used to aggregate data elements together. Groups are loosely coupled to data elements and not tied directly to the data values which means they can be modified and added at any point in time without interfering with the raw data.

2.5.3. Datasets and data entry forms

All data entry in DHIS 2 is organised through the use of Datasets. A Dataset is a collection of data elements grouped together for data collection, and in the case of distributed installs they also define chunks of data for export and import between instances of DHIS 2 (e.g. from a district office local installation to a national server). Datasets are not linked directly to the data values, only through their data elements and frequencies, and as such a dataset can be modified, deleted or added at any point in time without affecting the raw data already captured in the system, but such changes will of course affect how new data will be collected.

A dataset has a period type which controls the data collection frequency, which can be daily, weekly, monthly, quarterly, six-monthly, or yearly. Both which data elements to include in the dataset and the period type is defined by the user, together with a name, short name, and code.

In order to use a dataset to collect data for a specific orgunit you must assign the orgunit to the dataset, and this mechanism controls which orgunits that can use which datasets, and at the same time defines the target values for data completeness (e.g. how many health facilities in a district expected to submit RCH data every month).

A data element can belong to multiple datasets, but this requires careful thinking as it may lead to overlapping and inconstant data being collected if e.g. the datasets are given different frequencies and are used by the same orgunits.

2.5.3.1. Data entry forms

Once you have assigned a dataset to an orgunit that dataset will be made available in Data Entry (under Services) for the orgunits you have assigned it to and for the valid periods according to the dataset's period type. A default data entry form will then be shown, which is simply a list of the data elements belonging to the dataset together with a column for inputting the values. If your dataset contains data elements with categories such as age groups or gender, then additional columns will be automatically generated in the default form based on the categories. In addition to the default list-based data entry form there are two more alternatives, the section-based form and the custom form.

2.5.3.1.1. Section forms

Section forms allow for a bit more flexibility when it comes to using tabular forms and are quick and simple to design. Often your data entry form will need multiple tables with subheadings, and sometimes you need to disable (grey out) a few fields in the table (e.g. some categpories do not apply to all data elements), both of these functions are supported in section forms. After defining a dataset you can define it's sections with subsets of dataelements, a heading and possible grey fields i the section's table. The order of sections in a datsaset can also be defined. In Data Entry you can now start using the Section form (should appear automatically when sections are available for the selected dataset). You can switch between default and section forms in the top right corner of the data entry screen. Most tabular data entry forms should be possible to do with sections forms, and the more you can utilise the section forms (or default forms) the easier it is for you. If these two types of forms are not meeting your requirements then the third option is the completely flexible, although more time-consuming, custom data entry forms.

2.5.3.1.2. Custom Forms

When the form you want to design is too complicated for the default or section forms then your last option is to use a custom form. This takes more time, but gives you full flexibility in term of the design. In DHIS 2 there is a built in HTML editor (FcK Editor) for the form designer and you can either design the form in the UI or paste in your html directly (using the Source window in the editor. In the custom form you can insert static text or data fields (linked to data elements + category) in any position on the form and you have complete freedom to design the layout of the form. Once a custom form has been added to a dataset it will be available in data entry and used automatically. You can switch back to default and section (if exists) forms in the top right corner of the data entry screen.

2.5.4. Validation rules

Once you have set up the data entry part of the system and started to collect data then there is time to define data quality checks that help to improve the quality of the data being collected. You can add as many validation rules as you like and these are composed of left and right side expressions that again are composed of data elements, with an operator between the two sides. Typical rules are comparing subtotals to totals of something. E.g. if you have two data elements "HIV tests taken" and "HIV test result positive" then you know that in the same form (for the same period and organisational unit) the total number of tests must always be equal or higher than the number of positive tests. These rules should be absolute rules meaning that they are mathematically correct and not just assumptions or "most of the time correct". The rules can be run in data entry, after filling each form, or as a more batch like process on multiple forms at the same time, e.g. for all facilities for the previous reporting month. The results of the tests will list all violations and the detailed values for each side of the expression where the violation ocurred to make it easy to go back to data entry and correct the values.

2.5.5. Indicators

Indicators represent perhaps the most powerful data analysis feature of the DHIS 2. While data elements represent the raw data (counts) being collected the indicators represent formulas providing coverage rates, incidence rates, ratios and other formula-based units of analysis. An indicator is made up of a factor (e.g. 1, 100, 100, 100 000), a numerator and a denominator, the two latter are both expressions based on one or more data elements. E.g. the indicator "BCG coverage <1 year" is defined a formula with a factor 100, a numerator ("BCG doses given to children under 1 year") and a denominator ("Target population under 1 year"). The indicator "DPT1 to DPT3 drop out rate" is a formula of 100 % x ("DPT1 doses given"- "DPT3 doses given") / ("DPT1 doses given").

Most report modules in DHIS 2 support both data elements and indicators and you can also combine these in custom reports, but the important difference and strength of indicators versus raw data (data element's data values) is the ability to compare data across different geographical areas (e.g. highly populated vs rural areas) as the target population can be used in the denominator.

Indicators can be added, modified and deleted at any point in time without interfering with the data values in the database.

2.5.6. Report tables and reports

Standard reports in DHIS 2 is a very flexible way of presenting the data that has been collected. Data can be aggregated by any organisational unit or orgunit level, by data element, by indicators, as well as over time (e.g. monthly, quarterly, yearly). The report tables are custom data sources for the standard reports and can be flexibly defined in the user interface and later accessed in external report designers such as iReport or BIRT. These report designs can then be set up as easily accessible one-click reports with parameters so that the users can run the same reports e.g. every month when new data is entered, and also be relevant to users at all levels as the organisational unit can be selected at the time of running the report.

2.5.7. GIS

In the integrated GIS module you can easily display your data on maps, both on polygons (areas) and as points (health facilities), and either as data elements or indicators. By providing the coordinates of your organisational units to the system you can qucikly get up to speed with this module. See the GIS section for details on how to get started.

2.5.8. Charts and dashboard

On of the easiest way to display your indicator data is through charts. An easy to use chart dialogue will guide you through the creation of various types of charts with data on indicators, organisational units and periods of your choice. These charts can easily be added to one of the four chart sections on your dashboard and there be made easily available right after log in. Make sure to set the dashboard module as the start module in user settings.

Chapter 3. Organisation units

In this section you will learn how to:

  • Create a new organisation unit and build up the organisation unit hierarchy

  • Create organisation unit groups, group sets, and assigning organisation units to them

  • How to make changes to the organisational unit hierarchy

3.1. The organisational hierarchy

The organisational hierarchy defines the organisation structure of the DHIS2 instance, such as how the health facilities, administrative areas and other geographical areas are arranged with respect to each other. It is essentially the "where" dimension of DHIS2, similar to how periods represent the "when" or time dimension. DHIS2 is structured so that the organisational unit hierarchy is a geographical hierarchy, and the GIS module depends on this. Non-geographical hierarchies are discouraged, and would better to be represented through the use of organisational unit groups. This dimension to the data is defined as a hierarchy with one root unit (e.g. Ministry of Health or a country) and any number of levels and nodes below. Each node in this hierarchy is called an organisational unit in DHIS2.

The design of this hierarchy will determine the geographical units of analysis available to the users as data is collected and aggregated in this structure. There can only be one organisational hierarchy at the same time so its structure needs careful consideration.

Additional hierarchies (e.g. parallel administrative boundaries to the health care sector) can be modeled using organisational groups and group sets, but the organisational hierarchy is the main vehicle for data aggregation on the geographical dimension. Typically national organisational hierarchies in public health have 4-6 levels, but any number of levels is supported.

The hierarchy is built up of parent-child relations. For instance a country might have eight provinces, and each province again might have a number of districts as their children. Normally the health facilities (from which data is typically collected) will be located at the lowest level, but they can also be located at higher levels, e.g. national or provincial hospitals, so skewed organisational trees are supported (e.g. a leaf node can be positioned at level 2 while most other leaf nodes are at level 5).

Note that it is quite easy to make changes to the upper levels of the hierarchy at a later stage, the only problem is changing organisational units that collect data (the leaf nodes), e.g. splitting or merging health facilities. Aggregation up the hierarchy is done based on the current hierarchy at any time and will always reflect the most recent changes to the organisational structure.

[Important]Important

Because the most recent information which is contained in the organisational unit hierarchy is always used for aggregation, it is important to keep in mind that changes to it (such as the division of districts into two separate districts) will not be respected over time. As an example, District A may be sub-divided into District B and District C. This is a process which often happens for political reasons. Facilities which belong to District A would need to be reassigned to District B and C. However, any historical data, which was entered before the split actually occurred, would still be registered as belonging to District B and C and not the defunct District A. This temporal representation of the organisational hierarchy across time will be lost.

3.2. Organisation unit maintenance

3.2.1. Organisation units

This is where you can create organisation units (from now on referred to as orgunits) and build up the orgunit hierarchy. Orgunits are added one by one as either root unit or a child of a selected unit. The left side menu represents the current organisational hierarchy and if you select a unit there you will see its children listed in the main list of orgunits in the middle of the screen. When an orgunit is selected in the left side menu you can also add new child units to it. To locate an orgunit in the hierarchy you can either navigate through the tree by expanding the branches (click on the + symbol), or search for it by opening the search field (click the green symbol above the root of the hierarchy). In search you can either search for the orgunit name or its code, both will only show exact matches (case-insensitive). To add a new orgunit first select its parent and then click on the Add new button in the top right corner of the list of orgunits. To add a new root orgunit make sure no orgunit is selected in the menu and click on "Add new". The details of adding a new orgunit are explained in Section 3.2.1.1, “Editing organisation units”.

3.2.1.1. Editing organisation units

To edit the properties of an existing orgunit first select its parent (if any) in the left side menu, then locate the orgunit in the listed orgunits, and finally click on the "Edit" button next to the name of the orgunit that you want to modify. The following properties can be defined in the Edit (or Create new) window:

  • Name: Define the precise name of the orgunit in this field. Each orgunit must have a unique name.

  • Short name: Typically, an abbreviation of the full name. This attribute is often used in reports to display the name of the orgunit, where there is limited space available.

  • Code: In many countries, orgunits are assigned a code. This code can be entered in this field.

  • Opening date: Used to control which orgunits that where existing at a point in time, e.g. when analysing historical data. This attribute is required. The default date for opening of organisation units is 1900-01-01, but can be set to any date (even dates which occur in the future).

  • Registers data: This property is used to identify which orgunits that can register data or not. Sometimes administrative orgunits at higher levels in the hierarchy are not supposed to register any data. This can help control the data entry process as only orgunits with this property set to Yes will be available for data entry.

  • Comment: Any additional information that you would like to add can be put here.

  • Coordinates: This field is used to create the maps in the GIS module. Paste in the coordinates of the orgunit in this field, either a polygon (for orgunits that represent an administrative boundary) or a point (for health facilities). Without this information the GIS module will not work. It might be more efficient to import these coordinates later as a batch job for all orgunits using the import module. See the GIS chapter for more details.

  • URL: You can use this field to insert a URL link to an external web site that has additional information about this specific orgunit.

  • Contact information: A contact person, address, email, and phone number can be entered in these fields. This information can be vital for facilitating follow-up.

  • Datasets: Datasets can be assigned to organisational units here. See the chapter on "Data sets" for more detailed information on assigning datasets to organisational units.

  • Organisation unit groups: Assignments to organisational units group sets can be assigned through the individual drop-down boxes which appear for each group set.

3.2.2. Organisation unit group sets

Group sets can be understood as a flexible tool to add more categorisation to orgunits. Any number of group sets can be added, but as a default start all databases will have the two group sets "Type" and "Ownership". Using these group sets will simplify how reporting is done, and facilitate analysis through the use of tools such as Excel PivotTables.

While a group set like "Type" describes a measure dimension, the actual categories are represented by the groups, and the categorisation of an orgunit through the orgunit's group memberships. This can be understood as a parallel hierarchy of orgunits with the group set as the root ("Type"), the groups at level 2 (e..g "Clinic", "Hospital", "Dispensary"), and the actual orgunits at level 3. The group set can as such provide additional information and dimensionality to the data analysis as data is easily filtered, organised, or aggregated by groups within a group set.

For this aggregation to work without any duplication in the data some rules are necessary. A group set is always exclusive, which means that an orgunit cannot be member of more than one group in a group set. Therefore, when creating a new organisational unit, you will only be allowed to select a single organisational group membership for each group set. Furthermore it is possible to define whether a group set is compulsory or not, which will affect the completeness of the data when analysing data using group sets. Compulsory means that ALL orgunits must be member of a group in that group set.

We recommend that you approach the orgunit grouping in the following sequence (and one group set at a time):

  1. Define a new group set, such as "Location".

  2. Add new groups (such as "Urban", "Rural" and "Peri-urban"). Once all groups have been defined, return to the organisational unit group set and assign each of the desired groups to the group set.

  3. Go back to each group, one by one, go to edit mode and assign the orgunits that should be member of the group. Should you follow this route, you can place multiple organisation units at a time in a group. However, you must be careful not to place the same organisational units in two groups which itself is a member of an organisation unit group set. This will result in a data integrity violation. If you have organisation unit groups which are not exclusive, they should not be members of a group.

  4. A better way to ensure that you do not mistakedly assign an organisation unit to multiple members of a group set is you can use the edit feature of each organisational unit to assign memberships to each group set.You will only be able to assign a single organisation unit at a time however.

It is important to keep in mind when using the "Organisational unit group" set function, that unless great care is taken, organisational units can be assigned to multiple groups of a group set. This can be checked through the "Data Integrity" module, which will report which organisational units are not members of a compulsory organisational unit group set, and which organisational units have been assigned to more than one member of a group set.

3.2.2.1. Editing organisation unit group sets

Click on the "Edit" button next to the name of the orgunit group set that you want to modify. The following properties can be defined in the Edit (or Create new) window:

  • Name: Provide a precise name for the group set.

  • Description: Describe the phenomena the group set is measuring/capturing.

  • Compulsory: Indicate whether ALL orgunits need to be member of a group in this group set or not.

  • Available groups/Selected groups: Here you assign groups to your group set by using the arrow buttons to move highlighted groups between the two lists (/selected). If no groups appear in the list then you must go to orgunit groups and create new groups there first. Note that assigning groups that will violate the exclusive rule on group sets is not possible, e.g. adding a group that already has assigned an orgunit that again is already member of a group that has already been selected by this group set, will not be possible since one orgunit will end up with two group memberships in the same group set. To avoid such situations we recommend first adding groups to group sets, and then orgunits to groups.

3.2.3. Organisation unit groups

This function will allow you to add new and manage existing organisation groups and their memberships. It can be accessed by choosing Maintenance->Organisation units->Organisation Unit group from the main menu. To add a new orgunit group click on the "Add new" button in the top right corner of the list of groups.

3.2.3.1. Editing organisation unit groups

Click on the "Edit" button next to the name of the orgunit group that you want to modify. The following properties can be defined in the Edit (or Create new) window:

  • Name: Provide a precise name for the orgunit group.

  • Organisation unit tree selection: This is where you assign orgunits to the group. The tree supports multiple selection so select all the orgunits that you want to add (the selected ones appear with orange color) and click on "Save". Click on "Cancel" to undo your changes and return to the list of orgunit groups. Use the "Select at level" button and dropdown if you want to select all orgunits at a specific level in the hierarchy (e.g. all districts).

3.2.4. Organisation unit level

Here you specify a contextual name for each level in the hierarchy, e.g. "Country", "Province", "District", "Health Facility", and these names will be used all over the application where levels are referred to. This page will take some time to load if the orgunit hierarchy is very big.

3.2.5. Hierarchy operations

Here you can move orgunits around in the hierarchy by changing the parent of a selected orgunit. This process is done in three steps:

1. Select the orgunit you want to move (in the hierarchy in the left side menu) and click "Confirm" under the "Select an organisation unit to move" label.

2. Select the new parent orgunit (again by using the hierarchy in the left side menu). If no parent is selected then the orgunit will be moved up to root level (top of the hierarchy). Click on the "Confirm" button under the "Select the new parent organisation unit for the one to move" label.

3. Click on the "Move" button to apply your changes to the hierarchy.

Your changes will be immediately reflected in the left side menu hierarchy. At any time in the process (before hitting the Move button) you can click on the "Reset" button to unselect orgunit to move and the new parent.

Chapter 4. Data elements

When the ‘Data Elements and Indicators’ options is chosen from the main Maintenance menu, the following screen appears:

From the left side menu or by clicking on the sections listed in the central area you can access the various sections on data elements;

Data Element, Data Element Group, Data Element Group Editor, Data Element Group Set, Data Element Category, Data Element Category Combination.

4.1. Data element maintenance

Each of the options for maintenance of data elements will be described in the following section.

  • Data element

    Create, modify, view and delete data elements.

  • Data element group

    Create, modify, view and delete data element groups.

  • Data element group editor

    Easily add or remove data elements to and from data element groups.

  • Data element group set editor

    Create, modify, view and delete data elements group sets.

  • Data element categories

    Create, modify, view and delete data element categories.

4.1.1. Data elements

Data elements form the basis of DHIS2. Data elements define what is actually recorded in system, e.g. number of immunisations or number of cases of malaria. The actual creation and definition of the data elements themselves are far beyond the scope of this manual to describe, but it is assumed that an administrator will be provided with a list of standardised data elements for inclusion into the DHIS2 system.

To access the data element maintenance module, choose Maintenance -> Data elements and Indicators -> Data element.

The ‘Filter by name’ will allow you to filter a range of data elements if you know either the full name of the data element, or just a part of it. Type the name into the search field and any matching data elements are displayed below. You can also choose ‘Filter by group/view all’ to narrow down a data element search within a particular data element group. In default mode, this field will display all the data elements in the application. The ‘Get PDF’ button can be clicked to generate a .pdf file of all the data elements. The 'Sort' button can be used to sort the data elements into alphabetical order.

To add a new data element, click the 'Add new' button. There are various options available from this page that allow the user to modify data elements already present in the database. Each of the options are described below in the "Editing data elements".

4.1.1.1. Editing data elements

Click the "Edit" button to modify the properties of a data element that has been previously defined.

  • Name: Define the precise name of the data element in this field. Each data element must have a unique name.

  • Short name: Typically, an abbreviation of the full data element name. This attribute is often used in reports to display the name of the data element, where there is limited space available.

  • Alternative name: Allows the definition of an alternative name of the data element.

  • Code: In many countries, data elements are assigned a code. This code can be entered in this field.

  • Description: Allows a full textual description of the data element to be entered. The user should be as precise as possible, and include full information on how the data element is measured and what its meaning is.

  • Active: Defines whether a given data element is active or not. Data elements marked as inactive, will not be displayed in the data entry screens.

  • Domain type: Defines whether a data element is an aggregate or patient type of data element.

  • Value type: Defines the type of data this data element will be used to record. Currently there are four options: number, text, yes/no (boolean), and date.

  • Number type: In order to increase the robustness of data entry, DHIS2 supports several different number types. During data entry, users will be restricted to enter the defined number types only. Each of the available options are described below.

    1. Number: This number type supports any real value with a single decimal point, an optional negative sign, and no thousands separators.

    2. Integer: Any whole number (positive and negative), including zero.

    3. Positive integer: Any whole number greater than (but not including) zero.

    4. Negative integer: Any whole number less than (but not including) zero.

  • Aggregation operator: Defines the default aggregation operation that will be used on this data element. Most data elements should have the "SUM" option set. This includes all data elements which should be added together. Other data elements, such as staffing levels, should be set to use the "AVERAGE" operator, when values along the time dimension should not be added together, but rather averaged.

  • URL: A URL having an in-depth description of the data element can be entered in the ‘URL’ field. This could be for instance, a link to a metadata repository or registry that contains detailed technical information about the definition and measurement of the data element.

  • Combination of categories: Defines which category combination the data element should have.

  • Data element group sets: Click the check box to activate this option hen choose which data element group sets this data element should belong to. Available data element group sets are displayed din the upper window. Click the desired data element group set, then the "Add selected" button to add the data element to the group set. To remove a data element from a group set, click the data element group set in the lower list, and then click "Remove selected".

  • Calculated: This option is available only when a data element is created.

    [Note]Note

    As of version 2.3, calculated data elements have been deprecated. Calculated data elements should therefore be implemented as indicators instead.

    Select the data elements that will be used to define the calculated data element, and then click "Add selected" to add them calculated data element composition list. Fill in the correct factor for the data element calculation component (defaults to 1). Component elements of the calculated data element can be removed from the definition by pressing the "Remove" button.

  • Aggregation levels: The Aggregation Levels option allows the data element to be aggregated at one or more levels. When the user clicks on the Aggregation levels option, a drop down menu appears which displays available aggregation levels. The desired aggregation level is then selected by clicking the ‘Add Selected’ button. By default, the aggregation will start at the lowest assigned organisation unit. If e.g. Chiefdom is selected below it means that Chiefdom, District, and National aggregates will use Chiefdom (the highest aggregation level available) as the data source, and PHU data will not be included. PHU data will still be available for the PHU level, but not included in aggregations to the levels above. If District and Chiefdom are both selected then the District and National level aggregates will use District data as their source, Chiefdom will use Chiefdom, and PHU will use PHU. Read more about aggregation levels in the Reporting chapter i the section on data sources for reporting.

After making the required changes, click ‘Save’ to institute them. The ‘Cancel’ button aborts all changes made.

4.1.1.2. Data element translation

DHIS2 provides functionality to translate existing data elements into other languages. Simply press the translate button to get started. The following dialogue will appear.

The reference language is displayed in the upper right portion of the dialogue. Choose a locale to translate the data element into by selecting an option from the locale drop-down menu. Specify the name, short-name and description in the target language. Press "Save" to save your changes.

The "Details" section of this dialogue will allow you add a new locale if it is not already present in the database. There are two options:

  • Language code

    Refers to the ISO 639-1 (two-letter code) language code. Refer to this web page for a detailed listing of language codes.

  • Country code

    Refers to the ISO 3166-1-alpha-2 code. A complete listing is available here.

The combination of these two codes together, forms a "locale" code, which is composed of the combination of the location and language. A very comprehensive discussion of the technical standard (RFC 3066) is available here. This page provides a very comprehensive list of recognised locale codes.

4.1.1.3. Deleting a data element

Simply press the delete button to delete a data element. Note that this operation is only possible if there is no data attached to the data element itself. The user will be prompted to ensure that the data element should be deleted.

4.1.1.4. Displaying data element details

This operation displays an in-line panel in the browser which displays all metadata about a given data element. Press the information button to access this view.

4.1.2. Data element groups

Data element groups provide a mechanism for classifying related data elements into a common theme. For instance, two data elements "Measles immunisation" and "BCG Immunisation" might be grouped together into a data element group "Childhood immunisation". To access the data element group maintenance page, click Maintenance -> Data elements and Indicators -> Data Element Group.

Similar to the "Data element" maintenance page, data elements groups can be searched with by entering a search string in the "Filter by name" field.

To add a new data element group, click the "Add new" button and the following screen will be displayed:

Fill in the "Name" field and then select all data elements that should belong to the group from the left panel. Click the "Move selected" button to add the selected data elements to the data element group. Click the "Remove selected" button to remove all data elements from the group that have been selected in the right panel. Finally, click the "Add" button to save changes, or the "Cancel" button to discard any changes.

4.1.3. Data element group editor

The data element group editor provides advanced functionality to the administrator to allow multiple data elements to be added or removed from a group. It is also possible to create new data element groups, rename existing groups, and delete groups entirely. To access the data element group editor, go to "Maintenance -> Data elements and Indicators -> Data Element Group Editor". The following screen will appear.

Data element groups area listed alphabetically in the leftmost panel. By clicking on a data element group, the current members of that group (data elements) are listed in the centre panel. Available data elements that can be added to the data element group appear are listed alphabetically in the rightmost panel. To remove an existing data element from the group, click the name of the data element in the centre panel, and then press the "Move right" button. To add data elements to the group, select them from the leftmost panel, and click the "Move left" button. Press the "Update data element group member" button to save your changes.

4.1.4. Data element group sets

Data element group sets allow multiple data element groups to be categorised into a set. Data element group sets are used during analysis and reporting to combine similar data element groups into a common theme. To access the data element group set maintenance module, choose "Maintenance -> Data elements and Indicators -> Data Element Group Set". Similar to the other data element maintenance modules, new data element group sets can be added by pressing the "Add new button". Other operations include Edit, Translate, Delete and Information, similar to the other modules in this section.

Existing data element group set members can be edited by clicking the "Edit" button of the desired data element group set as seen below.

Available data element groups are displayed in the left panel. They can be moved into the selected data element group set by pressing the "Move right" button. Data element groups that are currently members of the data element group set are displayed in the right hand panel. They can be removed from the data element group set by clicking the desired data element group and pressing the "Move left" button. The ordering of the data element groups can be set with the "Move Up" and "Move Down" arrows. This ordering will be used in the datamart and reports to order the data element groups. Press the "Update" button to save any changes and the "Cancel" button to discard all changes.

4.1.5. Data element categories

Data element categories can be used to disaggregate data elements into individual atomic components. Data element categories are typically a concept, such as Gender, Age or Disease Status. Data elements such as "Number of cases of confirmed malaria" are often broken into smaller component parts to determine, for instance, the number of confirmed malaria cases of particular age groups. As an example, three data element categories: Under 1, 1-5 and Over 5 could be created. They could be assigned as categories to the data element, which would then create in the data entry screens, three separate fields for this data element namely:

  • Number of confirmed malaria cases (Under 1)

  • Number of confirmed malaria cases (1-5)

  • Number of confirmed malaria cases (Over 5)

Effective use of data element categories greatly simplifies the process of setting up the DHIS2 system, as the data element categories can be reused to disaggregate many different data elements. Otherwise, each of the data elements listed above, would need to be created separately. Judicious use of data element categories will greatly simplify the DHIS2 implementation, and allow for subsequent advanced analysis.

Data element categories are composed of category options. Category options must be defined when a data element category is created for the first time. Subsequent changes to the data element category, i.e. adding or deleting new category options, are not allowed once the data element category has been created.

It is critical that the proper categories and category options are defined in the initial definition step, as further changes to the category and its options will are not possible.

To access the data element category maintenance module, press "Maintenance -> Data Elements and Indicators->Data Element Category". The following screen will be displayed:

Similar to the other data element maintains modules, data element categories can be filtered by typing the name of the data element category (or a portion of it) into the "Filter by name" field. To add a new data element category, press the "Add new" button which will then display the following screen:

Type the name of the new data element category in the "Name" field in the "Details" region. Category options can be added by typing the name of the category option in the "Category option" region and pressing the "Add category option" button. Category options can be reordered using the "Move Up" and "Move Down" buttons. Categories options can be deleted by selecting the data element category option and pressing the "Delete" button. Once all data element categories options have been added to the data element category, press the "Add" button to save all changes or the "Cancel" button to discard any changes.

All data element category options must be added and defined properly in this step. Subsequent alterations to the data element category (other than reordering of the category options themselves) is not possible.

4.1.6. Data element category combinations

Data element category combinations allow multiple data element categories to be combined into a related set. As an example, a data element "Number of new HIV infections" might be disaggregated according to the following categories.

  • Age: "Under 5", "5-15", "15-24", "24 and above"

  • Gender: Male, Female

In this example, there would be two levels of disaggregation, consisting of two separate data element categories, each consisting of several data element category options. In most HMIS systems, different data elements are disaggregated according to a common set of categories. By combining these different categories into a data element category combination and assigning these combinations to data elements, the appropriate disaggregation levels can be applied efficiently and quickly to a large number of data elements.

To access the data element category combination maintenance module, select "Maintenance->Data element and indicators->Data element category combinations" from the main DHIS2 menu. As with the other maintains modules, you can filter the listed category combinations by entering the name (or portion thereof) of the category combination. Other operations such as "Edit", "Delete" and "Information" should be familiar to the reader.

To add a new category combination, click the "Add new" button. The following dialogue will be displayed.

Type the name of the category combination in the "Name" field, and then select the desired categories from the left panel. Press the "Move right" button to add the selected categories to the category combination. Press "Move left" to remove any categories that should not be part of the category combination.

Categories can only be added to a category combination at this step. Categories can be removed from category combinations later by editing the category combination, however, it is not allowed to add additional categories once the combination has been created. Ensure that the category combination and its respective categories is final before you create the category combination and assign it to a data element.

4.1.7. Data dictionaries

Data dictionaries are used to group data elements and indicators during filtering operations. They are useful for combining related groups of data elements and indicators according to the programs to which they belong. For instance a data dictionary called "MCH" could be created, and all maternal and child health data elements and indicators could be added to the dictionary. The data dictionary can be access by choosing Maintenance->Data elements and indicators->Data dictionary. The following screen will be displayed in the browser.

Provide a name for the data dictionary in the "Name" field and a description of its contents. Data elements and indicators can be added or removed from the dictionary. Click "Save" if you are creating a new data dictionary or "Add" if you are editing the contents of an existing data dictionary.

4.1.8. Translations

DHIS 2 provides functionality for translations of database content like data elements, data element groups, indicators, indicator groups, validation rules and more. These elements can be translated to any number of locales. A locale represents a specific geographical, political, or cultural region.

To add a translation click the Translate icon next to the element you would like to translate. Start by selecting the desired locale from the Locale select box. In the Translate screen, select your locale and enter values for the avaliable element properties. The reference property values are shown on the right. These values are the values which have been entered in the regular add or update user interface for the current object.

Translations can be enabled by selecting the desired locale under Database Language under User General Settings in the Settings module.

Chapter 5. Datasets and data entry forms

5.1. Datasets

All data entry in DHIS2 is organised through the use of datasets. You can add and edit datasets in Maintenance->Datasets. A dataset is a collection of data elements grouped together for data collection and data export between instances of DHIS2 (e.g. from a district office local installation to a national server). .

A dataset also has a frequency which controls the data collection frequency, which can be daily, weekly, monthly, quarterly, six-monthly, or yearly. Both which data elements to include in the dataset and the frequency is set in the Add/Edit Dataset window, together with a name, short name, and code. In order to use a dataset to collect data for a specific orgunit you must assign the orgunit to the dataset, and this mechanism controls which orgunits that can use which datasets.

Datasets also are assigned to specific organisation units which will be allowed to enter data for all data elements in a given dataset. You can assign orgunits to a dataset in the Dataset Management (list of available datasets are shown) by clicking on the blue folder icon, the first icon under Operations, corresponding to the dataset you would like to modify. Alternatively you can manage orgunit assignments for all datasets together in the Dataset Assignment Editor (available in the right-side menu for Datasets).

Your dataset will then be ready to be used in Services->Data Entry for the orgunits that you have assigned and for periods according to your selected frequency (period type).

5.1.1. Dataset management

The dataset management function allows you to create new datasets and manage existing ones. The dialog can be reached by choosing Maintenance->Datasets->Dataset. A sample dialog is displayed below.

Each of the functions is described below.

  • Sort: This controls the custom sort order. Depending on the systems settings, users will see the datasets ordered in the specific order which you provide.

  • Add new: Adds a new dataset. When pressing this button, you can create a new dataset. You need to provide a name, shortname and frequency. The "Code" attribute is optional. Data elements can be added to the "Selected data element" list by selecting them individually. and pressing the button. Indicators can also be added to data sets and will be available to be placed in custom data entry forms when they need to be shown along with data elements on the same data entry form. Press "Save" to add the new dataset.

  • Assign organisation units to datasets: This function will allow you to assign individual organisational units to a dataset. Only organisational units which have been assigned to a dataset will be allowed to enter data into the dataset.

  • Edit dataset: This will allow you to edit existing datasets, for instance when you need to add or remove data elements and indicators to a given dataset.

  • Translate: Allows you to translate the name of a dataset to a different language.

  • Create or edit a custom data entry form. Refer to ??? for detailed information of how to use this function.

  • Edit compulsory data elements: This dialog will allow you to add or remove data elements which will be marked as compulsory during data entry.

  • Delete: Completely removes a dataset from the system.

    [Warning]Warning

    Any dataset which is deleted from the system, is irrevocably lost. All data entry forms, and sectrion forms which may have been developed will also be removed. Ensure that you have made a backup of your database before deleting any dataset in case you need to restore it at some point in time.

  • Information: Display some informative information about the dataset, including the number of data elements, the frequency, and which data entry form has been assigned to the dataset.

5.2. Data Entry Forms

Once you have assigned a dataset to an orgunit that dataset will be made available in Data Entry (under Services) for the orgunits you have assigned it to. A default data entry form will then be shown, which is simply a list of the data elements you belonging to the dataset together with a column for inputting the values. If your dataset contains data elements with a non-default categorycombination, such as age groups or gender then additional columns will be automatically generated in the default form based on the different options/dimensions.

If you use more than one dataelement category combination you will get multiple columns in the data entry form with different column headings for the options. In addition to the default list-based data entry form there are two more alternatives, the section-based form and the custom form.

5.2.1. Section forms

Section forms allow for a bit more flexibility when it comes to using tabular forms and are quick and simple to design. Often your data entry form will need multiple tables with subheadings, and sometimes you need to disable (grey out) a few fields in the table, both of these functions are supported in section forms. This function can be access by choosing Maintenance->Dataset Section.

5.2.2. Adding a new section form

Section forms are separated automatically by data element category combinations, which produce a spreadsheet like data entry form for each section.

When designing a section form the procedure is as follows:

  1. Set up your dataset as described in Section 5.1, “Datasets”

  2. Open the DataSet Section window (from right side menu under Datasets) and add your sections one by one. To add a new section to a section form, first choose the dataset from the "Select dataset" combo box. Then choose the specific category combo and press "Add new". You can now add data elements from the "Available data element" list on the left to the "Selected data elements" list on the right. Data elements can be sorted within the section with the use of the "Move up" and "Move down" buttons. Be sure to press "Save" once you have finished.

    [Note]Note

    You can only use one data element category combination per section.

  3. You may need to control how the data element sections are displayed on the final form. In Dataset Section management, select the dataset from the "Dataset" drop-down box, then leave [All] in the "Select Category Combo" drop-down. Click on "Sort section" to sort the order of appearance of your sections in the data entry form.

  4. In Data Entry you can now start using the Section form (should appear automatically when sections are available for the selected dataset). Datasets which have section forms will automatically display the section form.

  5. Certain data elements may need to be disabled for data entry. Clicking on the "Section grey field management" icon will allow you to disable specific data element category options as seen below. Pressing the "Disable" button will prevent data from being entered into this specific data element/category option during data entry. Be sure to press "Done" to save your changes.

A sample section form is displayed in the next figure. Notice how each data element category has been separated into a separate section, and a data entry table has been automatically generated by the system. Use of section forms in combination with data element categories can drastically reduce the amount of time which is required to create data entry forms for datasets.

5.2.3. Custom Forms

When the form you want to design is to complicated for the default or section forms then your last option is to use a custom form. This takes more time, but gives you full flexibility in term of the design. DHIS2 uses a built-in HTML editor (FcK Editor) for the form designer and you can either design the form in the UI or paste in your HTML directly (using the Source window in the editor). A complete reference for use of the editor can be found here.

One of the big advantages of custom forms, is that they can be created to mimic existing paper aggregation forms. This makes data entry much easier for users, and should reduce the number of data elements which are incorrectly entered, as they are more easily identifiable when entering data from a paper form.

Once a custom form has been added to a dataset it will be available in data entry and used automatically.

[Note]Note

Custom forms are preferentially displayed over section forms. If a dataset has both a section form and a custom form, the custom form will be displayed during data entry. Users will not be able to select which method they wish to input data, so be sure that your custom form contains all data elements which may be required.

To add a custom form design to a dataset then first locate your dataset in the Dataset Management window and click on the Design data entry form icon under Operations (the fifth icon), see the mouse-over text to be sure.

First provide a Name for the form. There are a few important buttons in the Editor that you must pay special attention to. The blue monitor icon is the full screen mode on/off button, which can be very useful. The there is a Source button that shows the HTML code for your form.

If you already have the HTML for your form then you should start by pasting it in here. Click on Source again to go back to preview/non-HTML mode. Then there is an icon in the top right corner with a + sign on it, this will open a list of available data elements to add to your form, the Data Element Selector window.

All the input fields need to have a link to a data element or indicator. To add new data elements to the form, double-click them from the data element/indicator box as shown below. You can also select a data element/indicator and press the "+Insert" button. You can switch between either data elements or indicators by pressing the respective buttons.

You can to intermediary saving by clicking on the Save button, and this will not close the window. It is recommended to save often to ensure you do not loose your work.

When you are done or want to test your form in data entry click on <Save and close>.

5.2.4. Data set assignment editor

The data set assignment editor is a tool for adding and removing many data sets to organisation units in batch style. Start by selecting an organisation unit from the selection tree. In the area below the tree a grid will be displayed showing all data sets as columns and the child organisation units as rows.

From the grid you can now assign or unassign data sets simply by clicking on of the corresponding icons in the grid. If you want to assign or unassign an organisation unit to all data sets you can check or uncheck the checkbox next to the organisation unit. Your changes will automatically be saved.

Chapter 6. User management

DHIS2 allows for multiple users to access the system simultaneously, each with a define set of permissions. These permissions can be finely tuned so that certain users can only enter data, while others may generate reports. Multiple user roles can be created, each with their own set of permissions, and then assigned to users which grant them certain privileges within the system. This chapter describes how to manage users and user roles.

6.1. Creating new users and roles

This section will describe how to add new users and manage existing users to the DHIS2 application. You can create as many user names as you need. Each user can be assigned certain privileges, and can be assigned to certain organisation units for which they will be enabled to enter data on behalf of. To access the user module, choose "Maintenance->Users" from the main menu.

6.1.1. User maintenance

User names already registered will appear as a list as seen in the screen shot below.

You can search for specific user names in the user list by entering the name in the ‘filter by user name’ field as shown above.

6.1.2. User role management

As part of creating a user name you are required to define the user role. Do so by clicking on the ‘user role’ appearing on the left side of the displayed screen. This will lead you to the Role Management page where you will have to click on Add new to create a new role.

The following screen will open and here in the first text box you need to give Name of the Role such as Super User, Admin User, etc. The second text box called ‘Description’ gives more information about the type of User Role that is being created for e.g. State Admin User, District Data Entry.

Next you will specify the particular data set(s) that are to be made available to the particular role. You will also need to specify the type of ‘authority’ to be given to the particular user. For each of the three options namely Datasets, Reports and Authorities user can select multiple options from the scroll down menu provided against each field. A user can choose multiple options either by moving them one-by-one.

In order for particular users to be able to enter data, you must add them to both a dataset as well as an organisational unit level. You can also select multiple datasets individually by pressing the Ctrl key on the keyboard and clicking on individual datasets.

Finally when you have entered the required fields click on Save which is located on the lower part of the displayed screen. The desired user role and related authorisation will be saved to the database, and can then be assigned to a particular user.

6.1.3. User management

Under particular user role there can be more than one user. To add new users go to the User options under the Maintenance module.

To add a new user, just follow these steps:

  • Click on the Add New button.

  • Enter New User details like User name, Password, Confirm password, Surname, First name and Email in new user’s option tabs.

  • Click on Add button for confirmation of new user details and follow the user error while creation of new user.

  • The recently created new user can be seen in main’ User management Screen

  • You can edit (like password, surname….etc) and delete the details of new/old users by selecting corresponding User’s Edit and Delete Buttons.

  • Click on Save tab after editing all details of a particular selected user.

  • Users must be assigned to at least one organisational unit. Users are able to have access to all children of the organisational unit(s) which have been assigned to them. For instance, if a user has been assigned to "District X" which has several facilities contained in the district, the user would have access to the district's data, as well as all of the facilities contained within the district.

    In order for users to be able to enter data for specific organisational units, they must be assigned these units. If a user is responsible for entering data for all facilities for a given district, they should typically be assigned the district, and all of the facilities contained within the district.

6.1.4. User group management

User groups allow you to send notifications to multiple users at the same time. Simply click "Add new" from the "User group" screen, provide a name for the group, and add the desired users from the "Available users" list to the "Group members" list.

6.1.5. User by organisation unit

The "User by organisation unit" function allows you see which users have been assigned to a particular organisation unit. Simply select the organisation unit from the tree on the left, and a list of users which have been assigned to this particular organisation unit will be displayed

Chapter 7. Dashboards

Dashboards are intended to provide quick access to individual users to the data which has been stored in DHIS2. Dashboards consist of several sections, some of which provide links to reports or mapview which have already been defined. Other sections of the dashboard allow users to add charts which have been defined and made available through the charting module.

7.1. Setting up the dashboard

The dashboard is divided into two main sections. The right-side pane (denoted as A in the screenshot below) can be used to contain links to reports, documents (static reports), report tables, map views, and an RSS Health feed. The left-side zone (denoted as B in the screen shot) can be used to contain up to six separate charts which have been previously created in the charting reporting module.

In this screen shot, the dashboard has already been populated with a number of reports and mapviews. Simply clicking on one of the blue links will bring you automatically to the report or map view. Clicking on one of the charts will display a larger chart, which you can save as an image, and include in a report or other document.

You can redefine the structure of the dashboard by clearing the each of the windows by clicking the "Clear" link. By clicking "Insert" again, you can then select a new chart to appear in the window.

All reports, documents, report tables and charts can be added to the list of available options by clicking on the "Add to dashboard" icon in each of the respective modules. Please refer to the sections to each of the sections in this manual for more detailed instructions. Once you have added the object to the list of available objects, you can"Insert" it on the dashboard.

[Note]Note

Dashboard are configured for each individual user.

7.2. Messages and feedback

DHIS2 has certain functions to facilitate communication between different users and user groups. This type of communication is important to facilitate feedback regarding data quality, timeliness of submissions, or to simply answer a question which a particular user may have.

Feedback messages are sent to a particular group of users and can be sent by all users who have access to the dashboard module. In order to enable the receipt of feedback messages sent from the dashboard, you must set the system setting "Feedback recipients" which is available from the Maintenance->System settings dialog. Be sure to define a user group (e.g "Feedback recipients") with all of the users who should receive feedback messages. Refer to the section in this manual on "User groups" for more information of how to do this. Once the "Feedback recipients" user group has been defined, each time a feedback message is sent, it will appear as a message in each of the "Feedback recipients" message queue within DHIS2. Note that messages will not be sent to users email addresses, but will only appear within the DHIS2 application.

To send a new feedback message, simply select "Write feedback" from the dashboard. Provide a subject and text in the respective text boxes. The message will appear in all of the specified users message queue.

Messages can be sent to specific groups of users who have been assigned to particular organisation units. To write a new message, simply click "Messages" from the dashboard screen and then press the "Write message" button.. Select an organisation unit (or group of organisation units) from the "Recipients" organisational unit tree. Provide a Subject and Text. To send the message, press the "Send" button. You can discard the message by pressing the "Discard" button as seen in the screenshot below.

To read messages which have been sent to you, select "Messages" from the "Dashboard" . You messages will be displayed as a list. Click the desired message to read all of the messages in this particular conversation.

Chapter 8. Data entry

8.1. Learning Objectives

After reading this chapter you will be able to understand:

  • How to select the right data entry form

  • How to enter data

  • How to do data validation

8.2. Data entry with DHIS 2

To open the data entry window click on the services tab displayed in the main menu. A drop down menu will appear listing the services provided by DHIS 2. Click on the Data Entry option.

The data entry module is where data is manually registered in the DHIS 2 database. Data is registered for an organisation unit, a period, and a set of data elements (data set) at a time. A data set often corresponds to a paper-based data collection tool.

8.2.1. Selecting the data entry form

To start entering data the first step is to open the correct form. Follow these steps:

  1. Locate the orgunit you want to register data for in the tree menu to the left. Expand and close branches by clicking on the +/- symbols. A quick way to find an orgunit is to use the search box just above the tree (the green symbol), but you need to write in the full name to get a match.

  2. Select a data set from the dropdown list of data sets available to your selected orgunit.

  3. Select a period to register data for. The available periods are controlled by the dataset's period type (reporting frequency). You can jump a year back or forward by using the arrows above the period.

By now you should see the data entry form.

Depending on how the data entry form has been implemented, you will see three different types of foms: Default forms, section forms, or custom forms. If a custom form exists, it will be displayed, followed in order of precedence by a section form, and finally a default form.

8.2.2. Entering data

Simply start entering data by clicking inside the first field and type in the value. Move to the next field using the Tab button. Shift+Tab will take you back one step. The values are saved immediately and do not require any save/finished button click. A green field indicates that the value has been saved in the system (on the server). On a slow connection it might take some time before the values are saved.

Input validation: If you type in an invalid value, e.g. a character in a field that only accepts numeric values you will get a pop-up that explains the problem and the field will be coloured yellow (not saved) until you have corrected the value. If you have defined a min/max range for the field (data element+organisation unit combination) a pop-up message will notify you when the value is out of range, and the value will remain unsaved until you have changed the value (or updated the range and then re-entered the value).

Disabled fields: If a field is disabled (grey) it means that the field should not be filled. The cursor will automatically jump to the next open field.

Data history: By double-clicking on any input field in the form a data history window opens showing the last 12 values registered for the current field (organisation unit+data element+categoryoptioncombo) in a bar chart. This window also shows the min and max range and allows for adjusting the range for the specific organisation unit and data element combination.

Follow Up: In the data history window there is also a feature to tag or star a value. E.g. a suspicious value that needs further investigation can be kept in the system, but marked for Follow-Up. In the Data Quality module you can run a Follow-Up analysis and view all values marked for Follow-Up, and then later edit the values if proved incorrect.

8.2.3. Validating data in the form

When all the available values for the form has been filled in you can run a validation check on the data in the form. Click on the "Run Validation" button in the top right corner. All validation rules which involves data elements in the current form (dataset) will be run against the new data. Upon completion you will be presented with a list of violations or a simply a message that says "The data entry screen successfully passed validation". See the Data Quality chapter for information on how to define such validation rules.

When you have corrected any erroneous values and are done with the form the recommended practice is to click on the Complete button below the form to register the form as complete. This information is used when generating completeness reports for district, county, province or the national level.

8.2.4. Offline data entry

The data entry module will function even if during data entry the Internet connectivity is not stable. In order to utilize this functionality, you must login to the server while the Internet is functional, but if during data entry, the Internet link between your computer and the server becomes unstable, data can still be entered into the data entry form, saved to your local computer, and then pushed to the server once the Internet connectivity has been restored. Data can be entered and stored locally while being offline and uploaded to the central server when on-line. This means that the on-line deployment strategy will be more viable in areas with unstable Internet connectivity. The total bandwidth usage is greatly reduced since forms no longer are retrieved from the server for each rendering.

When the server is able to be reached through the Internet connection, a message is displayed at the top of the data entry screen below.

If the Internet connection should disconnect for some reason during the data entry process, this will be detected by the application, and you will be informed that your data will be stored locally.

Data entry can proceed as normal. Once you have entered all of the necessary data, and the application detects that the server is back on-line, you will be informed that you have data which needs to be synchronized with the server.

Once the data has successfully synchronized with the server, you will receive a confirmation message that the data has been successfully uploaded to the server.

Chapter 9. Using Data Quality functionality

The data quality module provides means to improve the accuracy and reliability of the data in the system. This can be done through validation rules and various statistical checks. All the functionality described below can be accessed from the left side menu in the Services->Data Quality module.

9.1. Overview of data quality checks

Ensuring data quality is a key concern in building an effective HMIS. Data quality has different dimensions including:

  • Correctness: Data should be within the normal range for data collected at that facility. There should be no gross discrepancies when compared with data from related data elements.

  • Completeness: Data for all data elements for all health facilities should have been submitted.

  • Consistency: Data should be consistent with data entered during earlier months and years while allowing for changes with reorganization, increased work load, etc. and consistent with other similar facilities.

  • Timeliness: All data from all reporting orgunits should be submitted at the appointed time.

9.2. Data quality checks

Data quality checking can be done through various means, including:

  1. At point of data entry, the software can check the data entered to see if it falls within the min-max ranges of that data element (based on all previous data registered).

  2. Defining various validation rules, which can be run once the user has finished data entry. The user can also check the entered data for a particular period and Organization Unit(s) against the validation rules, and display the violations for these validation rules.

  3. Analysis of data sets, ie. examining gaps in data.

  4. Data triangulation which is comparing the same data or indicator from different sources.

9.3. Running Validation Rule Analysis

You can access Validation Rule Analysis from the Services->Data Quality menu.

A validation rule is based on an expression which defines a relationship between a number of data elements. The expression has a left side and a right side and an operator which defines whether the former must be less than, equal to or greater than the latter. The expression forms a condition which should assert that certain logical criteria are met. For instance, a validation rule could assert that the total number of vaccines given to infants is less than or equal to the total number of infants.

The validation rule analysis function will test validation rules against the data registered in the system. Validation violations will be reported in cases where the condition defined through the validation rule expression is not met, ie. the condition is false.

Selecting what data to validate:

First, enter a start date and an end date for which data should be included in the analysis. The date picker widget may be used to select dates.

Second, choose between including all validation rules or all validation rules from a single group.

Third, choose between including the selected organisation unit only or the selected organisation unit with all children in the analysis. Fourth, select the organisation unit. Finally, click validate.

Validation results:

The analysis process will run for a while depending on the amount of data that is being analysed. If there were no violations of the validation rules a message saying validation passed successfully is displayed.

If validation violations were found, they will be presented in a list. The organisation unit, period, left side description and value, operator, and right side value and description for each validation violation are displayed.

The show details icon can be clicked in order to get more information about a validation violation. This will open a popup screen that provides information about the data elements included in the validation rules and their corresponding data values. This information can be used in order to fix incorrect data.

The validation violations can be exported to a PDF document by clicking on the Download as PDF button, and to a Microsoft Excel workbook by clicking on the Download as Excel button.

9.4. Std Dev Outlier Analysis

You can access Outlier analysis from the Services->Data Quality menu.

The standard deviation based outlier analysis provides a mechanism for revealing values that are numerically distant from the rest of the data. Outliers can occur by chance, but they often indicate a measurement error or a heavy-tailed distribution (leading to very high numbers). In the former case one wishes to discard them while in the latter case one should be cautios in using tools or interpretations that assume a normal distribution. The analysis is based on the standard normal distribution.

Select what data to analyse:

First, select the from and to date for the data to include in the analysis.

Second, select the data set from which to pick data elements from.

Third, select all or some of the data elements in the data set by double-clicking or marking them and clicking the add/remove buttons.

Fourth, select the parent organisation unit to use. All children of the organisation unit will be included.

Fifth, select the number of standard deviations. This refers to the number of standard devations the data is allowed to deviate from the mean before it is classified as an outlier.

Analysis result:

The potential outlier values discovered will be presented in a list after the analysis process is finished. The data element, organisation unit, period, minimum value, actual value, and maximum value will be displayed for each outlier. The minimum and maximum values refer to the border values derived from the number of standard deviations selected for the analysis.

Each outlier value can be modified directly in the analysis result page. The value can be modified by clicking inside the corresponding field in the value column, entering a value and then navigate away from that field either by clicking tab or anywhere outside the field. The system will provide an alert if the value is still outside the defined minimum and maximum values, but the value will saved in any case. The field will have a red background color if the value is outside the range, and a green if inside.

Each outlier value can be marked for further follow-up by clicking the star icon.

9.5. Min-Max Outlier Analysis

The min-max value based outlier analysis provides a mechanism for revealing values that are outside the pre-defined minimum and maximum values. Minimum and maximum values can be custom defined or automatically defined by the system in the data administration module. See the section about Std dev outlier analysis for further details on usage.

9.6. Gap Analysis

The gap analysis provides a mechanism for revealing gaps in the data. A gap exists for a specific data element and organisation unit. A gap is a period with preceding and succeeding periods which have registered data values, but without registered data values itself. Such a gap might indicate a data capture error or omission and could be further investigated. See the section about Std dev outlier analysis for further details on usage.

9.7. Follow-Up Analysis

The follow-up analysis function will list all data values which are marked for follup-up. A data value can be marked for follow-up in the data entry module and in the other validation analysis variants in this module.

Chapter 10. Setting up Data Quality functionality

The data quality module provides means to improve the quality of the data in the system. This can be done through validation rules and various statistical checks.

10.1. Learning Objectives

After reading this module you will be able to understand:

  1. What is data quality and its importance for HMIS.

  2. How to do data quality check at point of data entry.

  3. How to create data validation rules.

  4. How to carry out data triangulation.

  5. How to analyze data status.

10.2. Overview of data quality check

Ensuring data quality is a key concern in building an effective HMIS. Data quality has different dimensions including:

  • Correctness: Data should be within the normal range for data collected at that facility. There should be no gross discrepancies when compared with data from related data elements.

  • Completeness: Data for all data elements for all health facilities/blocks/Taluka/districts should have been submitted.

  • Consistency: Data should be consistent with data entered during earlier months and years while allowing for changes with reorganization, increased work load, etc. and consistent with other similar facilities.

  • Timeliness: All data from all health facilities/blocks/Taluka/districts should be submitted at the appointed time.

10.3. Data quality checks

Data quality checking can be done through various means, including:

  1. At point of data entry, the software can check the data entered to see if it falls within the min-max ranges of that data element over the last six months or as defined by the user.

  2. Defining various validation rules, which can be run once the user has finished data entry. The user can also check the entered data for a particular period and Organization Unit(s) against the validation rules, and display the violations for these validation rules.

  3. Analysis of data sets, ie. examining gaps in data.

  4. Data triangulation which is comparing the same data or indicator from different sources.

10.4. Data quality check at the point of data entry

Data quality can be checked at the point of data entry through setting the minimum and maximum value range for each element manually or generating the min-max values using the DHIS 2 if there is historical data available for that data element.

10.4.1. Setting the minimum and maximum value range manually

If you are using the default entry screen click on the element for which you want to set the min-max value. A pop-up window will appear in which you can enter the vaules. On subsequent data entry if the value entered does not fall within the set min-max range the text box will change colour to red. The user will also get a pop-up as shown below. This change in colour is a prompt to check the data entered and make necessary correction. On the data entry screen the users also have the option to add a comment on how the discrepant figure might be explained (if required). This you can do by using the drop down menu of the ‘comment’ box. In case you are using the custom data entry screen which is displayed when you deselect the ‘default data entry form’ option on the top right corner of the screen. In this case the minimum and maximum values can be added by double-clicking on the data entry box instead of the data element.

10.4.2. Generated min-max values

It is possible to generate the min-max value, element-wise, using the DHIS2. In such case you merely need to click on the ‘Generate min-max’ button near the upper right corner. In case of default data entry screen the min and max values, when generated, will appear on the left and right side of the data entry box. In case you deselect the default data entry form the generated values will appear on the top right end of the screen.

10.5. Validation Rule

This module provides management of validation rules. A validation rule is based on an expression which defines a relationship between a number of data elements. The expression has a left side and a right side and an operator which defines whether the former must be less than, equal to or greater than the latter. The expression forms a condition which should assert that certain logical criterias are met. For instance, a validation rule could assert that the total number of vaccines given to infants is less than or equal to the total number of infants.

To add a validation rule, click the add new button. First, provide a descriptive name for the validation rule. The name must be unique among the validation rules. Second, provide a description for the validation rule. Third, select an operator. The operator options are equal, not equal, greater than, greater than or equal, less than, less than or equal to. Then define the left side and right side of the validation rule expression. First, provde a description for the expression. Second, build the expression with the expression builder. The expression is mathematical and contain data elements as well as integers and mathematical operators. Data elements can be included by double-clicking one in the available data elements list to the righ. Alternatively one can select a data element and click the insert button. Mathematical operators can be included by clicking the corresponding button under the expression builder area. Save the expression by clicking save, then save the validation rule by clicking save.

To edit a validation rule, click the editicon next to the relevant validation rule in the list. Then follow the same producedures as above.

To delete a validation rule, click the deleteicon next to the relevant validation rule in the list.

To view validation rule details, click the view detailsicon next to the relevant validation rule in the list.

10.6. Validation Rule Group

A validation rule group provides a mechanism for classifying related data elements. Another advantate of using validation rule grops is that it can later be run separately, contrary to running all validation rules.

Chapter 11. Indicators

When the ‘Data Elements and Indicators’ options is chosen from the main Maintenance menu, the following screen appears:

From the left side menu or by scrolling down the central area you can access the various sections on Indicators;

Indicator, Indicator Type, Indicator Group, Indicator Group Editor, and Indicator Group Set.

11.1. Indicator maintenance

Indicator maintenance functions essentially the same as each of the respective sections in the previous section on data elements. The basic operations will be described in this section, but the reader should refer to the corresponding sections above for detailed instructions.

11.1.1. Indicators

Indicators are composed of multiple data elements, and typically consist of a numerator and denominator. Indicators are never entered in DHIS2, but are derived from combinations of data elements and factors. Indicators are used to calculate coverage rates, incidence and other values are are a result of data element values that have been entered into the system.

To access the Indicator maintains page, press Maintenance -> Data Element and Indicators -> Indicator from the main DHIS2 menu. Similar to data elements, you can add, delete, modify and view extra information about the indicators in the system.

Indicators can be filtered by entering the name or a part of the indicator name in the "Filter by name" field. Similar to data elements, indicators can be added by pressing the "Add new" button. Other operations available from this menu are as follows.

  • Existing indicators can be edited.

  • Translate an existing indicator.

  • Delete an existing indicator.

  • Get detailed information about this indicator.

To add a new indicator, click the "Add new" button. The following screen is displayed.

Each of the fields marked with an asterisk are compulsory. A description of each field is provided below.

  • Name: The full name of the indicator, such as "Incidence of confirmed malaria cases per 1000 population"

  • Short name: An abbreviated name of the indicator such as "Inc conf. malaria per 1000 pop". The short name must be less than or equal to 25 characters, including spaces.

  • Alternative name: An additional field for a possible alternative name of the indicator.

  • Code: In many countries, indicators are often assigned a particular code. This code can be entered here.

  • Description: A brief, informative description of the indicator and how it is calculated can be entered here.

  • Annualized: Determines whether or not an annualization factor is applied during the calculation of the indicator. Typically, annualized indicator's numerator are multiplied by a factor of 12, and the denominator is for instance a yearly population figure. This allows for monthly coverage values to be calculated with yearly population figures.

  • Type: This field will determine a factor that will automatically be applied during the calculation of the indicator. Possible choices are determined by the Indicator Types (described below). For instance, a "Percent" indicator will automatically be multiplied by a factor of 100 when exported to the data mart, so that it will display as a percentage.

  • URL: Can be used as a link to an indicator registry, where a full metadata description of the indicator can be made available.

To define the numerator and denominator, simply press the respective button, and the following dialogue will be displayed.

Essentially, an indicator is a formula that can be composed of multiple data elements, constant factors, and mathematical operators. In order to define a new indicator proceed with the following steps.

  1. Enter at least the required fields (Name and short name) from the indicator maintenance screen.

  2. Next, press "Edit numerator" from the main indicator maintenance screen. This will provide a dialog where you can define the actual formula of the indicator's numerator..

  3. A description of the numerator/denominator must be provided in the "Description field". This should provide a clear description of

  4. Define the formula of the indicator by selecting the data elements that should compose the numerator from the "Data elements" field. Simply select the data element, and double click it. It will now appear in the formula. You formula must be mathematically valid, including the proper use of parentheses when necessary. You can double click on each of the mathematical operator buttons below the indicator formula definition to add them to your formula.

  5. Click the Save button to save all changes to the numerator. Click cancel to discard any changes that you have made.

  6. Follow the same procedure in order to define the denominator.

11.1.2. Indicator types

Indicator types simply define a factor that will be applied during aggregation. Indicator values that are calculate during a data mart export or report table generation process will appear properly formatted, and will therefore not require an additional multiplier (e.g. 100 in the case of percents) for the values to appear correctly formatted.

The indicator type maintenance panel has all of the same functions (Add new, Edit, Translate, Delete, and Information) as the Indicator maintenance section.

There are only two fields that need to be filled-in to create an indicator type, Name and Factor, as seen below. Name refers to the Indicator type (e.g. Per cent, Per thousand, Per ten thousand, etc). The factor is the numeric factor that will be applied during the calculation of the indicator.

[Note]Note

As of version 2.4 of DHIS2, the "Calculated data element" object has been deprecated. Instead, a calculated data element can be created by creating an indicator type with a factor of "1" and by setting the "Number" option to "Yes". The effect of setting the "Number" option to "Yes" will be that the indicator will effectively not have a denominator. You will therefore only be able to define a numerator, which will serve as the formula of the calculated data element.

11.1.3. Indicator groups

Indicator groups function essentially the same as data element groups. Multiple indicators can be assigned to a group for easy filtering and analysis. To assign indicators to groups, simple press Maintenance->Data elements and indicators->Indicator groups. See the section on Data element groups for detailed instructions of how to use this module.

11.1.4. Indicator group editor

The indicator group editor module functions essentially the same as the data element group editor module, except on indicators. You can easily rearrange the groups that indicators belong to with this module. To access it, choose To assign indicators to groups, simple press Maintenance->Data elements and indicators->Indicator group editor from the main menu. See the section on Data element group editor for further instructions.

11.1.5. Indicator group sets

Similar to data element group sets, indicator group sets serve to create combined groups of similar indicators. For instance, you might have a group of indicators called "Malaria" and "Leishmaniasis". Both of these groups could be combined into a group set called "Vector-borne diseases". Indicator groups sets are used during analysis of data to combine similar themes of indicators. To access this module choose Maintenance->Data elements and indicators->Indicator group sets from the main menu. The following dialogue will appear.

Supply a name for the indicator group set, and then move the desired members from the "Available Indicator Groups" to the "Group members". Click "Add" to save your changes and "Cancel" to discard any changes.

Chapter 12. Using reporting functionality

12.1. Reporting functionality in DHIS 2

The reporting module in DHIS 2 provides a range of reporting alternatives, and this section will explain how to use them to view and analyse data. Another section explains how to configure and set up the various reporting tools.

Standard reports: Standard reports are built on report tables, but are more advanced in its design allowing for more cosmetics and styles. These reports can also combine multiple tables and charts in the same report and be made available as one-click reports that are very easy to use. These reports can be downloaded as PDF files which makes them ideal for printing as well as sharing offline.

Dataset reports: Dataset reports are simply a printer friendly way to look at the data entry forms with either raw or aggregated data (over time or place). The design used in data entry will be used also in the data set reports. This will work only for data sets that has a custom data entry form set up.

Dashboard: The fastest way to view your data. The dashboard can display up to four updated charts as well as shortcuts to your favourite reports, report tables, and map views. Each user can configure a personal dashboard.

Data Visualizer: Do flexible visualizations of your data as charts and data tables. Any numbe of indicators and data elements can be included. Several chart types are available, such as column, stacked column, line, area and pie charts. The charts can be saved in order to be easily retrieved later and can also be put on your personal dashboard. Charts can be downloaded as image and PDF files to your local computer.

Report tables: These are very configurable table outputs of your data, either showing raw or aggregated data, as well as indicator data. These tables are used as either a data source for more advanced reports, for export to external systems, or as a crude report itself, and are exportable to pdf, excel, csv and jasper design files. These tables represent a very dynamic, flexible and quick way to look at the data. Report tables can be set up with parameters to make them reusable over time and place.

Orgunit distribution reports: These reports are generated off the orgunit group set information and can show what types (and how many of each type) of health facilities that are located in a given area (any level in the hierarchy). These reports are automatically generated and display the information in both tables and charts, and downloads in pdf, excel, and csv are available.

Reporting rate summary: These reports provide a nice overview of how many facilities that have submitted their data for a given dataset and period. Here you can get both the counts and the percentages showing the reporting rate for all or single data sets.

Excel pivot tables: Excel pivot tables represents a very powerful way to analyse your data and DHIS 2 links directly to the pivot tables so that all the data will be available and updated in your Excel file. This can be a very useful tool for users that prefer working with the data offline. To update your local pivot tables you need the myDatamart tool which connects to the online server and downloads the latest data. This update will typically take place once a month when new data is available, but do not require a constant internet connection like the other reporting tools (if you are connecting to an online DHIS 2 server).

Web-based pivot tables: The built in pivot table tool is a simple web-based tool to display indicator data by orgunit and period in a typical pivot table view and allows for some basic pivoting manipulations of the tables. It is a quick and easy way to look at many indicator values at the same time (by orgunit and/or period), but does not have the same functionality as the offline Excel pivot tables.

GIS: Present and analyse your data using thematic maps. You can view both data elements and indicators and given that you have coordinates for all your orgunits you can drill down the hierarchy and view maps for all levels from country polygons to facility points. See the separate chapter on GIS for more details. All the map information is built into DHIS 2 and all you need to do is to register coordinates for your organisation units and the maps will be available.

12.2. Using standard reports

You access the available reports from the Services drop-down menu, by selecting Reports. In the report menu in the left bar, click Standard Report. A list of all pre-defined reports will appear in the main window.

You run/view a report by clicking on the white and green arrow next to the report you want. You will then see a report parameter window where you must fill in the values needed for orgunit and/or reporting month, depending on what has been defined in the underlying report table(s). Click on "Get Report" when you are ready. The report will wither apper directly in your browser or be available as a .pdf file for download, depending on your browser settings for handling pdf files. You can save the file and keep it locally on your computer for later use.

12.3. Using report tables

Report tables is a simple-to-use tool for creating tabular analysis. To run a report table first navigate to the list of available report tables in Services->Reports->Report Tables and the click on the Green and white arrow (the first symbol in the operations list) next to the report table you want to view.

Report parameters: Most report tables have parameters, which means that you can filter which orgunits and/or periods you want in the report. This makes the reports much more reusable. When you run the report table a Report parameter window will open and ask the user to input values for the selected parameters. The possible parameters are Reporting Month and Organisation Unit, and either one of these or both will show in the window. After selecting the values click on the Get Report button.

Export/view options: When the report table is ready it will be displayed in a html view. The report table can be exported to pdf (for better printing and easier saving), excel, csv, and also to a standard report format (Jasper) with a nicer table and a chart shown in pdf, or as a jasper design file for further improvements and changes to the report design before uploading it as a standard report (see the Creating standard reports section).

12.4. Using dataset reports

Dataset reports are printer friendly views of the data entry screen filled with either raw or aggregated data. These are only available for data sets that have custom data entry forms and not for default or section forms.

You can access data set reports from the Report menu under Services.

A Criteria window will appear where you fill in the details for your report:

Dataset: The data set you want to display.

Reporting period: The actual period you want data for. This can be aggregated as well as raw periods. This means that you can ask for a quarterly or annual report even though the data set is collected monthly. A data set's period type (collection frequency) is defined in data set maintenance. First select the period type (Monthly, Quarterly, Yearly etc.) in the drop down next to Prev and Next buttons, and then select one of the available periods from the dropdown list below. Use Prev and Next to jump one year back or forward.

Use data for selected unit only: Use this option if you want a report for an orgunit that has children, but only want the data collected directly for this unit and not the data collected by its children. If you want a typical aggregated report for an orgunit you do not want to tick this option.

Reporting Organisation unit: Here you select the orgunit you want the report for. This can be at any level in the hierarchy as the data will be aggregated up to this level automatically (if you do not tick the option above).

When you are done filling in the report criteria you click on "Generate". The report will appear in html view in a printer-friendly format. Use print and save as functions in the browser to print or save (as html) the report.

12.5. Using resources

The resource tool allows you to upload both files from your local computer to the DHIS server and to add links to other resources on the Internet through URLs. If you want to share the direct link to the DHIS resource you can right clik on the "view resource" button and copy the link address.

The create a resource click on the "Add new" button. Enter a name for the resource, then choose between uploading a file or external URL. If you chose file upload click "Choose file" and select your file your local computer. If you chose URL enter the link to the resource on the Internet. Then click "Save".

12.6. Using data visualizer

The data visualizer module can be accessed under "Services" in the top menu. See the chapter called "Using data visualizer" for a thorough explanation of this module.

12.7. Using the dashboard

The dashboard is your first view into the data every time you log on to the system. Every user has its own dashboard, and a dashboard consists of 4 chart areas to the right and 3 short cut areas to the left.

Customise shortcut areas: Each of the three short cut areas can hold a list of items from one of the following objects; Reports (standard), Documents, Data mart exports, Report tables, Map views, RSS Health. To add a new object type to a shortcut area click on the Insert link just above the area. Then to populate the list you need to add items one by one from the Services->Reports menus. From the various lists of reports, report tables, charts etc. you can add an item by clicking on the pie chart icon next to the item you want to add to the dashboard.

E.g. to add your three favourite standard reports to the dashboard, first Insert Reports to one of the shortcut areas in the dashboard, then go to Services->Reports and click on Standard reports. From the list of standard reports you locate the reports you want and click on the pie chart icon next to each of the reports you want to add to the dashboard. When you go back to the dashboard you will see the three reports listed in the shortcut area where you inserted Reports.

Use the Clear link above the shortcut area to empty an area. The Close link closes the insert menu without inserting a new object type.

Customise chart areas: There are four chart areas. To insert a chart simply click on insert and click on one of the charts in the list. Use Close to close the list without adding a new chart, and use Clear to empty a chart area. These charts will be updated every time you open the dashboard, will automatically show data for the orgunit assigned to the current user, and will update the data when new periods are available.

12.8. Using reporting rate summary

Access the reporting rate summary from the Services->Reports menu. Reporting rate summaries will show how many datasets (forms) that have been submitted by organisation unit and period. You an use one of three different methods to calculate completeness; 1) based on complete button in data entry, 2) based on a set of defined compulsory data elements, or 3) based on the total registered data values for a dataset.

To run the report do the following:

Select an orgunit from the tree.

Select one of the completeness methods.

Select all or one dataset (All will give you a report with all datasets for the seelcted orgunit. One dataset will give you a report with completeness for all the children of the selected orgunit.

Select a period type and a period from the list of available periods for that period type. Move back/forward one year by using the Prev/Next buttons.

Then the report will be shown automatically.

Change any of the parameters above and the report will be updated automatically.

12.9. Using organisation unit distribution reports

You can access the Orgunit Distribution reports from the left side menu in the Services->Reports module.

Orgunit distribution reports are reports that show how the orgunits are distributed on various properties like type and ownership, and by geographical areas.

The result can be presented in a table-based report or in a chart.

Running a report:

To run a report first select an orgunit in the upper left side orgunit tree. The report will be based on orgunits located under the selected orgunit. The select the orgunit group set that you want to use, typically these are Type, Ownership, Rural/Urban, but can be any user-defined orgunit group set. The you can click on either Get Report to get the table-based presentation or Get chart to get the same result in a chart.

12.10. Using web pivot table

The web pivot table is a tool for displaying and pivoting indicator and data element data in an easy way. From the open data selection box start by selecting data type which can be data elements or indicators. Select the a group as a filter or leave it on "All". Select start date, end date and period type to indicate which periods you want to include in the pivot table. Continue by selecting an organisation unit from the selection tree. The childeren at the level below the selected organisationn unit will be included in the pivot table. Then click "Get data".

After loading a pivot table you will see that indicators (or data elements) will appear on top as columns, while periods and organiation units are combined as rows. If you want to pivot the table click on the "Pivot" button and select new dimensions. These dimensions will be displayed as columns in the table when clicking "Pivot".

In the pivot table you can click on any cell in order to show a menu. From this menu you can choose to visualize the relevant indicator, org unit and period as various chart variants.

To save the pivot table data to your local computer click the "Download as excel" button. The Excel workbook will show each period as a sheet.

12.11. Using data mart management

The data mart is a set of tables in the DHIS database which is used by all reporting and analysis tools to retrieve data from. The data mart is populated based on the collected data. This management user interface allows you to controll that process of converting collected data into aggregated data and write to the data mart.

The data mart management screen allows you to select period types, start date and end date which will control which periods are included in the data mart process. By default all data elements, indicators and organisation units will be included.

The data mart process might take a long time and heavily utilize the resources of your server so make sure you start such processes at a feasible time in production environments. Data mart processes can be scheduled as regular tasks in the data administration module.

Chapter 13. Setting up report functionality

13.1. Data sources for reporting

13.1.1. Types of data and aggregation

In the bigger picture of HIS terminology all data in DHIS are usually called aggregated as they are aggregates (e.g. monthly summaries) of medical records or some kind of service registers reported from the health facilities. Aggregation inside DHIS however, which is the topic here, is concerned with how the raw data captured in DHIS (through data entry or import)are further aggregated over time (e.g. from monthly to quarterly values) or up the organisational hierarchy (e.g. from facility to district values).

13.1.1.1. Terminology

  • Raw data refers to data that is registered into the DHIS 2 either through data entry or data import, and has not been manipulated by the DHIS aggregation process. All these data are stored in the table (or Java object if you prefer) called DataValue.

  • Aggregated data refers to data that has been aggregated by the DHIS 2, meaning it is no longer raw data, but some kind of aggregate of the raw data.

  • Indicator values can also be understood as aggregated data, but these are special in the way that they are calculated based on user defined formulas (factor * numerator/denominator). Indicator values are therefore processed data and not raw data, and are located in the aggregatedindicatorvalue table/object. Indicators are calculated at any level of the organisational hierarchy and these calculations are then based on the aggregated data values available at each level. A level attribute in the aggregateddatavalue table refers to the organisational level of the orgunit the value has been calculated for.

  • Period and Period type are used to specify the time dimension of the raw or aggregated values, and data can be aggregated from one period type to another, e.g from monthly to quarterly, or daily to monthly. Each data value has one period and that period has one period type. E.g data values for the periods Jan, Feb, and Mar 2009, all of the monthly period type can be aggregated together to an aggregated data value with the period Q1 2009 and period type Quarterly.

13.1.1.2. Basic rules of aggregation

13.1.1.2.1. What is added together

Data (raw) can be registered at any organisational level, e.g. at at national hospital at level 2, a health facility at level 5, or at a bigger PHC at level 4. This varies form country to country, but DHIS is flexible in allowing data entry or data import to take place at any level. This means that orgunits that themselves have children can register data, sometimes the same data elements as their children units. The basic rule of aggregation in DHIS 2 is that all raw data is aggregated together, meaning data registered at a facility on level 5 is added to the data registered for a PHC at level 4.

It is up to the user/system administrator/designer to make sure that no duplication of data entry is taking place and that e.g. data entered at level 4 are not about the same services/visits that are reported by orgunit children at level 5. NOTE that in some cases you want to have duplication of data in the system, but in a controlled manner. E.g. when you have two different sources of data for population estimates, both level 5 catchment population data and another population data source for level 4 based on census data (because sum of level 5 catchments is not always the same as level 4 census data). Then you can specify using advanced aggregation settings (see further down) that the system should e.g. not add level 5 population data to the level 4 population data, and that level 3,2,1 population data aggregates are only based on level 4 data and does not include level 5 data.

13.1.1.2.2. How data gets added together

How data is aggregated depends on the dimension of aggregation (see further down).

Along the orgunit level dimension data is always summed up, simply added together. Note that raw data is never percentages, and therefore can be summed together. Indicator values that can be percentages are treated differently (re-calculated at each level, never summed up).

Along the time dimension there are several possibilities, the two most common ways to aggregate are sum and average. The user can specify for each data element which method to use by setting the aggregation operator (see further down). Monthly service data are normally summed together over time, e.g. the number of vaccines given in a year is the sum of the vaccines given for each month of that year. For population, equipment, staff and other kind of what is often called semi-permanent data the average method is often the one to use, as, e.g. 'number of nurses' working at a facility in a year would not be the sum of the two numbers reported in the six-monthly staffing report, but rather the average of the two numbers. More details further down under 'aggregation operators'.

13.1.1.3. Dimensions of aggregation

13.1.1.3.1. Organisational units and levels

Organisational units are used to represent the 'where' dimension associated with data values. In DHIS 2, organisational units are arranged in a hierarchy, which typically corresponds to the hierarchical nature of the organisation or country. Organisational unit levels correspond to the distinct levels within the hierarchy. For instance, a country may be organized into provinces, then districts, then facilities, and then sub-centers. This organisational hierarchy would have five levels. Within each level, a number of organisational units would exist. During the aggregation process, data is aggregated from the lower organisational unit levels to higher levels. Depending on the aggregation operator, data may be 'summed' or 'averaged' within a given organisational unit level, to derive the aggregate total for all the organisational units that are contained within a higher level organisational unit level. For instance, if there are ten districts contained in a province and the aggregation operator for a given data element has been defined as 'SUM', the aggregate total for the province would be calculated as the sum of the values of the individual ten districts contained in that province.

13.1.1.3.2. Period

Periods are used to represent the 'when' dimension associated with data values. Data can easily be aggregated from weeks to months, from months to quarters, and from quarters to years. DHIS 2 uses known rules of how these different intervals are contained within other intervals (for instance Quarter 1 2010 is known to contain January 2010, February 2010 an March 2010) in order to aggregate data from smaller time intervals, e.g. weeks, into longer time intervals, e.g. months.

13.1.1.3.3. Data Elements and Categories

The data element dimension specifies 'what' is being recorded by a particular data value. Data element categories are actually degenerated dimensions of the data element dimension, and are used to disaggregate the data element dimension into finer categories. Data element categories, such as 'Age' and 'Gender', are used to record a particular data element, typically for different population groups. These categories can then be used to calculate the overall total for the category and the total of all categories.

13.1.1.4. Aggregation operators, methods for aggregation

13.1.1.4.1. Sum

The 'sum' operator simply calculates the sum of all data values that are contained within a particular aggregation matrix. For instance, if data is recorded on a monthly basis at the district level and is aggregated to provincial quarterly totals, all data contained in all districts for a given province and all weeks for the given quarter will be added together to obtain the aggregate total.

13.1.1.4.2. Average

When the average aggregation operator is selected, the unweighted average of all data values within a given aggregation matrix are calculated.

It is important to understand how DHIS 2 treats null values in the context of the average operator. It is fairly common for some organisational units not to submit data for certain data elements. In the context of the average operator, the average results from the number of data elemements that are actually present (therefore NOT NULL) within a given aggregation matrix. If there are 12 districts within a given province, but only 10 of these have submitted data, the average aggreate will result from these ten values that are actually present in the database, and will not take into account the missing values.

13.1.1.5. Advanced aggregation settings (aggregation levels)

13.1.1.5.1. Aggregation levels

The normal rule of the system is to aggregate all raw data together when moving up the organisational hierarchy, and the system assumes that data entry is not being duplicated by entering the same services provided to the same clients at both facility level and also entering an 'aggregated' (sum of all facilities) number at a higher level. This is to more easily facilitate aggregation when the same services are provided but to different clients/catchment populations at facilities on level 5 and a PHC (the parent of the same facilities) at level 4. In this way a facility at level 5 and a PHC at level 4 can share the same data elements and simply add together their numbers to provide the total of services provided in the geographical area.

Sometimes such an aggregation is not desired, simply because it would mean duplicating data about the same population. This is the case when you have two different sources of data for two different orgunit levels. E.g. catchment population for facilities can come from a different source than district populations and therefore the sum of the facility catchment populations do not match the district population provided by e.g. census data. If this is the case we would actually want duplicated data in the system so that each level can have as accurate numbers as possible, but then we do NOT want to aggregate these data sources together.

In the Data Element section you can edit data elements and for each of them specify how aggregation is done for each level. In the case described above we need to tell the system NOT to include facility data on population in any of the aggregations above that level, as the level above, in this case the districts have registered their population directly as raw data. The district population data should then be used at all levels above and including the district level, while facility level should use its own data.

13.1.1.5.2. How to edit data element aggregation

This is controlled through something called aggregation levels and at the end of the edit data element screen there is a tick-box called Aggregation Levels. If you tick that one you will see a list of aggregation levels, available and selected. Default is to have no aggregation levels defined, then all raw data in the hierarchy will be added together. To specify the rule described above, and given a hierarchy of Country, Province, District, Facility: select Facility and District as your aggregation levels. Basically you select where you have data. Selecting Facility means that Facilities will use data from facilities (given since this is the lowest level). Selecting District means that the District level raw data will be used when aggregating data for District level (hence no aggregation will take place at that level), and the facility data will not be part of the aggregated District values. When aggregating data at Province level the District level raw data will be used since this is the highest available aggregation level selected. Also for Country level aggregates the District raw data will be used. Just to repeat, if we had not specified that District level was an aggregation level, then the facility data and district data would have been added together and caused duplicate (double) population data for districts and all levels above.

13.1.2. Data mart

The purpose of the data mart is to provide pre-processed data to external data analysis and reporting tools. The data mart consists of two tables, aggregateddatavalues and aggregatedindicatorvalues in the DHIS 2 database. The values in the data mart are aggregated versions of the raw data found in the datavalue table as well as calculated indicator values. Aggregation can take place over time (e.g. from monthly data to aggregated quarterly values), or along the organisation unit hierarchy levels (e.g. from PHU data to aggregated district totals). The data mart can store all kinds of such aggregated values. The data mart is as such just a processed 'copy' of the data values and it can be emptied and regenerated at any time, and the tables are read only tables. The metadata in the two data mart tables are referenced by internal identifiers, such as dataelementid, organisationunitid which refer to the tables like dataelement and organisationunit, see 'How to make use of the data mart in external tools' for more on this.

13.1.2.1. The data mart export process

The DHIS2 Data Mart handles the aggregation of data across multiple dimensions (organisation unit hierarchy, orgunit group hierarchy, time, etc) and can be controlled through this interface. Select the organisation unit levels which should be aggregated, the start date and end date, and press "Start export". The data mart process will be executed in the background, and a full report of the export process will be updated regularly so that you can determine the state of the process. See the section on "Scheduling" in the data administration module for information on how this process can be triggered to run automatically.

13.1.2.1.1. Data element categories in the data mart

Each data value for a data element has a reference to a category option combo, which is a combination of the disaggregations for the data value, e.g. (male,<5y) or (In PHU, <1y). These disaggregations are exported as they are to the data mart, and no aggregation is done on this dimension. See the data elements section for more on data element categories and the resource tables section for more information on how to do aggregation on these categories.

13.1.2.1.2. Adding new data to an existing data mart

When you add new data to an existing data mart the new values will be appended to the existing so that the data mart grows for each new process if new selections (such as new periods) have been made. If any of the selected values are already in the data mart, then the old will be replaced by the newly generated values.

13.1.3. Resource tables

Resource tables provide additional information about the dimensions of the data in a format that is well suited for external tools to combine with the data mart tables. By joining the data mart with these resource tables one can easily aggregate along the data element category dimension or data element/indicator/organisation unit groups dimensions. E.g. by tagging all the data values with the category option male or female and provide this in a separate column 'gender' one can get subtotals of male and female based on data values that are collected for category option combinations like (male, <5) and (male,>5). See the Pivot Tables section for more examples of how these can be used. orgunitstructure is another important table in the database that helps to provide the hierarchy of orgunits together with the data. By joining the orgunitstructure table with the data mart tables you can get rows of data values with the full hierarchy, e.g. on the form: OU1, OU2, OU3, OU4, DataElement, Period, Value (Sierra Leone, Bo, Badija, Ngelehun CHC, BCG <1, Jan-10, 32) This format makes it much easier for e.g. pivot tables or other OLAP tools to aggregate data up the hierarchy.

13.1.4. Report tables

Report tables are defined, cross-tabulated reports which can be used as the basis of further reports, such as Excel Pivot Tables or simply downloaded as an Excel sheet. Report tables are intended to provide a specific view of data which is required, such as "Monthly National ANC Indicators". This report table might provide all ANC indicators for a country, aggregated by month for the entire country. This data could of course be retrieved from the main datamart, but report tables generally perform faster and present well defined views of data to users.

[Important]Important

It is therefore important to keep in mind that when the aggregation strategy of the system is set to "Batch", the data for each report table must also be present in the data mart.

13.2. How to create report tables

To create a new report table, go to the Report tables section of the Reports module (Reports -> Report Table). Above the list of standard reports, use the "Add report table" or "Add Dataelement Dimension Table" buttons. A regular report table can be used to hold data on data elements, indicators or dataset completeness, while Dataelement dimension tables are used to include data element categories in report tables. Creating the tables are done in the same way, however, the only exception being when choosing data.

To create a report table, you start by making some general choices for the table, the most important of which is the crosstab dimension. Then, you choose which data elements, indicators, datasets or data element dimensions you want to include. Finally you select which organisation units and time periods to use in the report table. Each of these steps are described in detail below.

13.2.1. General options

Cross tab dimensions

You can cross-tab one or more of the following dimensions: data element/indicator, orgunit, and period, which means that columns will be created based on the values of the dimensions chosen, e.g. if indicators is selected you will get column names in the table reflecting the names of the selected indicators.

For example, if you cross-tab on indicators and periods, the column headers will say "<indicator title> <period>". The organisation units will be listed as rows. See screenshot for clarification:

If you cross-tab on indicators and organisation units, the column headers of the table will say "<indicator title> <organisation unit>". Now the periods will be listed as rows. See screenshot for clarification:

Note that the options made here regarding crosstab dimensions may have consequences for what options are available when using the report table as a data source later, for example for standard reports.

Sort order

Affects the rightmost column in the table, allows you to choose to sort it low to high or high to low.

Top limit

Top limit allow you to set a maximum number of rows you want to include in the report table.

Include regression

This adds additional columns with regression values that can be included in the report design, e.g. in line charts.

13.2.2. Selecting data

Indicators/Data elements

Here you select the data elements/indicators that you want to include in the report. Use the group filter to more easily find what you are looking for and double click on the items you want to include, or use the buttons to add/remove elements. You can have both data elements and indicators in the same report.

Data sets

Here you select the data sets that you want to include in the report. Including a data set will give you data on the data completeness of the given set, not data on its data elements. Double click on the items you want to include, or use the buttons.

13.2.3. Selecting report parameters

There are two ways to select both what organisation units to include in a report, and what time periods should be included: relative, or fixed. Fixed organisation units and/or periods means that you select the units/periods to include in the report table when you create the report table. Using relative periods, you can select the time and/or units as parameters when the report table is populated, for example when running a standard report or creating a chart. A combination is also possible, for example to add some organisation units in the report permanently while letting the users choose additional. Report parameters is discussed below. In general, using fixed organisation units and/or time periods are an unnecessary restriction.

Fixed Organisation Units

To add fixed organisation units, click "Toggle fixed organisation units". A panel will appear where you can choose orgunits to always include in the report. If you leave it blank, the users select orgunits when running the report through the use of report parameters. Use the drop down menu to filter organisation units by level, double click or use the buttons to add/remove.

Fixed Periods

To add fixed periods, click "Toggle fixed organisation units". A panel will appear where you can choose periods to always include in the report. If you leave it blank, the users select periods when running the report through the use of report parameters. Use the drop down menu to choose period type (week, month, etc), the Prev and Next button to choose year, and double click or use the buttons to add/remove.

Relative periods

Instead of using fixed/static periods like 'Jan-2010' or 'Q1-2010', more generic periods can be used to create reusable report tables, e.g. for monthly reports the period 'Reporting month' will simply pick the current reporting month selected by the user when running the report. Note that all relative periods are relative to a "reporting month". The reporting month is either selected by the users, otherwise the current month is used. Here is a description of the possible relative periods:

  • Reporting month:

    Use this for monthly reports. The month selected in the reporting month parameter will be used in the report.

  • Months/Quarters this year:

    This will provide one value per month or quarter in the year. This is well suited for standard monthly or quarterly reports where all month/quarters need to be listed. Periods that still have no data will be empty, but will always keep the same column name.

  • This year:

    This is the cumulative so far in the year, aggregating the periods from the beginning of the year up to and including the selected reporting month.

  • Months/Quarters last year:

    This will provide one value per month or quarter last year, relative to the reporting month. This is well suited for standard monthly or quarterly reports where all month/quarters need to be listed. Periods that still have no data will be empty, but will always keep the same column name.

  • Last year:

    This is the cumulative last year, relative to the reporting month, aggregating all the periods from last year.

Example - relative periods

Let's say we have chosen three indicators: A, B and C, and we have also chosen to use the relative periods 'Reporting month' and 'This year' when we created the report table. If the reporting month (selected automatically or by the user) is for example May 2010, the report table will calculate the values for the three selected indicators for May 2010 (= the 'Reporting month') and the accumulated values for the three selected indicators so far in 2010 (= so far 'This year').

Thus, we will end up with six values for each of the organisation units: "Indicator A May 2010", "Indicator B May 2010" "Indicator C May 2010", "Indicator A so far in 2010", "Indicator B so far in 2010" and "Indicator C so far in 2010".

Report parameters

Report parameters make the reports more generic and reusable over time and for different organisation units. These parameters will pop up when generating the report table or running a report based on the report table. The users will select what they want to see in the report. There are four possible report parameters, and you can select none, all, or any combination.

  • Reporting month:

    This decides which month will be used when the system is choosing the relative periods. If the box it not checked, the user will not be asked for the reporting month when the report is generated - the current month will then be used.

  • Grand parent organisation unit:

    Select the grand parent of all the orgunit children and grand children you want listed in the report. E.g. a selected region will trigger the use of the region itself, all its district, and all their sub-districts.

  • Parent organisation unit:

    Select the parent of all the orgunit children you want listed in the report. E.g. a selected district will trigger the use of the district itself and all its children/sub-districts.

  • Organisation unit:

    This triggers the use of this orgunit in the report. No children are listed.

Example - report parameters

Continuing with the example on relative periods just above, let's say that in addition to 'Reporting month', we have chosen 'Parent organisation unit' as a report parameter when we created the report table. When we're running the report table, we will be asked to select an organisation unit. Now, let's say we choose "Region R" as the organisation unit. "Region R" has the children "District X" and "District Y".

When the report is run, the system will aggregate data for both "District X" and "District Y". The data will be aggregated from the lowest level where they have been collected. The values for the districts will be aggregated further to give an aggregated value for "Region R".

Thus, the report table will generate the six values presented in the previous example, for "District X", "District Y" and "Region R".

13.2.4. Data element dimension tables

These tables enable the use of data element categories in report tables. There are two differences from regular report tables. The first is that it is not possible to select crosstab dimensions, as the columns will always be the disaggregations from the category combinations. The other is the actual choice of data. Only one category combination can be added per report, and only data elements from the same category combo can be selected.

Subtotals and the total will also be included in the table, e.g. a gender (male, female) + EPI age(<1, >1) category combo would give the following columns: male+<1, male+>1, Female+<1, female+>1, male, female,<1, >1, total.

Selecting data

Use the drop down menu to choose category combinations. The data elements using this category combination will be listed. Double click to add to the report, or use the buttons.

13.2.5. Report table - best practices

To make the report tables reusable over time and across orgunits they can have parameters. Four types of parameters are allowed; orgunit, parent orgunit (for listing of orgunits in one area), grand parent orgunit and reporting month. As a side note it can be mentioned that we are looking into expanding this to include reporting quarter and year, or to make that period parameter more generic with regard to period type somehow. The ability to use period as a parameter makes the report table reusable over time and as such fits nicely with report needs such as monthly, quarterly or annual reports. When a report is run by the user in DHIS 2, the user must specify the values for the report tables that are linked to the report. First the report table is re-generated (deleted and re-created with updated data), and then the report is run (in the background, in Jasper report engine).

Report tables can consist of values related to data elements, indicators or data completeness, which is related to completeness of reporting across orgunits for a given month. Completeness reports will be covered in a separate section.

There are three dimensions in a report table that identify the data; indicators or data elements, orgunits and periods. For each of these dimensions the user can select which metadata values to include in the report. The user must select one or more data elements or indicators to appear in the report. The orgunit selection can be substituted with a parameter, either one specific orgunit or an orgunit parent (making itself and all its children appear in the report). If one or more orgunits are selected and no orgunit parameter is used, then the report is static with regard to which orgunits to include, which in most cases is an unnecessary restriction to a report.

Using relative periods

The period selection is more advanced as it can in addition to specific periods like Jan-09, Q1-08, 2007 also contain what is called relative periods. As report usually is run routinely over time a specific period like Jan-09 is not very useful in a report. Instead, if you want to design a monthly report, you should use the relative period called Reporting Month. Then you must also include Reporting Month as one of your report parameters to let the system know what exactly is the Reporting Month on the time of report generation. There are many other relative periods available, and they all relate to the report parameter Reporting Month. E.g. the relative period called So far this year refers to the accumulative value for the year incl. the Reporting Month. If you want a trend report with multiple periods in stead of one aggregated period, you can select e.g. 'Months this year', which would give you values for each month so far in the year. You can do a similar report with quarters. The idea is to support as many generic report types as possible using relative periods, so if you have other report needs, please suggest new relative periods on the mailing list, and they might be added to the report table options.

Cross-tabbing dimensions

Cross tabbing is a very powerful functionality in report design, as the typical DHIS 2 data table with references to period, data element/indicator and orgunit makes more advanced report design very difficult, as you cannot put e.g. specific indicators, periods or orgunits on specific columns. E.g. by cross-tabbing on the indicator dimension in an indicator report table you will get the indicator names on the column headers in your report, in addition to a column referencing orgunit, and another column referencing period. With such a table design you could drag and drop indicator names to specific columns or chart positions in the iReport software. Similarly you can cross tab on orgunits or periods to make their names specifically available to report design. E.g. by cross-tabbing on periods and selecting the two relative periods 'Reporting month' and 'This year', you can design reports with both the last month and the accumulative annual value for given month as they will be available as column headers in your report table. It is also possible to combine two dimensions in cross-tabbing, e.g. period and indicator, which makes it possible to e.g. look at three selected indicators for two specific relative periods. This would e.g. make it possible to make a table or chart based report with BCG, DPT3 and Measles coverage, both for the last month and the accumulative coverage so far in the year.

All in all, by combining the functionality of cross tabbing, relative periods and report table parameters you should have a tool to support most report scenarios. If not, we would be very happy to receive suggestions to further improvements to report tables. As already mentioned, we have started to look at more fine-grained parameters for the period dimension as the 'Reporting month' does not cover enough, or at least is not intuitive enough, when it comes to e.g. quarterly reports.

13.3. Report table outcome

When the report table is run, the system will calculate values for specified indicators/data elements/data sets, orgunits and periods. The data will be presented in DHIS 2 in a table layout. The column headers will correspond to the cross-tab dimension you have selected. An example report table showing ANC coverage for a district in The Gambia, is shown below. Here the indicator and the periods are cross-tabbed, as can be seen from the column headers.

Above the table there are six buttons; five download buttons and one Back button. Clicking the Back button will simply take you back to the previous screen. The function of the five download buttons, are presented below the screenshot:

The five download buttons

  • Download as Excel:

    Downloads a generated Excel file you can open in Excel.

  • Download as CSV:

    Downloads a generated .csv file. CSV stands for Comma Separated Values. It's a text file with the file ending .csv. Each line in the file corresponds to a row in the table, while the columns are separated with semi colons (;). The file can be opened in a text editor as well as in a spread sheet program (such as Excel).

  • Download as PDF:

    Downloads a generated pdf file. The data will be presented in a similar layout as the generated table you are already viewing in DHIS 2.

  • Download as Report:

    Downloads a "styled" pdf file. In addition to present the data in a table layout, this file also presents a chart, showing the aggregated data from all the chosen periods and the parent organisation unit chosen for the report table. The report is generated using the Jasper report engine.

  • Download as JRXML:

    Downloads the design file for the generated Report described in the previous bullet. The design file (with the file ending .jrxml) can be opened in the Jasper iReport Designer software. If you plan to design standard reports, this is the starting point.

13.4. Standard reports

13.4.1. What is a standard report?

A standard report is a manually designed report that presents manually chosen data in a manually specified layout. Still, it's highly flexible, as it can be designed to be reused over and over again, by making use of the powerful report tables.

A standard report can present any value from any table in the DHIS 2 database, but for the report design, we want the reports to be flexible, so we want to connect the reports to tables that changes through time. The report tables are therefore ideal for the report design.

13.4.2. Designing Standard reports in iReport

Jasper iReport Designer is a tool for creating reports that can be used as Standard Reports in DHIS 2. The tool allows for the creation of standard report templates that can easily be exported from DHIS 2 with up to date data. The process of creating reports involves four major steps:

  1. A report table must be created in DHIS 2 with the indicators/data elements/datasets to be used in the report.

  2. You have to run the report table and download the design file (Click the "Download as JRXML" button).

  3. Open the downloaded .jrxml file using the free software Jasper iReport Designer to edit the layout of the report.

  4. The edited report can then be uploaded to DHIS 2 to be used as a standard report.

If you want to preview your report during the design in iReport, you actually have to upload your file to DHIS 2 to see how it looks.

These four steps will be describe in detail in the coming sections. In general, when you are making standard reports you should have a clear idea of how it should look before you even make the report table, as how the report table is designed has implications for how the report can be formatted in iReport. For example, what crosstab dimensions are selected in the report table has consequences for what crosstabs are available for the standard report, and it has consequences for what types of charts you can make.

13.4.2.1. Download and open the design file

Note: If you have not created a report table yet, you have to do so. See section "How to create report tables" to do so.

Locate your desired report table and run it by clicking the green circle with a white arrow inside. When the report is shown, click the "Download as JRXML" button to download the design file. Then open that file in the Jasper iReport Designer software.

13.4.2.2. Editing the report

You are now ready to edit the layout of the report. The main iReport window consists of a "Report Inspector" to the left, the report document in the middle, a "Palette" area on the upper right hand side and a "Properties" area on the lower right hand side. The "Report Inspector" are used for selecting and examining the various properties of the report, and when selecting an item in the inspector, the "Properties" panel changes to display properties relating to the selection. The "Palette" is used for adding various elements, e.g. text boxes, images and charts to the document.

Note: If you cannot see the Palette or Properties sidebar, you can enable them from the menu item called "Window" on the menu bar.

The iReport document is divided into seven main bands, divided by layout separators (the blue lines). These lines are used to decide how big each of the areas should be on the report.

The areas all have different purposes:

  • Title - area for the title of the report

  • Page header - area for the page header

  • Column header - area for column headers (for the table)

  • Detail 1 - area where the actual report data will be placed

  • Column footer - area to make footer of the table

  • Page footer - area for the page footer

  • Summary - elements in this area will be placed at the end of the report

By default you will see that only the Title, Column Header and the Detail 1 bands have data. For most reports this is OK. The Title band is suitable for a title and e.g. a chart. Data fields entered into the Detail 1 area will be iterated over to create a table. For example, if a field called "datalementname" is placed in the Detail 1 band, all data elements in the report table will be listed here. We'll come back to data fields management just a little below.

The unused bands in the report are shrinked to add more space for your report data. You can however increase/decrease the band height as you like. There are two ways to do that. The first way is simply to drag the blue band-line as shown below.

The other way to adjust the band height is to select a band in the "Report Inspector", and then adjust the "Band height" value in the "Detail 1 - properties" area in the lower right corner.

As the fields are already present on the report, you probably don't want to do anything than just fix the layout and drag fields around. You can also resize the fields by dragging the side, top or bottom lines. If you want to change the text in the column headers, you simply double click the field and change the text.

To add the a field to the table, we simply drag it to the Detail 1 band from the "Report Inspector". The column header will be added automatically.

By double clicking the box, the text can be edited. The format of the text, such as size, font and alignment, can be adjusted with the tools above the document.

NOTE: Fields starting with "$F" present values that are retrieved from the database every time the report is run. The values here will vary, so do not change these fields unless you want a static value here!

13.4.2.3. Text

There are two types of text in iReport: «Text labels» and «Text fields» (data fields). They work in different ways, and should be used for different purposes. The main point is that text fields are just placeholders that will be filled with the correct text from the report table when the report is run, while text labels will stay the way they are when the report is run.

13.4.2.3.1. Static text

Static text are text plain text labels that can be edited normally. There are two ways to edit text labels:

  • By double clicking in the text box

  • By using the Static text properties in the Properties panel

13.4.2.3.2. Text fields

Text fields are formulas that will be filled from the report table when the report is run. Unlike static text, these can not be edited in a normal way. However, they can be manipulated in various ways to ensure that the desired output will be produced. There are three ways to edit the text fields:

  • By right clicking on the text box and selecting Edit expression

  • By double clicking the text field (not recommended, as this will not bring up the expression editor)

  • By using the Text field properties in the Properties panel

Text fields can represent either numbers or text, so that they can be used both for showing for example names of district or for numeric values. It is therefore important the the Expression class, seen in the Text field properties matches the Text field expression. For the default text fields in the .jrxml file downloaded from DHIS 2 this is not a problem, but it is important when making new text fields. The two most important Expression classes are java.lang.Double for numbers and java.lang.String for text.

13.4.2.3.2.1. Example

For example, let us say you have a quarterly report where you would like to add a new column with the yearly total. You therefore add a new Static text field to the column header band, and a Text field to the details band in. By default, new Text fields are set to java.lang.String (text). However, the yearly total column will be filled with numbers. We therefore have to change the Expression class for the new text field to java.lang.Double:

When we edit the text field expression, we see the Expression editor window with all the available columns from the report table. We can see here that each of these are marked with what type they are - text or number. What we need to make sure of is therefore that the expression class we choose for the text field matches the actual expression.

13.4.2.4. Filtering the table rows

In the default table exported from DHIS 2, there are some rows that it might be better to leave out of the table, and some that it would be preferable to have at the end. For example, when making a table based on a report table with the «parent organisation unit» parameter, the default table might have a row with the national level somewhere in between all the regions. In iReport, this can be changed so that the «parent organisation unit» appears at the bottom of the table. This involves two steps that will be explained below. Note that this will not work where there is only one organisation units, and it is therefore most useful when using the «parent organisation unit» or «grand parent organisation unit» parameters in the report table.

13.4.2.4.1. Hiding the «parameter organisation unit» from the table

We exclude the "paramter organisation unit" from the table by using a property in the Details band called "Print when expression". To set a Print when expression, start by selecting the Detail band in the Report inspector, then edit the Print when expression in the properties panel.

The Expression editor window should now appear. What we must do is to create an expression that checks if the row being generated is the row with the organisation unit given as a parameter. The report table contains a column that we can use for this called organisation_unit_is_parent. To exclude the row with the parameter organisation unit, double click on organisation_unit_is_parent in the list to copy it to the expression area, then add .equals("No") at the end so that the code is:

$F{organisation_unit_is_parent}.equals("No")

This tells the report engine to only print table rows where the organisation unit is not the parent organisation unit.

13.4.2.4.2. Putting the "param organisation unit" at the bottom of the table

Instead of removing the "param organisation unit" from the table entirely, it is also possible to put it at the bottom (or top) of the table. This is done by using the sort functionality explained in the next section, and choosing to sort first by "organisation_unit_is_parent". Other sorting options can be added in addition to this, for example to make a list where the param organisation unit is at the bottom of the table, with the other organisation units listed alphabetically above it.

13.4.2.4.3. Hiding other rows

Using the expression editor it is also possible to exclude other rows from the table, in addition to the parent organisation unit as was explained above. In Ghana, for example, all regions have a «fake district» which is the name of the region in square brackets. This can also be excluded from the table using the Print when expression that was introduced above. To to this, follow the instructions above to bring up the Expression editor window. Then, we use Java expressions to test whether or not the row should be hidden.

13.4.2.4.3.1. Example - removing rows with organisation units starting with [

Example - removing rows with organisation units starting with [

($F{organisationunitname}.charAt( 0 ) != '[')

This makes the report skip any rows where the first character of the organisation unit name is [.

It is also possible to combine several of these expressions. To do this we put the expressions in a parenthesis with the two characters && in between. For example, to make a table that leaves both organisation units whose name starts with [ and the parent organisation unit, we can use the following expression:

($F{organisationunitname}.charAt( 0 ) != '[')&&$F{organisation_unit_is_parent}.equals("No")

13.4.2.5. Sorting

Often you will be making reports where the first column is organisation unit names. However, it can be a problem that the list of organisation units are not sorted alphabetically. This can be fixed in iReport through a few simple steps.

In the report inspector, right click on the name of the report (by default this is dpt) and select Edit query.

A Report query window will appear. Click on the Sort options button.

A Sorting window as show below will appear. Here, we can add our sorting options. Click the Add field button. Another small window will show up, with a drop down menu where you can choose Sort by organisationunitname to have the table sorted alphabetically by name.

Click OK - Close - OK to close the three windows. The table should now be sorted.

13.4.2.6. Changing indicator/data element names

By default, the reports from DHIS 2 uses the short names for indicators and data elements in reports and charts. In some cases these are not always very meaningful for third parties, but with some work they can be given custom names through iReport. This is useful for example if you are making a report with indicators as rows and periods as column, or for charts with indicators.

To change the names of an indicator or data element, we have to edit its «expression» or formula, for example by right clicking the text box and choosing Edit expression to bring up the Expression editor.

Next, we have to insert some Java code. In the following example, we will be replacing the shortname of three indicators with their proper names. The code searches for the shortname, and then replaces it with a proper name.

($F{indicatorname}.equals("Bed Util All")) ? "Bed Utilisation - All Wards"

:

($F{indicatorname}.equals("Bed Util Mat")) ? "Bed Utilisation - Maternity"

:

($F{indicatorname}.equals("Bed Util Ped")) ? "Bed Utilisation - Paediatric"

:

$F{indicatorname}

From this, we can see a pattern that is reusable for more general cases.

  • For each indicator or data element we want to change the name for, we need one line

  • Each line is separated by a colon :

  • We finish the expression with a «regular» line

Each line has the same format, where the red text is the shortname, the blue text is what we want to insert instead.

The same expressions can be used for example when having indicator names along the category axis of a chart.

13.4.2.7. Adding horizontal totals

By using the expression editor, it is possible to add a column to the table with totals for each row. In the following example, we will make a table with three months as columns as well as a column with the totals for the three months.

We start by dragging a text label into the table header and changing its text to "Total", and dragging a text field into the details row.

As was discussed in the section on "Text field", we have to change the properties of the new text field so that it can display numbers. To do this, change the "Expressions Class" in the properties panel to "java.lang.Double".

Right click the text field and choose "Edit Expression". This will bring up the "Expressions editor". As the expression, we want to sum up all the columns. In this case we have three value expressions we want to sum up: "September", "October 2010", "November 2010". The name of these fields will vary depending on the crosstab dimension you have chosen in the report table. In our case, the expression we make is "$f{September}+$f{October 2010}+$f{November 2010}":

Each row of the table have a totals column to the right.

13.4.2.8. Groups of tables

There are cases when it can be useful to have several tables in one report. This can be done using Report groups. Using this functionality, one can for example create a report one table for each indicator, or one table of each organisation unit. In the following, we will go through the steps needed to make a report with three indicators, each represented in one table. It is important that the report table does not crosstab on indicators when we want to make groups of tables based on indicators.

In our example, the .jrxml file downloaded from DHIS 2 will by default have one column for organisation unit and on for indicators (assuming we have chosen periods as the only crosstab dimension). We start by removing the indicator column, since this in not needed in our case, and realign the other fields to fit the report.

Next, we create out Report group. Go to the report insepctor, right click on the report name (dpt is the default) and choose Add Report Group.

A window will appear, with a report group wizard. Select a name for the group, in this case we choose «Indicator». In the drop down menu, we can select what columns in the report table we want the groups to be based on. So, if we wanted one table for each organisation unit, we would choose organisation unit name as the report object to group according to. However, since we are grouping by indicators in this example, we choose indicatorname. Then click next.

The next step is to select whether or not we want a separate Group header and Group footer band for each report group. In this case, we choose to include both. Click Finish, and the group bands should appear in the report.

If you upload and run the report, it will now create one table for each indicator. However, it will not look very good as there will be no header row over each table - only one header at the top of each page. Also, there is no indication as to which table is showing which indicator. In the following, we will fix this.

Instead of having the title row in the column header, we can instead move it to the Group header. This will make the heading show up above each individual table. Furthermore, we can add a heading to each table with the name of the indicator.

Move the column headers from the Column header band to the Indicator group header band.

Next, add a text field to the Indicator group heading band, and edit it’s expression to display the indicator name.

The report should now have three tables, one for each indicator. Each table will have a heading with the name of the indicator, and also a table header row.

13.4.2.8.1. Sorting and grouping

When using grouping, some precautions must be taken with regards to sorting. Notably, when adding sorting parameters, whatever parameter is used as basis for the grouping must come first. Thus if you are grouping the report by indicator, and want sort the organisation units alphabetically, you have to choose to sort first by indicator, then by organisation unit name as shown below. For instructions on how to add sorting, see the sorting section above.

13.4.2.9. Charts

By default, a 3D bar chart is included in the .jrxml file that is downloaded from DHIS 2. This is set up so that only data from the «parameter orgnisation unit» (often the parent or grand parent) is used. Usually, this is a good solution. Since it is the default, we will start by looking at bar charts, before looking at line charts.

13.4.2.9.1. Bar charts

Bar charts are the default chart type in DHIS 2. In this section, we will look at how to make a bar charts like the one above, comparing the value of one inidcator in several districts. To edit the default chart in iReport, right click on it and choose Chart data.

A window will appear. By default, the Filter expression is filled in so that only data for the parent organisation unit will be displayed. If for some reason you do not want this, simply delete the text in the text box. In this case we do NOT want the filter, as we are making a chart showing a comparison across districts. To continue, click the details tab.

Under details, you see the list of series for the chart. By default, one series is created per crosstab column. In this case, we are looking at data for one indicator for the whole of 2010, for a number of districts. The indicator is along the crosstab dimension.

To make changes to a series, select it and click modify. Another window will appear where there are four areas that can be edit. The three first are required, but it is sufficient to add an empty quote («») in one of the first two.

The first box is a text field where the name of the series can be inserted or edited. This is the field that will be used to fill the text in the legend box (shown below).

However, if you want to have the name of each bar along the x-axis of the chart instead of using the legend, this can be done by adding whatever text you want to present in the Category expression field, or by inserting an expression to have it filled automatically when the report is run. In this case, we want to have one bar for each organisation unit. We therefore edit the category expression by clicking on the button to the right.

As the expression, we chose organisationunitname, as shown below.

When we are finished, the series editor should look like below. Click OK, then Close to close the Chart Details window.

If you add a good description in the Category expression area, you can leave out the legend box. This is done in the Report properties panel of iReport, where you can also edit many other details of the chart.

We can also add a title to the chart, for example the name of the indicator. This is also done in the Chart properties panel, under Title expression.

The Expression editor window will appear, where you can enter the title. Note that the title must be in quotes, as shown below.

The chart is now ready.

13.4.2.9.2. Line charts

Line charts can be useful in many circumstances. However, to make line charts the report data (report table) must be suited for it. Thus if you want to make a line chart, it is important that the report table does not have periods in the crosstab dimension. Examples where this is useful is if you are making a report for a single organisation unit with one or more indicators, or if you are making a report with one indicator and one or more organisation units.

Below, we will go though the steps needed to make a report with a line chart showing the development of three indicators over one year, for one organisation unit. We start by making a report table with the choices shown below:

When we open the resulting .jrxml-file in iReport, the default line chart is included. Since we want to make a line chart, we delete this chart and drag a new chart element into the report from the Palette panel.

As soon as we drag the Chart element into the report, a window will appear. We choose the Line chart, as shown below.

A chart wizard will appear. Click next in the first step, then Finish in the next - we will add the data later.

Next, adjust the size and position of the chart in your report. Then, we will add one data series for each of our three indicators. Right-click on the chart and choose Chart data. If you are making a chart with one indicator and several organisation units, you probably want to make a filter expression so that only data from the paramter/parent organisation unit is used in the chart. To do this, add this line to the Filter expression area:

$F{organisation_unit_is_parent}.equals("Yes")

In our example, we only have on organisation unit, so this is not necessary. Next, click the details tab to see a list of the series in the chart. For now, this list is empty, but we will add one series for each of our three indicators. To add a series, click the Add button.

In the window that appears, enter the name of the first of the indicators in the Series expression window. Remember to put the name in quotes. In the category expression (along the x-axis) we want the months, so we use the button next to the field to open the Expression editor and add periodname.

In the value expression, we add the actual data values for our first indicator. Use the Expression editor again to do this. When we are finished, the window should look like the one below, only with different names according to the indicator.

You can then Click OK to close the window. Follow the same steps to add a series for the other indicators.

Close the window, and the data for the line chart should be ready. However, some additional adjustments might be needed - most of these can be found in the Line chart properties panel. For example, when making a month by month chart as we have in example, there is often not enough space for the month names along the category axis. This can be fixed by rotating the labels by for example -40 degrees, by using the property Category Axis Tick Label Rotation.

Many other options are available to give the chart the desired look.

13.4.2.10. Adding the Report to DHIS 2

We can now switch to DHIS 2 and import our report. Go to the Report Module in DHIS 2, and select "Standard Report". In the "Standard Report" screen, click "Add new", or edit an existing one.

In the following screen, there are several actions we need to take. First, enter a name for the new "Standard Report". Second, for design, click "Choose File" and find the .jrxml-file you have edited in iReport. Then we select the report table that we used as a basis for the report in iReport. Click add, and it should move to the "Selected report tables" area. Finally, click save.

The report is now available as a "Standard Report" in DHIS 2:

13.4.2.11. Some final guidelines

  • Use the same version of iReport and DHIS 2's version of Jasper reports. See the About page in DHIS 2 for the Jasper version in use.

  • Use report tables with cross tab dimensions as your data source for your report designs. This will make it a lot easier to design reports where you need to put specific indicators, periods, or orgunits on columns.

  • Learn from others, there are many DHIS 2 report designs for Jasper on launchpad, see http://bazaar.launchpad.net/~DHIS 2-devs-core/DHIS 2/trunk/files/head:/resources/

Chapter 14. Using Data Visualizer

14.1. Data Visualizer overview

The data visualizer module enables users to easily create dynamic data analysis and visualizations through charts and data tables. You can freely select content (like indicators, periods and organisation units) for your analysis. This module can be accessed by going to "Services - Data Visualizer" in the main menu. The image below shows the viewport of the module. For a quick start:

  1. Look under the "Indicator" heading and select an indicator group from the list of groups.

  2. Look under "Available indicators" and select a few indicators from the list by double-clicking on them.

  3. Click "Update" in the top bar and see the chart unfold.

The data visualizer is designed firstly to be easy-to-use - you can simply select the indicators, data elements, periods and organisation units you want to include and click "Update" to get your visualization. Secondly it is designed to be fast and work well over poor Internet connections - charts are generated in the web browser and very little data is transferred over the Internet.

14.2. Selecting chart type

The visualizer module provides seven different chart types, each with different characteristics. You can select the type of your chart by clicking on one of the icons in top left bar titled "Chart type".

  1. Column chart: Chart which displays information as vertical rectangular columns with lengths proportional to the values they represent. Useful eg. for comparing performance of different districts.

  2. Stacked column chart: Chart with vertical rectangular columns where bars representing multiple categories are stacked on top of each other. Useful eg. for displaying trends or sums of related data elements.

  3. Bar chart: Same as column chart, only with horizontal bars.

  4. Stacked bar chart: Same as stacked column chart, only with horizontal bars.

  5. Line chart: Graph wich displays information as a series of points connected by straight lines. Also referred to as time series. Useful eg. to visualize trends in indicator data over multiple time periods.

  6. Area chart: Chart which is based on line chart, with the space between the axis and the line filled with colors and the lines stacked on top of each other. Useful for comparing the trends of related indicators.

  7. Pie chart: Circular chart divided into sectors (or slices). Useful eg. to visualize the proportion of data for individual data elements compared to the total sum of all data elements in the chart.

14.3. Selecting series, category and filter

This section lets you define which dimension of the data you want to appear as series, category and filter. This asks for a closer explanation. Dimension in this regard refers to the elements which describe the data values in the system. We have three main dimensions in the system:

  1. Data: Includes data elements and indicators, describing the phenomena or event of the data.

  2. Periods: Describes when the event took place.

  3. Organisation units: Describes where the event took place.

The visualization module lets you use these dimensions completely flexible in terms of appearing as series, categories and filter. Understanding these concepts is most easily done by looking at the screenshot from the opening page below:

More formally this can be described as following:

  1. Series: A series is a set of continous, related elements (eg. periods or data elements) which you want to visualize in order to emphasize trends or relations in its data.

  2. Categories: A category is a set of elements (eg. indicators or organisation units) for which you want to compare its data.

  3. Filter: Since most charts are two-dimensional, a filter must be used on the third dimension in order to use only a single element for the chart to become meaningful.

14.4. Selecting indicators and data elements

The visualizer module can display any number of indicators and data elements in a chart and data table. Both indicators and data elements can be selected and appear together in the same chart. You can select indicators by clicking at the "Indicators" header and selecting an indicator group from the list of groups below it. This will make the indicators in the selected group appear in the list under "Available indicators" to the left. From that list you can double click on any indicator in order to select it, this will move it to the list under "Selected indicators". Alternatively you can mark one or more indicators and click the single-arrow button. To select all indicators you simply click on the double-arrow button. To deselect indicators you can do correspondingly in the "Selected indicators" list.

To select data elements click on the "Data elements" header. The same principle for selecting and deselecting applies as for indicators.

14.5. Selecting reporting rates

The visualizer can display reporting rates in a chart, by itself or together with indicators and data elements. Reporting rates can be selected by clicking at the "Reporting rates" header. Reporting rates are defined by data sets. It can be selected by double-clicking in the list of available data sets to the left.

14.6. Selecting periods

To select periods click on the "Periods" header. You can select any number of periods from the set of periods listed under the header, such as "Last month", "Months this year" and "Last 5 years". The names should be fairly self-descriptive. All periods are relative to the current date, meaning that if the current month is March and you select "Last month", the month of February will be included in the chart.

14.7. Selecting organisation units

You can select which organisation units to include in the chart by clicking on the "Organisation units" header. This section features a tree including all organisaiton units in the system. You can select any of the organisation units by clicking on them. If you want to select multiple, arbitrary organisation units you can press the Ctrl button and then click away in the tree. If you want to include all organisation units existing directly under a specific organisation unit (the children of the parent organisation unit in other terms) you can right-click on the organisation unit and select "Select all children".

14.8. Selecting chart options

You can set various chart options by clicking on the "Chart options" header in the panel to the left.

  • Show data: Displays the corresponding value next to columns and bars in the chart.

  • Hide subtitle: Hides the title and subtitle of your chart.

  • User org unit: Includes the organisation unit of the currently logged in user in the organisation unit selection. Useful when displaying the chart on the dashboard since each user will get a relevant chart for their own location.

  • Trend line: The trend line will visualize how your data evolves over time - e.g. is performance improving or detoriating. Makes sense when periods are selected as category.

  • Hide legend: Hides the legend and leave more room for the chart itself.

  • User org unit children: Includes the direct children of the organisation unit of the currently logged in user in the organisation unit selection.

  • Domain axis label: Displays a label below the domain axis (also referred to as the X axis). Can give context information to the chart, e.g. the type of periods being listed.

  • Range axis label: Displays a label next to the range axis (also referred to as the Y axis). Can give context information to the chart, e.g. the unit of measure being used.

  • Target line value: Displays a horizontal line at the given domain value. Useful e.g. when you want to compare your performance to the current target.

  • Target line label: Displays a label next to the target line.

  • Base line value: Displays a horizontal line at the given domain value. Useful e.g. when you want to visualize how your performance has evolved since the beginning of a process.

  • Base line label: Displays a label next to the baseline.

14.9. Displaying a chart

You can display a chart based on your selections simply by clicking the "Update" button on the top centre menu. This requires that you have selected one or more elements from all of the three dimensions - data, periods and organisation units. Note that "Months this year" from the period dimension and the root organisation unit are selected by default.

Notice that you can hide and show individual data series in the chart by clicking directly on the series label in the chart - they appear either at the top or at the left of the chart.

If you want to give the chart more space on your screen you can click on the triple-arrow button on the top centre menu. This will collapse the left side menu. You can get this menu back by clicking on the same button again.

14.10. Displaying a data table

After you have rendered a chart you can display the data in a table by clicking on the "Data table" button on the top centre menu (next to "Update"). This will show a table with four columns, one for data (meaning data element or indicator), period, organisation unit and data value. This table can be sorted ascending or descending on any of the columns.

14.11. Downloading chart as image or PDF

After you have rendered a chart you can save that view as file and download it to your local computer by clicking on "Save as" on the top centre menu. You can select between PNG (image) or PDF. The file will be automatically downloaded to your computer - for instance can you now embed the image file into a text document as part of a report.

14.12. Saving chart as favorite

Once you have rendered a chart you can save it as a favorite. Click on the "Favorites" button on the top menu and then on the "Manage favorites" link. In the name field enter the desired name for your chart. By ticking the "System" checkbox the chart will be visible to all users of the system, if you do not tick it the chart will be visible only to yourself. This requres that your user account has the privilege to create system charts. You can rename any favorite by selecting it in the list, modifying its name in the name input field and clicking "Rename". You can delete any favorite by selecting it and then clicking "Delete".

These favorite charts can later be included on your personal dashboard. After saving you can navigate to the dashboard module, click on the "Insert" link over the chart areas and select your preferred chart.

14.13. Exiting the data visualizer module

If you want to exit the module and go back to the DHIS start page you can click on the "Exit" button to the right side of the top centre menu.

Chapter 15. Using GIS

15.1. GIS module overview

You can access the GIS module from the Services -> GIS link in the top menu. The picture below shows the GIS viewport.

On the right hand side there is a panel called "Map layers". There are three available "base layers", which means background map, including OpenStreetMap and Google Maps. You may click the text to open a context menu that lets you adjust the opacity/transparency of the background. "Overlays" are described later in this chapter. The final four layers are the vector layers which the user has at his disposal for thematic mapping. You may use this layer tree to show/hide layers by checking/uncheking their checkbox. The next panel called "Cursor position" tells you at what longitude and latitude your mouse cursor is positioned. The "Feature data" panel provides you with quick information on the organisation units you mouse hover in your thematic maps. Finally there is a legend panel for all the thematic layers.

The picture below shows the map toolbar:

The "Map" buttons from the left: "Zoom in", "Zoom out", "Zoom to visible extent" (all thematic map data fits inside the viewport).

The "Layers" buttons from the left: "Thematic layer 1", "Thematic layer 2", "Facility layer", "Symbol layer".

The "Tools" buttons from the left: "Favorite map views", "Predefines legend sets", "Export map to PNG", "Measure distances on map".

The two final buttons are "Administrator settings" and "Help".

15.2. Thematic mapping

This section describes the four vector layers which the user has at his disposal for thematic mapping: "Thematic layer 1", "Thematic layer 2", "Facility layer" and "Symbol layer".

15.2.1. Thematic layer 1 and 2

The two thematic layer panels let you use your data for thematic mapping. All you need to do is selecting your desired indicator/dataelement-period-map combination, then the organisation unit level and finally the parent to define the boundary. If your database has coordinates for these organisation units they will appear on the map.

You may choose between legend types: automatic and predefined. Automatic means that the application will create a legend set for you based on your what method, number of classes, low color and high color you select. Method alludes to the size of the legend classes. Set to Equal intervals they will be “highest map value – lowest map value / number of classes”. Set to Equal group count the legend creator will try to distribute the organisation units evenly. Choose Fixed bounds and you may define your own class break values, type e.g. “20,40,60” using a comma to separate each of them. The legend will appear as an even gradation from the start color to the end color. Predefined legend sets are described in Section 15.3.2, “Register legend sets” .

Low radius and high radius only have effect on points (facilities) and decides the the circle radius for points with the lowest and highest value.

The map view combo box lists all map views (favorites) saved by the user. The settings that are stored in the map view is automatically applied to the thematic map panel. Favorite map views are described inSection 15.3.1, “Register favorite map views” .

All available layer options are now grouped together in the thematic layer menu, see picture below.

Edit layer: Opens up the layer configuration window, see the thematic mapping screenshot.

Refresh: Refreshes the map boundaries, data and legend. Usually not necessary.

Clear: Clears the entire layer, i.e. the configuration window, the map and the legend panel.

Filter: Opens up the filter window and lets you filter out organisation units from the map by value. See the picture below.

Search: Opens up the search window and lets you search for and locate organisation units on the map. See picture below.

Labels: Opens up the label window and lets you add labels to the organisation units on the map. See picture below.

Opacity: Set the layer opacity/transparency to 10, 20, 30, 40, 50, 60, 70, 80, 90 or 100%. Higher values of opacity make the layer more transparent, so that the underlying layer is more visible. An opacity level of zero will provide a fully opaque layer.

History: Provides you with a list of your 10 previous maps/selections. They are temporary and thus gone when the application is restarted.

15.2.2. Facility layer

This layer displays icons that represent facilities based on the facility type. Currently, "Type" is the only supported group set. Polygons will not show up on the map, so make sure to select a facility level. Click an icon on the map to open the context menu with two options. "Show information sheet" provides you with data for several data elements for this organisation unit. The data element group and period type are "system settings" called "Infrastructural data elements" and "Infrastructural period type". The second option in the context menu is "Relocate" and lets you graphically move the organisation unit to a different location. The new coordinate will be stored permanently.

15.2.3. Symbol layer

This layer displays icons that represent areas/polygons like provinces, districts etc instead of facilities/points. Thus, in this layer you are not supposed to select a facility level, but instead a level of provinces, districts etc. In order to render this layer you need to create a predefined legend set of images, described in Section 15.3.2, “Register legend sets”.

15.3. Tools

This section describes the available GIS tools, which are available on the "Tools" section of the map toolbar.

15.3.1. Register favorite map views

Click the "Favorite map views" button (star icon) on the toolbar to get the context menu. The first option is "Manage favorites" which opens up a window where you are supposed to type the name of the favorite and select the layer you want to save. If you are an administrator you can check the "System" checkbox to make the favorite available to all users. From the bottom combobox you may delete a favorite or add it to the DHIS 2 dashboard.

15.3.2. Register legend sets

Example usage (vaccination coverage): Firstly, create the legends that are going to constitute the legend set. The first one could be "Low bad" (display name), 0 (start value), 30 (end value), red (color). Then create "Medium" / 30 / 70 / yellow and finally "High good" / 70 / 100 / green. Now, open the "legend set" panel, type e.g. "High is good" as display name and select the desired legends below. Multi-select your three legends by pressing and holding the Ctrl/Shift button when selecting. Then click the register button to store the legend set. Assign indicators/data elements to your legend set in one of the two last panels. Select the legend set in the combo box and multi-select items in the list below. Click the assign button to update the legend set. Please see the referred window in section 1.1.

15.3.3. Exporting/saving map images

Click the image icon on the map toolbar and the print window will open. Title: Image title, will appear as a headline in the image. Layers: Choose whether polygons, points or both will be printed. Width/Height: The pixel resolution of the image. Choose among the predefined "small" (800x600), "medium" (1190x880), "large" (1920x1200) or type the exact number of pixels yourself (type the number only, avoid text like "px"). If you want to exclude the legend from the image, untick the legend checkbox. Finally click the export button to print the image (PNG). Please see the referred window in section 1.1.

15.3.4. Measure distance

Click the two-way arrow icon on the map toolbar to enter measuring mode. Now, click your desired start location on the map and a dotted line will follow the cursor toward your destination. Single click to create a line point, double click to finish the line. To exit measuring mode, click the toolbar icon again or close the window.

Chapter 16. Setting up GIS

16.1. Context

Setting up the GIS simply means storing coordinates for the organisation units you want to show on the map in the database. Coordinates are often distributed in proprietary formats and will need to be converted to a format which DHIS2 uses. ESRI shapefiles are the most common geospatial vector data format for desktop applications. You might find shapefiles for your country here or in many other geospatial data repositories on the web. Some amount of work needs to be done in order to use these coordinates in DHIS 2 GIS, namely transforming the data into a suitable format and ensuring the name which are contained in the geospatial data match exactly with the names of the organization units which they should be matched to.

If you go to the organisation unit module and edit one of the units, you can see a text field called Coordinates. Here you may fill in its coordinates directly (geojson format) which is useful if you just want to update a couple of units.

An example point/facility coordinate:

[29.341,-11.154]

An example polygon/area coordinates string:

[[[[29.343,-11.154],[28.329,-11.342],[28.481,-10.239],[29.833,-10.412]]]]

However, if you are going to e.g. add coordinates for all units at a certain level you don't want to do that manually. This is where the automatic GML import comes into play and the following section explains the preferred way of using it.

[Important]Important

The only co-ordinate reference system supported by DHIS2 is EPSG:4326, also known as geographic longitude/latitude. Coordinates must be stored with the longitude (east/west position) proceeding the latitude (north/south position). If your vector data is in a different CRS than EPSG 4326, you will need to reproject the data first before importing into DHIS2.

16.2. Importing coordinates

Step 1 - Simplify/generalize your geographical data

The boundaries in geographical data files are usually very accurate, too much so for the needs of a web-based GIS. This usually does not affect the performance when using GIS files on a a local system, but it is usually necessary to optimize the geographical data for the web-based GIS system of DHIS2. All geographical data needs to be downloaded from the server and rendered in a browser, so if the data is overly complex, the performance of the DHIS2 GIS will be negatively impacted. This optimization process can be described as follows:

Coordinates: The number of significant decimal digits (e.g. 23.02937874993774) should be shortened to fewer digits (e.g. 23.03). Although this will result in some inaccuracies on the map, given the usual scale at which maps in DHIS2 are produced (> 1:50,000), the loss of precision should not be noticeable. Normally, no more than four significant digits after the decimal point should be necessary.
Polygons: In addition to shortening the number of significant digits, the actual number of points should also be reduced to an optimal level. Finding this optimal level may take a bit of experimentation. Decreasing the precision of the points as well as the number of points through generalization, will lead to degradation of the polygon. However, after a bit of experimentation, an optimal level of generalization can be found, where the accuracy of the polygon is visually acceptable, and the performance of the GIS is optimal.

For polygons, we need to make the boundary lines less detailed by removing some of the line points. One possible method is the use of MapShaper which is an online tool which can be used to generalize geographical data. To use MapShaper, simply upload your shapefile to the site. Then, at the center bottom you see a slider that starts at 0%. It is usually acceptable to drag it up to about 80%. In the left menu you can check "show original lines" to compare the result and you may want to give a different simplification method a try. When you are happy with the result, click "export" in the top right corner. Then check the first of the four options called "Shapefile - polygons", click "create" and wait for the download buttons to appear. Now, download the two files to your local computer (being sure to rename the file so that you do not overwrite your existing, original data). Move on to the next step with your new simplified shapefile.

Step 2 - Convert the shapefile to GML

The recommended tool for geographical format conversions is called "ogr2ogr". This should be available for most Linux distributions sudo apt-get install gdal-bin. For Windows, go to http://fwtools.maptools.org/ and download "FWTools", install it and open up the FWTools command shell. During the format conversion we also want to ensure that the output has the correct coordinate projection (called EPSG:4326 with geographic longitude and latitude). For a more detailed reference of geographic coordinates, please refer to this site. If you have already reprojected the geographic data to the geographic latitude/longitude (EPSG:4326) system, there is no need to explicitly define the output coordinate system, assuming that ogr2ogr can determine the input spatial reference system. Note that most shapefiles are using the EPSG:4326 system. You can determine the spatial reference system by executing the following command.

ogrinfo -al -so filename.shp

Assuming that the projection is reported to be EPSG:27700 by ogrinfo, we can transform it to EPSG:4326 by executing the following command.

ogr2ogr -s_srs EPSG:27700 -t_srs EPSG:4326 -f GML filename.gml filename.shp 

If the geographic data is already in EPSG:4326, you can simply transform the shapefile to GML by executing the following command.

ogr2ogr -f GML filename.gml filename.shp

You will find the created GML file in the same folder as the shapefile.

Step 3 - Prepare the GML file

Unfortunately, the GML file is not ready for importation yet. Open it in a robust text editor like Geany (Linux) or Notepad++ (Windows). GML is an XML based format which means that you will recognize the regular XML tag hierarchy. In the GML file an organisation unit is represented as a <gml:featureMember>. Inside the feature members we usually find a lot of attributes, but we are just going to import their coordinates. In order to do this DHIS 2 will match the name of the feature members to the organisation unit names in the database. To get the name of the feature members in the GML file the importer will look for a property called "ogr:Name". Figure out what property that is holding the name of the feature members (could be "ogr:DISTRICT_NAME", "ogr:NAME_1" or whatever, this differs from shapefile to shapefile) and rename it to "ogr:Name". Ensure that both the start and the end tags are renamed properly. They are supposed to look like e.g.: <ogr:Name>Moyamba District</ogr:Name>

Note that the name of the feature members in the GML file must be spelled exactly the same as the organisation units in the database. Otherwise the importer will not recognize it and thus not transfer any coordinates. E.g. "Moyamba" in the GML file might be called "Moyamba District" in the database. Creative use of the "rename all" function in the text editor is usually of great help in these situations, as you do not want to edit numerous feature members manually. Have a brief look at the names and compare them to the names in the database. If they seem to match fairly good, it is about time to do a preview in the import-export module.

Go to Services -> Import-Export, select "Preview", select the GML file and click "Import". Look for new/updated organisation units. Our intention is to add coordinates to already existing organisation units in the database, so we want as many updates as possible and 0 new. Those listed as new will be created as root units and mess up the organisation unit trees in DHIS 2. If any listed as new, click the number and the organisation units in question will appear in the list below. If there are any slight misspellings compared to the organisation unit names in the database - fix them and do the preview again. Otherwise, click the "discard all" button below the list and then the "Import all" button above the list.

If the import process completes successfully, you should now be able to utilize the geographical data in the DHIS2 GIS. If not, check the log for hints and look for common errors such as:

- Name duplicates in the GML file. The name column in the database is unique and does not accept two organisation units with the same name.

- The "shortname" column in the organisationunit table in your database has a too small varchar definition. Increase it to 100.

- Special name characters in the GML file. Be sure to convert these to appropirate XML equivalents or escape sequences.

16.3. Administering the GIS module

16.3.1. Register overlays

Overlays are geographical layers that do not have any direct linkage to data in the database. Examples include roads, rivers, airports, ports, and other geographical information that you may want to display on your map, but that is not necessarily linked to data contained in the DHIS database. The Register Overlay panel will allow you to add new layers and determine how they will be represented visually on the map.

  • Display name: Represents your overlay in the layer tree in the upper right corner.

  • Map source file: The GeoJSON file name.

  • Fill color: Decides the fill color if the layer is a polygon layer.

  • Fill opacity: Select an opacity level between 0 (invisible) and 1 (solid).

  • Stroke color: The stroke color over lines and polygon borders.

  • Stroke width: Select a stroke width between 0 and 4.

16.3.1.1. Copying files to the DHIS application

Currently, your GeoJSON files should be placed in the DHIS2_HOME/geojson of your DHIS application to be accessible to the GIS module. If the GeoJSON directory does not exist, you will need to create it manually and copy your GeoJSON files there.

Chapter 17. Import and export

Learning objectives:

After reading this module you will be able to understand:

  • Why do we need functions of export and import data.

  • How to export data from DHIS2

  • How to import data into DHIS2

17.1. What is import and export?

In a primary health system, the HMIS typically involves a distributed application, where the same application is running in different geographical locations (PHCs,CHCs, hospitals, districts, and state). Most of these physical locations do not have Internet connectivity, and hence they work offline. At some point (normally at the district level), the data needs to be synchronised in order to have a consolidated database for the a particular geographical region. For this, it is important to be able to export data from one location (which is working offline, say at the health facility level) to another one say at the district level where the data would need to be imported. This feature of exporting and importing is thus a crucial function of a HMIS. This feature also helps us overcome the dependency on Internet to some degree, as data updates can be transferred via USB key where there is no connectivity, or through email where there is limited Internet connectivity. DHIS 2 provides robust export-import functionality to fulfil these needs.

17.2. Exporting data

In the case on on-line data entry, all data is saved into one database only. In an offline deployment, each deployment will have a separate database in their local system. So the data will be stored in their local database. In an offline deployment, after the data entry is finished, it will need to be manually sent to the next level of where the application is running. In an on-line application, however, that is not required, as all data is stored at a central location using the Internet.

17.2.1. Exporting from DHIS 2

The export option can be made use of by selecting it as follows. The import or export is available only when the selected organisation (source/destination) has defined datasets. This is because datasets help to define which data is to be or is being exported. Further, which specific data elements get exported is determined by the composition of the dataset being exported. If there are no datasets defined for an organisation unit, it indicates that no data values are registered for this level of organisation or lower. To access the main Import-Export module, choose Services->Import-Export

The exported data values are stored in an ‘xml file’. The file name is defined by the name of the source organisation unit and the period to allow the receiving organisation unit to identify the source and the period of the export file. The XML is placed in your home directory (On Windows this is normally C:\Documents and Settings\ under the sub-directories /dhis / import-export.

17.2.2. Exporting data to other DHIS 2 systems

Once the data export screen is displayed, select the Organisation unit, period and dataset for which data export should be selected.Finally click on the export option that will be available on the lower left side of displayed screen. If there are no datasets defined for an organisation unit, it indicates that no data values are registered for this level of organisation or lower.

A pop-up save option will appear on the displayed screen (see picture below) prompting the saving of the exported data. You may save the export folder on your desktop or any other folder by selecting the ‘Save to Disk’ option from the pop-up prompt.

17.2.3. Exporting metadata to other DHIS 2 systems

17.2.3.1. Metadata export

Metadata is "data about data". In the context of DHIS 2, metadata consists of definitions of data elements, indicators, the structure and names contained in the organizational hierarchy, and other options. Click on the "Metadata export" link from the main "Data export" screen in order to access this. Just select the feature that you wish to export and click "Export". This metadata file can then be transmitted just like a data file, except it will contain information on the definitions of the various features, as opposed to the values of the data themselves.

17.2.3.2. Detailed metadata export

The "Detailed metadata" function will allow you to export specific data element and indicator definitions. Just click "Detailed Metadata Export" and select the data elements and indicators that you wish to export. Click "Export" and save the file to a desired location. This file can then be transmitted via email or USB key to other DHIS 2 installations.

17.2.4. DHIS 1.4 Metadata export

The DHIS 1.4 Metadata export functionality provides the same functionality as the standard DHIS 2 metadata export, except that the resulting file can be used to transmit metadata information to DHIS 1.4 systems.

17.2.5. DHIS 1.4 Detailed Metadata Export

The DHIS 1.4 Metadata export functionality provides the same functionality as the detailed DHIS 2 metadata export, except that the resulting file can be used to transmit metadata information to DHIS 1.4 systems. Simply select the data elements and indicators that you want and click "Export" to begin the export process.

17.2.6. PDF Metadata Export

Auctor natoque ve vulputate quam. Quam duis posuere risus felis mus class tempor eu sociosqu. Risus duis penatibus turpis, tristique dictum enim est. Quisque mi pulvinar ultrices, fusce diam porttitor mi hendrerit viverra, augue leo vestibulum rutrum. Ridiculus dictumst luctus. Eros.

17.3. Importing data

The import option allows different instance of DHIS 2 to receive standardised set of data in the absence of a networked system. Typically, a data set is exported from one DHIS instance (e.g. a district level system) to another system (e.g. a provincial level system). DHIS 2 is capable of importing data from other systems that either support the DXF of IXF formats. DHIS 2 is capable of importing data directly from a DHIS 1.4 Access database. Each of these options will be discussed in the following sections.

17.3.1. Importing data from another DHIS 2 instance

Data can be imported into different instances of DHIS 2 through the use of the DXF data exchange format. There are two screens that are used to import data, with default and advanced options.

The default data import menu can be accessed by clicking the "Import" from the main Import-Export screen.

By clicking the "Browse" button, you can select a file from you local file system. This file may have been received by email, copied from another users system, or received on a CD for example. Simply select the file that you wish to import.

There are three separate options for importing data.

  • Import: This option will import the contents of the import file directly into the database.

  • Preview: This option will enable a preview of the contents of the import file. In the preview one can get an overwiev of the data to be imported, discard unwanted elements and match import elements to existing ones.

  • Analysis: This option will enable an analysis of the contents of the import file. The analysis will search for and examine anomalies in the data, like violations of unique names constraints and invalid indicator formulas. This is useful when importing from external applications where data constraints might be less rigid than in DHIS 2.

  • NOTE: We highly recommend always using the Preview option when importing data to make sure you keep control over any changes to your metdata and databases being out of synch on data elements or orgunit names.

17.3.1.1. Preview before importing

Before doing the import into your database it is highly recommended to preview the data to make sure no changes to the metdata (data element and/or orgunit names) have taken place at the source DHIS 2 installation. Select Preview in the Type field in the Import window. In the preview window it isIMPORTANT to look for New and Updates in metadata. DO NOT just click the Import all button without carefully reviewing the information in the preview window. Importing new data elements or orgunits without checking properly whether they are really new or just old names can cause a corrupted database with duplicate or incomplete data, so be careful!

Procedure for handling New or Updates in the preview:

If new:

If there are new data elements, indicators, or orgunits, first make sure whether they really are new or not. Data elements are rarely new, most of the time they are the old name of something that has been changed in the destination database (e.g. a master db at the national level). If you have changed some data elements names at the national level and these have not yet been updated in the district database, the old names that are in the district export files will appear as new data elements in your import preview. It is very important that you tell the DHIS that these are only just old names of a data element that already exists in your database, if not you will have two data elements meaning the same thing and both with an incomplete set of data. Use the ‘match new to existing’ button to link the new data elements (that really are old) to the updated names in your national database, and make sure that the source database updates its metdata before the next data export.

If updates:

Only the newer updates are shown in the preview. This means the record has been updated more recently in the district/hospital than in the zonal/national database you are importing into. If you are not sure whether you want to import the update or not, you can select the record and click on the compare to existing button to see exactly which changes that have been made in the updated object.

17.3.2. Importing data from DHIS 1.4

There are two ways to import data from a DHIS 1.4 database; 1) through the 1.4 XML-based export files, or 2) directly from the DHIS 1.4 data file (.mdb). Both are accessible from the DHIS 1.4 Import menu under Import in the Import-Export module.

It is critical that all data integrity violations which are present in the DHIS 1.4 database be fully resolved before attemtping an import into DHIS 2. You can check the data integrity of DHIS 1.4 through the CORE Module->Advanced->Data integrity checks. A report will be generated of all data integrity violations which should be resolved prior to importing into DHIS 2.

17.3.2.1. DHIS 1.4 File (database) Import

This method is recommend when doing large imports from 1.4, and especially when importing into a new DHIS 2 database.

DHIS 1.4 File Configuration

Before you can start the 1.4 file import you need to provide a few details about the 1.4 database:

Datafile(#): Here you put the full path to the DHIS 1.4 data file you want to import from, e.g. C:\DHIS14\DHIS_#LR_LIBERIA.mdb.

Username: Leave blank (unless you have set up extra security measures on the file)

Password: Leave blank (unless you have set up extra security measures on the file)

Levels: Provide the number of levels in the orgunit hierarchy in your 1.4 database, e.g. 5.

Click "Save" and you will return to the DHIS 1.4 File Import window.

Import Type:

As with other imports you have the options to Import (directly), Preview, or Analyse the import. We recommend using the Analyse option first to check that the 1.4 database is OK and ready to be imported.

When importing a large database into a new blank DHIS 2 database we recommend using the Import option to save time.

For smaller incremental imports the Preview is OK.

Last Updated:

If you want the full import, all the data in the 1.4 database you leave this field blank.

If you only want to do an incremental import into an already existing DHIS 2 database you can use this field to filter which data values to import. Only values added or edited after the date you specify will be imported. This filter makes use of the LastUpdated column in the RoutineData table in the DHIS 1.4 data file.

Import process:

When you are done selceting Method, and LastUpdated you can begin the import by clicking on the Import button. This process might take a long time, depending on how many data values you are importing. On a reasonable spec. computer the import takes about 2 million records per 30 minutes.

17.3.2.2. DHIS 1.4 XML Import

Import thof XML data from DHIS 1.4 is also possible using the standard DHIS 1.4 export format. Just be sure that the DHIS 1.4 export format has been set to "DHIS 2.0" as illustrated in the screen shot below. After the data has been exported by DHIS 1.4, you can import the data by choosing "Services->Import-Export->DHIS 1.4 Import->DHIS 1.4 XML Import" and proceeding via the procedure outline in the previous section.

17.3.2.3. Limitations to DHIS 1.4 imports

Although it is possible to import and export data between instances of DHIS 1.4 and DHIS 2, there are significant limiations. Currently, the import of some metadata is not supported from DHIS 1.4 to DHIS 2. This includes:

  • Validation rules

  • Organisational unit alternate names

  • Compulsory data element pairings

  • Custom data entry forms

  • Dataset data entry levels

It is also important that the aggregation operator defined in DHIS 1.4 be set to the correct value. Some data, such as population, should have their aggregation operator set to "Average" in DHIS 2, as this controls how the aggregation of data is handled over time (but not within the organisational unit hierarchy).

17.4. Importing CSV data

DHIS 2 supports import of data in the CSV format. This can be used to import exchange file produced by DHIS 2 itself. It also comes in handy when you want to import data from a third-party system as CSV is widely supported in applications and is easy to produce manually.

To import a CSV data exchange file navigate to the CSV Data Import item in the left-side menu. Upload the exchange file and click Import.

The following section describes the CSV format used in DHIS 2. The first row is assumed to be a header row and will be ignored during import.

Table 17.1. CSV format of DHIS 2

ColumnRequiredNotes
Data elementYesRefers to uid by default, can also be name and code based on selected id scheme
PeriodYesIn ISO format
Org unitYesRefers to uid by default, can also be name and code based on selected id scheme
Category option comboNoRefers to uid
ValueNoData value
Stored byNoRefers to username of user who entered the value
TimestampNoDate in ISO format
CommentNoFree text comment
Follow upNotrue or false


The following is an example CSV file which can be imported into DHIS 2. It can be imported both as plain text file or as compressed ZIP file archive.

"dataelelement","period","orgunit","categoryoptioncombo","value","storedby","timestamp","comment","followup"
"DUSpd8Jq3M7","201202","gP6hn503KUX","Prlt0C1RF0s","7","bombali","2010-04-17",,"false"
"DUSpd8Jq3M7","201202","gP6hn503KUX","V6L425pT3A0","10","bombali","2010-04-17",,"false"
"DUSpd8Jq3M7","201202","OjTS752GbZE","V6L425pT3A0","9","bombali","2010-04-06",,"false"

17.5. Importing XML data

DHIS 2 supports import of data in XMl format. The format is called DXF (DHIS Exchange Format). To import an XML file navigate to the XML Data Import item in the left side menu. Upload the exchange file and click Import. After the import process is finished you can follow the link to the import summary, which will inform you about the outcome of the import process in terms of number of records imported, updated and ignored and potential conflicts.

If you need to manually produce such XML files please refer to the Web API chapter where you can find detailed documentation of the DXF format.

Chapter 18. Data Administration

The data administration module provides a range of functions to ensure that the data stored in the DHIS2 database is integral and that the database performance is optimised. These functions should be executed on a regular basis by a data administrator to ensure that the quality of the data stored is optimal.

18.1. Data browser

The data browser maintenance and analysis module which allows the user to produce a summary of the data contained in the DHIS2 database. The summary view provides a count of data elements which have been entered at the selected organisation unit as well as its descendants. Raw data for all data elements for a range of time periods and a given organisational unit can be browsed and exported to Excel, CSV, or PDF formats. There are four modes of the data browser, which determine how the data is summarized

  • Data sets

  • Data element groups

  • Organisational unit groups

  • Organisational units

Each of these options can be accessed by selecting the desired option from "Browse by" drop-down menu.

In order to produce a summary of submitted data for a given period and grouped by data sets, the user should follow this procedure. Begin by selecting a given periodicity type (e.g. Weekly, monthly, yearly, etc) and then a "From date" and "To date". (e.g. January 2009 to March 2009). Select the type of summary to be produced (e.g. Dataset) from the "Browse by" drop-down menu. Click the "Browse" button to view the summary.

A summary of the number of data element values that have been submitted over the user selected time period is shown below.

By clicking on the name of the individual dataset, a more detailed summary of each data element can be obtained as shown below. A cross-tab table summarising each time period will be shown.

The functionality of the grouping by Datasets, Data element groups, and Organisational groups is essentially the same.

The functionality of grouping by organisation units will be discussed below. Begin by selecting "Organisation units" from the "Browse by" drop-down menu. The organisational hierarchy present in the database will now be displayed. Organisational units can be expanded by clicking on the plus symbol in the organisational tree view.

By clicking on an organisational unit, and the clicking the "Browse" button, a summary of submitted data elements present in the database is returned for all immediate children of the selected organisational as shown below:

By clicking on one of the organisational units, two drill down modes are presented to the user.

  • Summary drill down- Drill down to the selected organisational units children to see the count of data elements.

  • View raw data at this level: View the actual raw data at the selected organisational unit. A typical view of the raw data export can be seen below.

    Data can be exported into Excel, CSV and as a PDF report by clicking the appropriate button.

18.2. Data integrity

DHIS2 can perform a wide range of data integrity checks on the data contained in the database. Identifying and correcting data integrity issues is extremely important for ensuring that the data used for analysis purposes is valid. Each of the data integrity checks that are performed by the system will be described, along with general procedures that can be performed to resolve these issues.

18.2.1. Data elements without data set

Each data element must be assigned to a data set. Values for data elements will not be able to be entered into the system if a data element is not assigned to a data set. Choose Maintenance->Datasets->Edit from the main menu and then add the "orphaned" data element to the appropriate data set.

18.2.2. Data elements without groups

Some Data Elements have been allocated to several Data Element Groups. This is currently not allowed, because it will result in duplication of linked data records in the PivotSource recordsets that `feed` the pivot tables. Go to Maintenance -> Data Element Groups to review each Data Element identified and remove the incorrect Group allocations.

18.2.3. Data elements violating exclusive group sets

Some data elements have been allocated to several data element groups that are members of the same data element group set. All group sets in DHIS are defined as exclusive, which means that a data element can only be allocated to one data element group within that group set. Go to Maintenance -> Data elements and indicators ->Data element groups to review each data element identified in the integrity check. Either remove the data element from all groups except the one that it should be allocated to, or see if one of the groups should be placed in a different group set.

18.2.4. Data elements assigned to data sets with different period types

Data Elements should not be assigned to two separate data sets whose period types differ. The recommended approach would be to create two separate data elements (for instance a monthly and yearly data element) and assign these to respective datasets.

18.2.5. Data sets not assigned to organisation units

All data sets should be assigned to at least one organisation unit.

18.2.6. Indicators with identical formulas

Although this rule will not affect data quality, it generally does not make sense to have two indicators with the exact same definition. Review the identified indicators and their formulas and delete or modify any indicator that appears to be the duplicate.

18.2.7. Indicators without groups

All Data Elements and Indicators must be assigned to at least one group, so these Indicators need to be allocated to their correct Data Element and Indicator Group. Go to Maintenance -> Indicator Groups, and allocate each of the `Orphaned` Indicators to its correct group.

18.2.8. Invalid indicator numerators

Violations of this rule may be caused by an incorrect reference to a deleted or modified data element. Review the indicator and make corrections to the numerator definition.

18.2.9. Invalid indicator denominators

Violations of this rule may be caused by an incorrect reference to a deleted or modified data element. Review the indicator and make corrections to the denominator definition.

18.2.10. Indicators violating exclusive group sets

Some indicators have been allocated to several indicator groups that are members of the same indicator group set. All group sets in DHIS are defined as exclusive, which means that an indicator can only be allocated to one indicator group within that group set. Go to Maintenance -> Data elements and indicators ->Indicator groups to review each indicator identified in the integrity check. Either remove the indicator from all groups except the one that it should be allocated to, or see if one of the groups should be placed in a different group set.

18.2.11.  Organisation units with cyclic references

Organisation units cannot be both parent and children of each other, directly nor indirectly.

18.2.12. Orphaned organisation units

All organisation units must exist within the organisation unit hierarchy. Go to Organisation->Hierarchy Operations and move the offending organisation unit into the proper position in the hierarchy.

18.2.13. Organisation units without groups

All organisation units must be allocated to at least one group. The problem might either be that you have not defined any `compulsory` OrgUnit Group Set at all, or that there are violations of the `compulsory` rule for some OrgUnits . NOTE: If you have defined no `compulsory` OrgUnit Group Sets, then you must first define them by going to Maintenance -> Organisation units->Organisation unit group sets and define at least one `compulsory` Group Set (the group set `OrgUnitType` are nearly universally relevant). If you have the relevant group sets, go to Maintenance -> OrgUnit Groups to review each OrgUnit identified and add the relevant Group allocation.

18.2.14. Organisation units violating compulsory group sets

These organisation units have not been assigned to the any organisation unit group within one of the compulsory organisation unit group sets. When a group set is defined as `compulsory`, it means that an organisation unit must be allocated to at least one organisation unit group within that group set. For instance, all organisation units must belong to one of the groups in the `organisation unitType` group set. It might belong to the `Hospital` or the `Clinic` or any other `type` group - but it must belong to exactly one of them. Go to Maintenance -> organisation unit->Organisation unit groups to review each organisation unit identified in the integrity check. Allocate all organisation units to exactly one group.

18.2.15. Organisation units violating exclusive group sets

Some organisation units have been allocated to several organisation unit groups that are members of the same organisation unit group set. All group sets in DHIS are defined as exclusive, which means that an organisation unit can only be allocated to one organisation unit group within that Group Set. For instance, one organisation unit cannot normally belong to the both the 'Hospital' and 'Clinic' groups , but rather to only to one of them. Go to Maintenance -> organisation unit->Organisation unit groups to review each organisation unit identified in the integrity check. Remove the organisation unit from all groups except the one that it should be allocated to.

18.2.16.  Organisation unit groups without group sets

The organisation unit groups listed here have not been allocated to a group set. Go to Maintenance->Organisation unit->Organisation unit group sets and allocate the Organisation unit group to the appropriate group set.

18.2.17. Validation rules without groups

All validation rules must be assigned to a group. Go to Services->Data quality->Validation rule group and assign the offending validation rule to a group.

18.2.18. Invalid validation rule left side expressions

An error exists in the left-side validation rule definition. Go to Services->Data quality->Validation rule and click the "Edit" icon on the offending rule. Press "Edit left side" and make the corrections that are required.

18.2.19. Invalid validation rule right side expressions

An error exists in the left-side validation rule definition. Go to Services->Data quality->Validation rule and click the "Edit" icon on the offending rule. Press "Edit right side" and make the corrections that are required.

18.3. Data Archive

The purpose of the data archive function is to move data which is currently not being used for analysis to a secondary storage location in order to improve performance of the application. Data can be both archived and unarchived. When archiving data one moves it from the primary storage to the secondary storage location, while unarchiving moves it from the secondary storage location to the primary. Analysis functionality in DHIS 2 heavily utilizes queries to the data value database table, and by reducing the size of this table these operations will be significantly faster. Typically one would want to archive data that is older than two years.

To archive data, first enter a start date and an end date for the time span of the data which should be archived. Then press the archive button. The operation might take a few minutes.

To unarchive data, first enter a start date and an end date for the time span of the data which should be unarchived. Then press the unarchive button. The operation might take a few minutes.

In some cases you might end up with overlapping data. For instance one might archive data for a given timespan, then later enter data for a period in that timespan. In such cases the system will automatically overwrite the oldest of the overlapping values with the newest during the archive or unarchive operation.

18.4. Beneficiary Data Archive

The purpose of the beneficiary data archive function is to move beneficiary data value which is currently not being used for analysis to a secondary storage location in order to improve performance of the application. Data can be both archived and unarchived. When archiving data one moves it from the primary storage to the secondary storage location, while unarchiving moves it from the secondary storage location to the primary. Analysis functionality in DHIS 2 heavily utilizes queries to the data value database table, and by reducing the size of this table these operations will be significantly faster. Typically one would want to archive beneficiary data that is older than two years.

To archive beneficiary data, first enter a start date and an end date for the time span of the data which should be archived. Then press the archive button. The operation might take a few minutes.

To unarchive beneficiary data, first enter a start date and an end date for the time span of the data which should be unarchived. Then press the unarchive button. The operation might take a few minutes.

In some cases you might end up with overlapping data. For instance one might archive beneficiary data for a given timespan, then later enter data for a period in that timespan. In such cases the system will automatically overwrite the oldest of the overlapping values with the newest during the archive or unarchive operation.

18.5. Maintenance

The data maintenance module has five options, each described below.

  • Clear data mart (aggregated datavalues)

    The data mart is where DHIS 2 stores aggregated data produced during the export to data mart process. This function clears the database table which contains aggregated data element values.

  • Clear data mart (aggregated indicatorvalues)

    The data mart is where DHIS 2 stores aggregated data produced during the export to data mart process. This function clears the database table which contains aggregated indicator values.

  • Clear zero values

    This function removes zero data values from the database. Values registered for data elements with aggregation operator average is not removed, as such values will be significant when aggregating the data, contrary to values registered for data elements with aggregation operator sum. Reducing the number of data values will improve system performance.

  • Clear dataset completeness

    This function removes aggregated dataset completeness values. This data is produced and used by report tables.

  • Prune periods

    This function removes all periods which have no registered data values. Reducing the number of periods will improve system performance.

18.6. Resource tables

Resource tables are supporting tables that are used during analysis of data. One would typically join the contents of these tables with the data value table when doing queries from third-party applications like Microsoft Excel. Simply select the tables that should be regenerated and press "Generate tables". Regeneration of the resource tables should only be done once all data integrity issues are resolved.

  • Organisation unit structure (orgunitstructure)

    This table should be regenerated any time there have been any changes made to the organisational unit hierarchy. This table provides information about the organisation unit hierarchy. It has one row for each organisation unit, one column for each organisation unit level and the organisation unit identifiers for all parents in the lineage as values.

  • Exclusive organisation unit groupset structure normalized (orgunitgroupsetstructure)

    This table provides information about the which organisation units are member of which organisation unit group sets.

  • Data element group set structure (_dataelementgroupsetstructure)

    This table provides information about which data elements are members of which data element group sets. The table has one row for each data element, one column for each data element group set and the names of the data element group as values.

  • Indicator group set structure (_indicatorgroupsetstructure)

    This table provides information about which indicators are members of which indicator group sets. The table has one row for each indicator, one column for each indicator group set and the names of the indicator group as values.

  • Organisation unit group set structure (_organisationunitgroupsetstructure)

    This table provides information about which organisation units are members of which organisation unit group sets. The table has one row for each organisation unit, one column for each organisation unit group set and the names of the organisation unit groups as values.

  • Category structure (_categorystructure)

    This table provides information about which data elements are members of which categories. The table has one row for each data element, one column for each category and the names of the category options as values.

  • Data element category option combo name (categoryoptioncomboname)

    This table should be regenerated any time there have been changes made to the category combination names. It contains readable names for the various combinations of categories.

18.7. SQL View

Database administrators must be very careful about creating database views directly in the DHIS 2 database. Certain DHIS 2 operations drop and recreate tables, for instance when the resource tables are regenerated. If any SQL views depend on these tables, an error will occur, since the tables are referenced in an SQL view.

The SQL View functionality of DHIS2 will store the SQL view definition internally, and then materialize the view when requested.

18.7.1. Creating a new SQL view

To create a new SQL view, choose Maintenance->SQL view and click the "Add new" button.

The "Name" attribute of the SQL view will be used to determine the name of the table that DHIS2 will create when the view is materialized by the user. The "Description" attribute allows one to provide some descriptive text about what the SQL view actually does. Finally, the "SQL statement" should contain the SQL view definition. Only SQL "SELECT" statements are allowed and certain sensitive tables (i.e. user information) are not accessible Press "Save" to store the SQL view definition.

18.7.2. SQL View management

In order to utilize the SQL views, simply press the "Execute query" button from the "SQL View management page. Once the process is completed, you will be informed that a table has been created. The name of the table will be provided, and is composed from the "Description" attribute provided in the SQL view definition. Once the view has been materialized, click on the "View" button .

18.8. Organisation unit merge

This function is useful when two organisation units need to be merged, eg. it is decided that one facility will be shut down and its services will be provided by a nearby facility.

Start by selecting the organisation unit to eliminate from the tree and click confirm. Then select the organisation unit to keep and click confirm again. Finally, verify the selection and click merge.

In the sitation where data exist for the organisation unit to eliminate and not for the one to keep, the data will be moved to the one to keep. When data exists for both organisation units, the data will be summarized and moved to the one to keep. When data exists only for the one to keep, no action is taken. The organisation unit to eliminate will eventually be deleted.

18.9. Duplicate data elimination

This function is useful when data has been entered mistakenly for two data elements which represents the same phenomena.

Start by selecting the data element to eliminate from the list and click confirm. Then select the data element to keep and click confirm again. Finally, verify the selection and click merge.

In the situation where data exists for the data element to eliminate and not for the one to keep, the data will be moved to the one to keep. When data exists for both data elements, the data which was updated last will be used. When data exists only for the one to keep, no action will be taken. The data element to eliminate will eventually be deleted, except when it is a multidimensional data element and has other data registered.

18.10. Data statistics

The data statistics module provides an overview of the number of objects stored in the DHIS2 database.

The total number of each type of object is presented in a table, as well as a graph.

18.11. Lock exceptions

Lock exceptions provide fine-grained control over exemption from a locked data set. After the expiry of the data set, data entry will be denied by default, unless an exception has been granted through the Lock exception interface. To enable a lock exception, select the desired organization units, data sets, and time period and press "Add". By granting a lock exception, data entry will be enabled even after the expiry period of the data set has passed.

In the example above, a data lock exception would be created for "ab Abundant Life Organization" and "ab Seventh Day Hospital" for the "Care and Support" dataset for "February 2012".

18.12. Zero value storage

The zero value storage function makes it possible to define for which data elements the system should store zero values. In most cases zeros are significant only for a subset of the data elements in the database. Any zeroes entered during data entry will be ignored by default, except for data elements where the zero value storage has been enabled.

18.13. Organisation unit pruning

If you need to prune out branches of the organisational unit hierarchy, you can use the organisational unit pruning function. Keep in mind that the only selected organisational (and its children) will be kept. All other orgunits (and any data associated with them) will be deleted from the database.

18.14. Min-Max Value Generation

This administrative function can be used to generate min-max values, which are used as part of the data quality and validation process for specific organization units and data sets. Simply select the dataset from the left hand frame, and then select the required orgunits to generate the min-max values for from the organisational units selector on the right. Press the "Generate" button to generate or regenerate all min-max values. Press "Remove" to remove all min-max values which are currently stored in the database.

18.15. Constant

Constants are static values which can be made available to users for use in data elements and indicators. Some indicators, such as "Couple year protection rate" depend on constants which usually do not change over time. Simply press "Add" and provide a name in the "Name" field and define it's value in the "Value" field. Press "Add" . The constant will now be available to users for use in their expressions.

18.16. Option sets

Option sets can be associated with data elements in the add / update data element interface for name-based data elements. You can define any kind of options, for instance an option set called "Delivery type" where "Normal", "Breach", "Caesarian" and "Assisted" would be the options. This option set can later be associated with any number of data elements. When doing data entry in name-based records module those elements will then appear in the form as drop-down lists with auto-completion support.

18.17. Cache Statistics

This option is for system administrators only to use. The cache statistics shows the status of the application level cache. The application level cache refers to the objects and query results that the application is caching in order to speed up performance. If the database has been modified directly the application cache needs to be cleared for it to take effect.

18.18. Dynamic attributes

Dynamic attributes can be used to add additional information to certain objects (namely data elements, indicators, organisation units and users). In addition to the standard attributes each of these objects have, it may be required in certain installations to have additional attributes, such as a fax number which is associated with an organisation unit. To add a new dynamic attribute to an object, select "Maintenance->Data administration" from the main menue, then "Attribute" from the left side panel, and press the "Add new" button.

To create a new attribute, assign it a name. Each attribute should have a unique name. Check the tick-box "Mandatory" if the object should always have the dynamic attribute. Next, select which object (or objects) the attribute should be assigned to. Lastly, select the value type. You can choose from "Text", "Yes/No", "Date", "Number", "Integer", "Positive integer" and "Negative integer". If the value supplied for the attribute does not match the value type, an error will result. Finally, click "Save" to save the attribute.

The dynamic attribute will now be present in the object which you assigned it to in the respective "Edit" screen of each the object.

18.19. Scheduling

Data mart jobs can be automatically scheduled to run on regular intervals. Simply select the aggregation period types, organisation unit group set aggregation level, and strategy to configure how the scheduled job should run. Pressing "Start" will enable the scheduled job to run at a pre-determined time or can be run immediately by pressing "Execute now"

Chapter 19. Settings

The settings module provides a set of application configuration options. There are two main groups of settings: the system settings apply to the whole system and all its users while the user settings apply to the environment of the currently logged in user.

19.1. User settings

The user settings section provides general configuration options and options specifically for email.

19.1.1. User general settings

  • Interface language: Sets the locale / language of the user interface, such as labels, menus and headers. You can currently select between 18 languages.

  • Database language: Sets the locale / language of the database contents in the system, such as the list of data elements and reports.

  • Sort order property: Sets the property for which to base the sorting of the element lists in the system, such as the list of data elements and indicators. Available properties are name, short name, alternative name and code. For instance, if you set the sort order property to short name, all lists will be sorted based on the short name property. You can also do manual sorting of all lists by going to the desired list and click "sort" and perform the sorting. This sorting can then be enabled by selecting custom as the sort order property.

  • Display property: Sets the property which will be displayed in the element lists in the system, such as the list of data sets.

  • Style: Sets the style / look-and-feel of the system. You can choose among four different styles while the light blue style is the default and recommended style. The user setting overrides the corresponding style system setting.

  • Dashboard charts to display: Sets the numer of charts to display on the front page of the dashboard module. For small screens, four charts are recommended while eight charts are recommended for widescreens.

19.1.2. User message settings

  • Message email notification: Decides whether you want to receive email notifications. Currently the system offers email notifications of messages received in the dashboard. This requires that you have entered your email address in your personal account details - you can access it under "Help" - "User account".

19.2. System settings

The system settings section provides general configuration options and options specifically for appearance and email.

19.2.1. System general settings

  • Aggregation strategy: This setting defines how the system generates and provides aggregated data to the output tools. There are two options available: Batch means that all output tools like reports, charts and maps will read aggregate data from pre-built data mart tables in the database. This strategy provides the best performance and inflicts less load on the application since data retrieval only implies reading from one or a few database tables using a simple query.

    This strategy requries that those data mart tables are populated with the relevant data before the reports are requested. This can preferrably be done using nightly scheduled jobs or manually through the data mart user interface. A potential downside is that users will have to wait to the next day to view their reports after doing data entry. This approach is the recommended for large online deployments where there are medium to high user concurrency.

    Real-time means that aggregated data is generated and retrieved on-the-fly every time a report is requested. This implies that there is no delay after doing data entry before the data is accessible in reports. Performance will not scale adequately and hence this strategy is suitable for small, typically offline, deployments.

  • Infrastructural data elements: This setting defines a data element group where the member data elements should describe data about the infrastructure of organisation units. Examples of such infrastructural data elements could be population, doctors, beds, internet connectivity and climate. This infrastructural data can currently be viewed in the GIS module in the facility information sheet.

  • Infrastructural period type: Sets the frequency for which the data elements in the infrastructural data elements group are captured. This will typically be yearly. When viewing the infrastructual data you will be able to select the time period of the data source.

  • Feedback recipients: This setting defines a user group where the members will recieve all messages being sent through the function for writing feedback in the dashboard module. This will typically be members of the super user team who are ablet to support and answer questions coming from end-users.

  • Completeness notification recipients: This setting defines a user group where the members will receive messages as notifications when a form has been marked as complete. A typical use of this is when the forms are considered to be an order of some commodity and a group of users want to be notified when such orders are placed.

  • Omit indicator values with zero numerator value in data mart: Defines whether aggregated indicator values with zero as the numerator value should be written to the indicator data mart table. Having such values written is required for instance when connecting Excel pivot tables to the data mart as Excel will need the numerator data to correctly aggregate up in the organisation unit hierarchy. If third-party tools like Excel are not used with the application this will reduce the total number of values written to the data mart (which again will improve performance) and could safely be set to omit.

  • Disable data entry when data set completed: This setting defines whether the data entry forms should be disabled and prevent from futher entry after they have been marked as complete.

  • Data analysis std dev factor: Sets the number of standard deviations for use in the outlier analysis performed on the captured data in the data entry module. The default value is 2; a high value will catch less outlier values than a low value.

  • Days after period end to qualify for timely data submission: Sets the number of days after the end of a period in which a data entry form must be marked as complete in order to be considered timely. This affects the "reporting rate" tool in the reporting module which lists forms marked as complete as well as marked as complete in time. The default value is 15.

19.2.2. System appearance settings

  • Application title: Sets the application title to the left on the top menu.

  • Style: Sets the style / look-and-feel of the system. The corresponding user style setting overrides this.

  • Flag: Sets the flag which is displayed in the left menu of the dashboard module.

  • Start page: Sets page / module which the user will be redirected to after logging in. The dashboard module is the recommended start module.

19.2.3. System email settings

  • Host name: Refers to the host name of the SMTP server. For instance when using Google SMTP services this should be smtp.gmail.com.

  • User name: The user name of the user account with the SMTP server. For instance mail@dhis2.org.

  • Password: The password of the user account with the SMTP server.

Chapter 20. DHIS Mobile

20.1. Introduction

DHIS2 provides a range of options to allow data entry from mobile devices, including a dedicated GPRS/3G J2ME client, a SMS based client, and a version of DHIS2 which has been optimized specifically for mobile browsers. Each of these solutions will be described in detail in the following sections.

Collection of data in the field can be technically challenging and expensive. Mobile phone solutions has the potential to significantly reduce the complexity of deploying a distributed data collection system. Using a simple Java client installed on a mobile phone or a web browser which works on the mobile phone, field workers can report directly to the DHIS2 database through their mobile device.

While mobile phone solutions have a great potential, it is also an area that can be difficult to "get right". Phones lack processing power and have a small display, need to be charged and often makes the most sense in areas where mobile network coverage is weak and patchy.

There are currently three main mobile solutions for DHIS2, and we continue to evolve these as well as look at other possible solutions:

  • A mobile browser optimized data entry module

    This module allows for data entry directly with the browser of the mobile device. A wide range of devices and mobile browsers are supported including: Opera mini 3 & 4 (basic and advanced) - Opera mini 4, Nokia S40 mobiles ,Windows Phone 7, Window Mobile 6, Palm Pre, Blackberry (v5 and v6), Firefox mobile, iOS devices (iPhone) and Android devices. This client does not have offline-support, and an active GPRS/3G connection is required. It does not require a new application installation on the phone to support new features, but does require a stable data connection for use. This solution is described in Section 20.2, “Mobile browser based data entry”

  • J2ME GPRS/3G client (one client for facility reporting and one for program tracking)

    DHIS-mobile includes two separate J2ME clients supporting GPRS as a transport. One clients supports facility aggregate reporting and the second client supports name-based program tracking. These clients are split into separate applications to make deployment easier. Some health workers may have both applications installed on their phone. Both of these clients support offline-storage of data. Section 20.3, “J2ME GPRS/3G Client”

    An active GPRS/3G connection is required in order to send data to the DHIS2 database, but data can be entered offline and transmitted when a connection is present. This client is intended primarily for low-end devices which support J2ME applications, although the offline-supports adds some memory requirements which limits the handset selection. While the solution is primarily tested on Nokia phones, it also works on several other J2ME capable handsets.

    The facility reporting J2ME client is described in Section 20.3.2, “J2ME GPRS 3G facility reporting client”

    The name-based program tracking J2ME client is described in Section 20.3.3, “J2ME GPRS 3G program reporting client”

  • Legacy J2ME client with SMS transport

    DHIS2 can also be used with an earlier J2ME-client that uses SMS as a transport. This client requires some manual configuration on the server side, and is not supported by the standard build of DHIS2. The client is a custom built J2ME mobile application. The SMS-support is separate from the SMS support used in other parts of DHIS2. The solution has mainly been deployed using GSM modems, which are not good for high-volume applications, but can also be used as a basis for a more reliable SMSC-connection. Using SMS as a transport would be an appropriate solution where GPRS/3G is not available, but GSM coverage is available. Updating of forms to the client is not supported at this point in time, and new data sets require a new application install. This solution is described in Section 20.4, “Legacy J2ME client with SMS transport”

    The DHIS-mobile team is working on a hybrid GPRS and SMS solution that is based on the newer J2ME-client and the new SMS-support within the platform.

20.2. Mobile browser based data entry

20.2.1. Getting started with mobile browser data entry

This approach is for data-entry on a smart phone with a mobile browser by navigating to the URL of the DHIS2 instance, for example: the full URL link for demo on dhis2.org http://apps.dhis2.org/dev/mobile/index.action . And your mobile browser will automatically detect the DHIS2 application where the server URL is given (e.g: http://apps.dhis2.org/dev). Here is the login form to access the application with user-name and password. Click on "Login" to continue or "Reset" to reset:

After logging in, there are the list of functions:

- Data Entry: Entries for aggregate data with defined/assigned dataset by organisation-units

- Name-based Data Entry: Entries data for the beneficiaries by organisation-units, beneficiaries and programs/program-stages.

- Beneficiary Registration: Registry a new beneficiary

- Beneficiary Enrollment: Enroll a beneficiary to one or many programs

- Messages: Manage the messages and discussions from the server. Message reply is available.

- Reports: The output reports from the server

- Settings: User-information (e.g: First-name, Surname, Phone number, E-mail) and the Interface language.

- Feedback: the extra function for creating a new message to send to the server. The new created feedback from this will be listed under "Messages"

- Logout: to log out the application

- Desktop version: navigate to the desktop version of DHIS2 for administration. This require a lof of resources from the client mobile, for example: the sufficient memory to load the pages. Not recommended for the nornal GPRS/3G/... phones.

The list above will be explained in details:

  1. Data Entry: Entries for aggregate data with defined/assigned dataset by organisation-units.

    Click on the "Data Entry", then choose an Organisation Unit from the list and the list of the datasets will be appeared for entering aggregate data. See the below example:

    Step 1: Select an Organisation Unit from the list

    Step 2: Select a Dataset (entry form) from the list

    Step 3: Select a period (based on the period type of the chosen dataset) from the list

    Step 4: Entering the data

    Step 5: Save the data entered after completing the data, choose the option for data completeness if having.

  2. Name-based Data Entry: Entries data for the beneficiaries by organisation-units, beneficiaries and programs/program-stages.

    After clicking on the "Namebased Data Entry", the next will guiding to the selections in the following steps:

    Step 1: Choose an Organisation Unit

    Step 2: Choose the Activity Type

    (the screen-shot with an example with "Current Activity Plan" option)

    There will be normally these two type of Activity:

    + "Current Activity Plan": the list of the beneficiaries registered, enrolled, not yet finish/complete a/many program and there is at least a program-stage open for data-entry.

    + "All Activity Plan": the list of all beneficiaries registered, enrolled, not yet finish/complete a/many program.

    Step 3: Choose a Beneficiary for entry

    (the screen-shot with an example with "Hybia Welde" option)

    Step 4: Choose a current and active program-stage for entering the data

    (the screen-shot with an example with "16-24 months after birth" option)

    You can also see the beneficiary's information (ID, gender, Date of Birth, and Blood Group) by clicking on the Details (on top of the list appeared)

    The details information of the chosen beneficiary:

  3. Beneficiary Registration: Registry a new beneficiary

    Step 1: Choose an OrganisationUnit

    Step 2: Fill in the Beneficiary Registration form

    There necessary information: Full Name, Gender, Date of Birth (and Blood Group).

    Click on "SAVE" to register a new beneficiary.

    A message "Successfully Saved" will appear when the beneficiary is created/registered successfully.

  4. Beneficiary Enrollment: Enroll a beneficiary to one or many programs

    Before enrolling a beneficiary to a program, the search function for a beneficiary is provided:

    If the beneficiary is found, the result will be listed. The simply click on the beneficiary name for navigating to the programs in which the beneficiary enrolled:

    The below screen-shot example describes the beneficiary named "Nguyen Van A":

    - Has not enrolled any programs before

    - There is one program: "Child Health Program" available for enrollment

    The list of the available programs for enrollment will be listed. Just click on the program for enrollment by specifying the date of enrollment and the date of incident. See the example:

    After clicking on the "ENROLL" button, if successful, the program enrolled will be listed under "Enrolled Programs for" + <Name of the beneficiary>, see the example:

  5. Messages: Manage the messages and discussions from the server. Message reply is available.

    The number showed is the unread messages. Click on that to view the list of the messages (the unread messages are in bold and dark blue color):

    Then you can pick up the message/topic for the discussions by leaving the reply message, see this example:

  6. Reports: The output reports from the server

    (will be updated)

  7. Settings: User-information (e.g: First-name, Surname, Phone number, E-mail) and the Interface language.

    Here is the form for setting the user account/access and the interface language. Click on "SAVE" for completing the settings, see the example below:

  8. Feedback: the extra function for creating a new message to send to the server. The new created feedback from this will be listed under "Messages"

    After clicking on the "Feedback", there will be a form for editing/sending out a new message/discussion. See the example below:

    After sending out the new feedback, the message (feedback) will be listed under "Messages" for further following up.

  9. Logout: to log out the application

  10. Desktop version: navigate to the desktop version of DHIS2 for administration.

    Here is the GUI of the desktop version (which require much memory for loading), not recommended for normal mobile. The example with DHIS2 Demo (from dhis2.org)

20.3. J2ME GPRS/3G Client

The DHIS2 GPRS/3G mobile module provides a mechanism for remote clients using mobile phones to enter data directly into the DHIS2 system. There are two functions of the client, namely:

The solution relies on the mobile phone having a data connection available (i.e. GPRS, Edge, 3G), over which it communicates with a DHIS2 instance which must be publicly available on the internet, as any other web server. The client application on the phone downloads the data entry forms to the phone from the server, and the forms can therefore be updated without installing a new application. This is also a crucial feature for community reporting, which relies on regularly downloading activity plans from the server.

  • Facility reporting, for data entry and reporting of regular DHIS2 aggregate data,

  • Activity reporting, for supporting individual activity reporting with the Community module.

20.3.1. Data connection availability

Data connection availability can be a problem in many of the contexts where DHIS2 mobile reporting would otherwise be a good solution for getting data directly into DHIS2. If that is the case for you, you might want to consider trying the SMS based solution described in a separate document. Keep in mind that even though a data connection is currently required for communication between the server and the mobile phone, it is only required when initializing or updating the mobile application and when sending reports to the server. The phone stores all entered data locally, so it it can work fine with only temporary access to a data connection on a regular basis.

20.3.2. J2ME GPRS 3G facility reporting client

The server side component of the web based solution is included in the general build of DHIS2.

In order to configure the DHIS2 web-based mobile reporting, you should follow the following steps.

  • Set the "Available for Mobile Reporting" flag for the data sets you want reported: Under Maintenance->DataSet->Edit mark the “Available for Mobile Reporting” check box and save.

  • Create a user role for the mobile user. Select Maintenance->Users->User Role->Add new. Add a user role name and description. Add the desired data sets for the role. The mobile user role will need to have at least privileges for DHIS Web API. Save the user role by clicking "Save".

  • Create a user which will be used by the client to login from Maintenance->Users->User ->Add new. Fill in all of the required details, keeping in mind that the password must be at least 8 digits long, contain one capital letter,and one digit. Assign the desired user role to the user which was created in the previous step.

    [Important]Important

    Assign the user to exactly one organisation unit. Each mobile reporting client will need their own user name and password.

20.3.3. J2ME GPRS 3G program reporting client

Like facility reporting module, sever side of activity reporting included in DHIS2 war file.

Basically, server side setup for activity does not require any additional step. The mobile application use the same user name and password as the web-based application. Make sure that the user is assigned to the correct organization unit.

In short, if a user is able to enter data for activity reporting in DHIS2 web-based application, he/she is able to download and enter data in mobile application.

20.3.4. Detailed configuration of data sets and reporting forms

Though the previous steps is all that should be needed for testing the solution more detail configuration of the datasets may be required and are described in the following sections.

20.3.4.1. The mapping of data sets to form layout on the phone

By default, a data set is mapped to a single form on the phone. If the data set is divided into sections, each section is displayed as a seperate page on the phone. If a data element has more than one category option combo it will be displayed as a heading with the category combination options following.

Table 20.1. 

Form design element DHIS2 Metadata Metadata element
Form titleData setShort Name if it exists, otherwise Namw
Page tileSectionSection name (or form name if no sections)
QuestionData element Alternative name if it exists, otherwise Name
Question name if combosCategory option comboname

20.3.4.2. Sorting of forms

By default, data elements will be sorted according to the global sorting assigned in DHIS2. If sections are used, their section specific sorting order will be used. In some cases, when sections are not used, a data element might be used in multiple data sets, and conflict in the way it should be sorted in individual data sets. A work around for this situation is to wrap the whole dataset in one section (note that this will only work if the data elements have the same category option combo)

20.3.4.3. Versioning of data sets

To make it possible to compare and update the data sets on the mobile phone with the version on the server, data sets are automatically versioned when you edit the data set structure. Some changes which occur on the DHIS2 server, will cause the mobile client to update its forms with a new version.

Changes that currently trigger a new data set version

  • Create DataSet

  • Edit DataSet

  • Create/edit/delete Section in DataSet

  • Sort Section Order

  • Update DataElement (affect many related DataSets)

  • Delete DataElement (affect many related DataSets)

  • Edit DataElement Category

  • Edit DataElement Category Combo

20.3.4.4. Language support

Multi-language support is available.

DataSet and DataElement are translated through web-based function. Default language on server is used on mobile in cases requested language from mobile is not available.

20.3.5. Mobile application setup

20.3.5.1. Installation and initialization

20.3.5.1.1. Installation

Download the jar packages from the DHIS 2 homepage: dhis2.org

The URL download for each packages:

+ Facility reporting

+ Program Tracking

20.3.5.1.2. Initialization

Initialization should be performed before the phones are delivered end-users. Given the large variation in possible phone configurations, it is impossible to describe the exact steps which are required in order to enable the client on the phone. However, for most phones, simply copying the DHIS Web Mobile client "JAR" file to the phone with a USB cable or via Bluetooth is sufficient. Of course, GPRS/3G connectivity must be enabled. Contact your mobile service provider for exact details on the configuration of the phones and networks.

Once the client has been installed ot the phone, an initialization process must occur by providing a user name, password and server URL.

  1. Logging into the server for the first time.

    The first time the client logins to the server, or if the client is reinitialized, the username, password and server URL must be entered.

    If the client is unable to login, there could be several possible error messages which you see.

    • Connection Not Found: The specified server URL is not correct. Check the server address, ensure that the server is actually reachable, and try again.

    • Invalid User Name Or Password: the username or password is incorrect

    • Application not authorized to access restricted APIe : The server can be contacted, but the user does not have the necessary permissions to access the mobile reporting module

  2. Setting the PIN number: After the initial login process, a PIN number can be entered by the user. This will make the login process much easier, as the user only has to remember the four digit pin number, as opposed to typing in the user name and password each time. The PIN number can be preset if the phone is initialized prior to delivery, or it can be set by the users themselves if they have been provided with usernames and passwords.

    After entering the PIN, press (Menu)->Next.

  3. Download all forms: After the PIN has been specified, all forms will be downloaded from the server and stored locally on the phone..

    If the user has been configued to report on aggregate datasets, a list of appropriate datasets will be displayed. If the user is responsible for community based reporting, the list of assigned activities is displayed.

    Notes: If the Health Worker is responsible for both Facility Reporting and Community Reporting, DHIS server will send all forms of both Facility Reporting and Community Reporting to mobile and on mobile, there will be a screen to choose whether displaying Facility Reporting or Community Reporting.

    Errors:

20.3.5.2. Logging in (for regular use)

After starting the application, the PIN form is displayed.

  • PIN: Enter the four digit number PIN.

  • Reinitialize Command: this function will clear all data on mobile and we start from the login screen with username and password.

  • Errors: Invalid PIN: If the user has entered an invalid PIN, they will need to enter the correct PIN, or reinitialize the application with the correct username and password.

20.3.5.3. Facility Reporting Module

20.3.5.3.1. Entering data

After selecting an aggregate dataset from the "Select report form" window, the user will need to select an appropriate time period. A list of available time periods is automatically generated.

  1. After the user has entered their PIN, they can select from a list of available datasets. Select the appropriate dataset and press "Next".

  2. Choosing periods: A list of available periods will be automatically displayed to the user. They can select the appropriate period from the list.

  3. Fill in values: After choosing the period, the form can be displayed in two modes, depending on the

    • Form with sections

      Each form section is displayed in a single screen with the name of the section in the title window.

      To navgate from screen to screen, push "Next".

    • Forms without section (Datasets without sections)

      All fields are displayed on one screen with the title that is the name of DataSet

    The user simply fills in each data element with the appopriate value.

  4. Save and Complete:

    After finishing data entry, the user can choose to save the data locally on the phone or to upload the data directly to the DHIS2 server.

    If the user saves the data form, they can edit the form at a later point in time if they need to.When selecting a period once again, the period will be marked as "Saved' as seen in the next screen shot.

    If the user selects "Complete", and the data entry form is not complete, the user will be asked if they are certain they wish to submit the form as incomplete. Once the form has been submitted, a message should be displayed informing the user that the transmisison was successful.

20.3.5.3.2. Notes
  1. Period list:

    Periods marked with an asterisk (*) is the period that is completed or saved, depending on the status of the data entry.

    All periods that are not in period list are considered old and will be deleted automatically.

  2. Storing values duration

    The number of saved forms on mobile are limited only by the effective amount of storage of the moble device.

    Forms are saved for limited period only, depending on the frequency of collection of the particular dataset.

    • Daily Forms: 2 months (current and previous month)

    • Weekly Forms: 4 weeks (current and 3 previous week)

    • Monthly Forms: 2 months (current and previous month)

    • Quarterly Forms: 2 quarters (current and previous quarter)

    • Yearly Forms: 2 years (current and previous year)

  3. Completed forms - Uneditable forms

    If the form has been completed, the user can view the form on their phone, but they cannot make any subsequent edits to the form. Each field is greyed out and inactive for editing.

  4. Re-Edit completed forms

    If the user wishes to edit data which has already been submitted to the server, they can do so by pressing the "Edit" button. They are allowed to do this assuming that the dataset has not been locked for the period in question. If they attempt to upload the data, the user will be informed that the dataset has been locked, and it is not possible to upload the data.

  5. Update Forms:

    This function is used to synchronize the forms on mobile and on server. The process is automatically triggered after entering PIN number.

    Note: Checking and downloading updated forms process run in background. After finished, prompt is displayed to ask user whether refresh form list or stay where they are.

  6. Multi-Language Support:

    This function help user to choose language of mobile's GUI (graphical user interface) and content's language (Forms).

    The forms must be translated on server, otherwise, default language is used.

    Default language of first login is English. Change language in Setting menu will affect both interface and content.

    Multi-Language Interface: In Setting menu, there are list of supported language (downloaded from server). Language of GUI is only changed after restart application.

    Multi-Language Content (forms): Form's language is change after click "Save". In case there are many forms, it take several minutes to save setting.

20.3.5.3.3. Troubleshooting
  • Data has been entered on the phone but does not appear on the server

    This usually occurs when users enter data on the phone, but cannot send it to the server. This may be because of the configuration of the phone, lack of credit on the phone, or lack of coverage. Usually an error message is displayed as shown below.

    Users should be informed that if they see this error, then it means that their data has not been transmitted.

20.3.5.4. Community Reporting

The community based reporting function works in a similar manner as the aggregate reporting function, but patient based data elements.

20.3.5.4.1. Regular Use
  1. Activity Main Menu

    • Current Activity Plan: Contain all new activities that need to be completed.

    • Sent Activity Plan: Contain all the activities that have been completed and sent to server. This list is for review only.

  2. Choose Village or Location

    From Activity main menu, select “Current Activity Plan”. You will be navigated to “Grampanchayat Name” screen where you can select the village. Use the “Up” or “Down” button on your mobile phone to focus on a village. Use “Select” button to select a village.

  3. Choose Beneficiary

    In a village, beneficiary name will be display in a list. User can use the "Select" button to view the activities of the selected name.

  4. Choose Activity

    Each Activity is represented by the name of the Beneficiary. Select the name of the beneficiary you want to view. Note that the name start with “*” means that this is a late Activity.

  5. Beneficiary Detail

    Select the "Detail" command on the left of the activity screen , a Beneficiary Detail screen will be displayed. The detail screen may contain personal information and some additional information of the Beneficiary (depends on the setting from server). Select “OK” to go back to activity screen.

  6. Fill in values (Entry screen)

    On the top of the screen is the name of the Program Stage. Below is the form, a form include many fields for user to input data. Focus on a field by press the “Up” or “Down” button on your mobile phone. After the field is focused, you can start entering data. Press the “Up” or “Down” button to go to the next field. At the bottom is the menu with "Save", "Complete" and "Back" command.

    *Notes:

    • For the field with Yes/No value: press the select button on a focused field to open the popup menu then you can select “Yes”, “No” or “Select Option”. Select “Select Option” means that you have no data for that field.

    • For the field with pre-suggested values: press the select button to open the popup menu then you can choose one of the options. Select “Select Option” means that you have no data for that field..

    • For date-type value:

      - If server Date is available, application will take server Date as default value.

      - If server Date is not available, date filed will be leave blank for user to input manually.

  7. Saving/Completing.

    After finish step [4], you can choose either “Save” or “Complete” to finish your work.

    • Save: you may want to use this option if you have not finished your work yet and you want to store the data to continue later.

      • Select “Menu” or “Option” at the bottom of your screen (The name “Menu” or “Option” depend on your mobile phone) and then select “Save”. A success message (“Form Saved”) will be display. Select “Done” or “Dismiss” to go back to Entry Screen.

      • Your data will not be sent to server. It is stored in the Record Store of your mobile phone. To see the data again. Go back to step [2] and select the name of the Beneficiary that you have just entered data. Repeat step [3] and [4]. If you feel that you are ready to send data to server. Select “Complete”.

    • Complete: you may use this option when you fill the entire field on the form and make sure that your data is correct.

      • Select “Menu” or “Option” at the bottom of your screen (The name “Menu” or “Option” depend on your mobile phone) and then select “Complete”.

      • If you did not fill all the field in the form, a warning message will be display “x fields is not filled. Do you want to complete anyway?” With x is the number of empty field(s). Select “Yes” if you want to send data to server, select “No”, if you do not want to send and go back to Entry screen again.

      • After select “Yes”, a security message will appear and inform that the application will connect to server. Select “Yes” to give the permission for the application to do so.

      • User will receive a success message: “Activity uploaded successfully”.

      • A finished activity (activity that is completed and data is send to server) will be move to "Completed Activity" and it will be display as "Uneditable Form". User can go to "Completed Activity" at "Activity Main Menu" to review.

  8. Sent Activities

    From "Activity Main Menu" screen, select "Sent Activities" to go to the list of all activities you sent to server. The structure of this screen is exactly the same as "Activity Plan List". Select "Detail" to see the detail of the activity of select "Select" to go to the "Uneditable Screen".

    In this screen, user can only review the form they sent to server. No edit or change is allowed. Select "Back" to go back to "Sent Activities" screen.

20.3.5.4.2. Updating Activity Plan and Program Form

After some days, weeks or months, new Activities may automatically generated from server, some Program Stage Data Element may be removed from original form. In order to update these new changes, we have a "Automatic Update Activity Plan and Program" function.

  1. This function is completely automatic. After user start the application and enter PIN, a requested to be sent to server to update new data.

  2. While this function perform, the "Current Activity Plan" is temporarily blocked and it will be open again as soon as the updating process complete.

  3. This function update both "Activity Plan" and "Program Form".

    “Update Completed” message will appear on the screen after the update process finish. Select ”Dismiss” to close this window and go back to Activity Main Menu. Your Current Activity Plan is now updated.

  4. When a data element removed due to the changing of form structure, all data value that related to that data element will be hiding also. You are no longer seeing the value in the form.

20.4. Legacy J2ME client with SMS transport

With the J2ME client with SMS transport solution, the forms filled in on the phone is sent using SMS messages to a central server. The SMS message is decrypted and converted, and then imported into the DHIS2 database.

By default, DHIS2 does not ship with the DHIS SMS Mobile web module. You will need to build in these modules yourself. You also need to modify the client side application with your own data elements.

20.4.1. Build DHIS2 with the dhis-web-mobile module

  • Download the latest source code from launchpad, i.e. the DHIS2 trunk source code from https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

  • Build DHIS2 as normal, by running mvn clean install (to skip tests, use mvn clean install -Dtest=false -DfailIfNoTests=false ) in the dhis-2 and dhis-2\dhis-web folders.

  • Build the mobile modules by running mvn clean install in the dhis-mobile folder.

  • Modify the dhis-web-portal\pom.xml file, adding a dependency to dhis-web-mobile:

    <dependency>
        <groupId>org.hisp.dhis</groupId>
        <artifactId>dhis-web-mobile</artifactId>
        <version>${version}</version>
        <type>war</type>
    </dependency> 

  • Build the portal ( mvn clean install in the dhis-web-portal folder)

  • Copy the dhis.war file from dhis-web-portal\target to the tomcat\webapps folder. Rename it if you want.

20.4.2. Install the GSM modem

  • Driver for the GSM modem

    Plug in your modem and install the drivers. You might have to use the manufacturer's provided drivers from a CD or their web page. You might need administrator privileges to do this. If you still can't do it, try starting Windows in Safe Mode.

  • comm.jar

    Copy it to your java\jreX\lib\ext folder. If you've got multiple installations of JRE, you can find the path to the installation used by DHIS 2 by right clicking the Monitor Tomcat icon in the system tray, then Configure -> Java.

  • javax.comm.properties

    Copy it to your java\jreX\lib folder.

  • win32com.dll

    Copy it to your java\jreX\bin folder.

    Note: You might need administrator privileges to do this. If you still can't do it, try starting Windows in Safe Mode.

  • SMSserver.conf

    Copy it to your DHIS2_HOME folder (the folder where hibernate.properties is located). The settings in this file can also be modified from the Settings page in the mobile module in DHIS 2.

    In this file the manufacturer and the model of the GSM modem are specified. Also, make sure the PIN code for the SIM card in the GSM modem is turned off, and set modem1.pin=0000 in the SMSserver.conf, or use the Settings page in the mobile module in DHIS 2 to set the pin to 0000.

    The port of the modem also needs to be specified in this file. After the drivers are successfully installed and the modem is installed in a usb port, you can find the port of the modem by opening Device Manager, locate your modem and right click on it, click on Properties and navigate to the Modem tab. There you'll see which port is assigned to the modem.

    Important: Note that if you install the modem into another usb port another time, the port will change, and you will have to update the settings. If you for some reason need to take the modem out of your computer, make sure you'll install it in the same usb port as last time, or else you'll have to update the SMSserver.conf file.

  • formIDLayout.csv

    Copy it to your DHIS2_HOME\mi folder. If you have not yet deployed your latest build of DHIS2, you'll have to create the mi folder manually.

    This file specifies which data elements are to be imported. There's one line for each different mobile application in use. The lines start with a mobile application's id, then followed by comma separated data element ids and their categoryoptioncombo ids. The lines will be on the form

                      1 = <data element id>.<categoryoptioncombo id>, 
                      <data element id>.<categoryoptioncombo id>, ... , 
                      <data element id>.<categoryoptioncombo id> 

    E.g.

    1 = 652.207, 652,208, 20485.271, 20485.272, 683.14

    Note: If the same mobile application is installed on several phones, the id for each application is the same! The formIDLayout.csv file should thus only have one line, starting with 1 = .

20.4.3. Register users

The phone numbers of the cell phones used for reporting with the mobile application needs to be registered in DHIS 2 in order for the data to be imported and stored in the database. A phone number has to be registered for a user, and the user can only be associated with one organisation unit!

The phone number must include the regular phone number as well as the country code without + or 00 . E.g. for a Norwegian number, having the country code 47 and phone number 98765432 , the phone number to store is 4798765432 .

20.4.4. Install the mobile application on a phone

If you've got a phone and a computer with Bluetooth, you will in the most cases be able to send the .jar file (the mobile application) via Bluetooth from the computer to the phone. When using a cable, and also in some cases for phones with Bluetooth, you might have to install some software to be able to communicate with the phone. E.g. Nokia PC Suite for Nokia phones.

Once the mobile application is installed on the phone, open it and navigate to the last page in the application. Select settings, and enter the number of the SIM card in the GSM modem. This works both with and without country code.

If there are several GSM modems installed on several computers running DHIS 2 and you want to report to all of these, you can enter the numbers of the SIM cards installed in these GSM modems as well in the remaining fields in your mobile application. When clicking send, the application will now send the registered data to all the registered numbers at the same time.

20.4.5. Using the system

Navigate to the Mobile module via Services -> Mobiles

20.4.5.1. Start the SMS Service

From the start-page DHIS2, go to Maintenance >> Mobile Configuration:

Then choosing the "SMS Service Configuration":

The SMS Service Configuration main-page with descriptions:

(The above screen-shot example with no gateway in the Gateways list)

If having no gateway registered, clicking on the "Reload Configuration" or "Start SMS Service" will have no use and a warning message appeared, see this screen-shot example:

Add or Update Gateway:

Currently, there are 4 gateway types:

Then fill in the information for the gateway (the screen-shot example with BulkSMS Gateway):

(The information for the gateway is from the Gateway providers)

After adding successfully the gateway, the service will automatically started.

20.4.5.2. Sending SMS

From the start-page DHIS2, go to Maintenance >> Mobile Configuration. Then navigate to "Show send SMS form":

At this moment (DHIS version 2.8), this is the one-way sending out the SMS messages from the servers to the recipients (with mobile phone numbers).

See the below example form to send out the messages to the recipients' numbers individuals or mobile number of registered Organisation Unit or by mobile number of the users assigned with Organisation Unit.

Below is an example screen-shot with listing of phone numbers (using ";" between the numbers in the list):

20.4.5.3. Receive Data and Import

To receive and import data, the SMS Service needs to be started.

20.4.5.3.1. Automated import of messages

When SMSs are sent from the phones while the SMS Service is running, the messages will be processed automatically, and the data will automatically be imported and stored in the database.

20.4.5.3.2. Import pending messages

If SMSs are sent from the phones to the SIM card in the GSM modem while the SMS Service is inactive, the messages will be stored as xml files in the folder DHIS2_HOME\mi\pending short time after the service is started. On the Receive Data and Import page it will say how many SMSs are pending. These can be imported by pressing the "Import All Pending" button.

Chapter 21. Data dimensions in DHIS2

21.1. The core building blocks describing the data

A data value in DHIS2 (core module for aggregated data) is at minimum described by three dimensions, 1) data element, 2) organisation unit, and 3) period, which also forms the core building blocks of the data model. E.g. if you want to know how many children that were immunised for measles in Gerehun CHC in December 2009, the three dimensions to that value are the Data Element "Measles doses given", the Organisation Unit "Gerehun CHC", and the Period "Dec-09". All data values have at least these three dimensions describing What, Where and When.

Table 21.1. 

Organisation UnitData ElementPeriodValue
Gerehun CHCMeasles doses givenDec-0922
Tugbebu CHPMeasles doses givenDec-0918


21.2. The data element dimension

21.2.1. Data element categories

The data element above called "Measles doses given", although capturing the core essence of what the data is can be further elaborated and disaggregated into what is called data element categories. The system administrators of DHIS are free to define any data element category dimensions to data elements using the user interface for this in the data element maintenance section, but here are some examples of possible categories to use.

Given the example of Measles vaccination, if you want to know whether these vaccines were given at the facility (fixed) or out in the community as part of the outreach services then you could add a dimension called e.g. "Place of service" with the two possible options "Fixed" and "Outreach". Then all data collected on measles immunisation would have to be disaggregated along these to options. In addition to this you might be interested in knowing how many of these children who were under 1 year or above 1 year of age. If so you can add an Age dimension to the data element with the two possible options "<1 y" and ">1 y". This implies further detail on the data collection process. You can also apply both categories Place of service and Age and combine these into a data element category combination e.g. called "EPI disaggregation" and thereby you would be able to look at 4 different more detailed values in stead of only 1 as in the example above for the data element "Measles doses given": 1) "Fixed and <1 y, 2) Fixed and >1 y, 3) Outreach and <1 y, and 4) Outreach and >1 y. This adds complexity to how data is collected by the health facilities, but at the same time opens up for new possibilities of detailed data analysis of Measles immunisation.

Table 21.2.  Example of detailed storage of data values when using data element categories "Place of Service" and "Age" (simplified for readability compared to the actual database table)

Organisation UnitData ElementPlace of serviceAgePeriodValue
Gerehun CHCMeasles doses givenFixed<1 yDec-0912
Gerehun CHCMeasles doses givenOutreach<1 yDec-094
Gerehun CHCMeasles doses givenFixed>1 yDec-094
Gerehun CHCMeasles doses givenOutreach>1 yDec-092
Tugbebu CHPMeasles doses givenFixed<1 yDec-0910
Tugbebu CHPMeasles doses givenOutreach<1 yDec-094
Tugbebu CHPMeasles doses givenFixed>1 yDec-093
Tugbebu CHPMeasles doses givenOutreach>1 yDec-091


21.2.2. Data element group sets

While the data element categories and their options described above dictated the level of detail (disaggregation) at the point of data collection and how data values get stored in the database, the data element group sets and groups can be used to add more information to data elements after data collection. E.g. if looking at a lot of data elements at the same time in a report you would want to group these based on some criteria, e.g. if looking at all the data captured in a form for immunisation and nutrition you might want to separate or group data elements along a programme dimension (called group set) where "Immunisation" (or EPI) and "Nutrition" would be the two groups. Expanding the report to include data from other programs or larger themes of health data would mean more groups to such a group set dimension, like "Malaria", "Reproductive Health", "Stocks". For this example you would create a data element group set called "Programme" (or whatever name you find appropriate), and to represent the different programmes in this dimension you would define data elements groups called "EPI", "Nutrition", "Malaria", "Reproductive health" and so on, and add all these groups to the "Programme" group set. To link or tag the data element "Measles doses given" to such a dimension you must (in our example) add it to the "EPI" group. Which groups you add "Measles doses given" to does not affect how health facilities collect the data, but adds more possibilities to your data analysis. So for the group set dimensions there are three levels; the group set (e.g. "Programme"), the group (e.g. "EPI"), and the data element (e.g. "Measles doses given").

Indicators can be grouped into indicator groups and further into indicator group sets (dimensions) in exactly the same way as data elements.

Table 21.3. 

Organisation UnitData ElementProgrammePeriodValue
Gerehun CHCMeasles doses givenEPIDec-0922
Gerehun CHCVitamin A givenNutritionDec-0916
Tugbebu CHPMeasles doses givenEPIDec-0918
Tugbebu CHPVitamin A givenNutritionDec-0912
Gerehun CHCMalaria new casesMalariaDec-0932
Tugbebu CHPMalaria new casesMalariaDec-0923


21.3. The organisation unit dimension

Organisation units in DHIS2 can be either any type of health facility like Community Health Centres or referral hospitals, or an administrative unit like "MoHS Sierra Leone", "Bo District" or "Baoma Chiefdom". Orgunits are represented in a default hierarchy following the health system at large, and are therefore assigned an organisational level. E.g. Sierra Leone has 4 levels; National, District, Chiefdom, and PHU, and all orgunits are linked to one of these levels. An orgunit hierarchy in DHIS can have any number of levels. Normally data is collected at the lowest level, at the PHUs, and then data values are linked to individual PHUs. When designing reports at higher levels with data aggregated by chiefdom or district, the DHIS will use the hierarchy structure to sum up all the health facilities' data for any given unit at any level. The orgunit level capturing the data always represents the lowest level of detail that is possible to use in data analysis, and the organisational levels define the available levels of aggregation along a geographical dimension.

21.3.1. Organisation unit group sets and groups

While PHU is the lowest geographical level for disaggregation in DHIS2 there are ways to flexibly group organisation units into any number of dimensions by using the group sets and groups functionality. E.g. if all PHUs are given an official type like CHC, CHP, MCHP etc. it is possible to create an orgunit group set called "Orgunit type" and add groups with the names of the types mentioned above. Then you can link your orgunits to their corresponding groups (orgunit types). Other common orgunit dimensions are Rural/Urban (Rural, Urbal, Peri-urban), and Ownership (Public, Private. NGO etc.). When analysing data from the PHU level it then becomes possible to aggregate data by these dimensions, e.g. look at Measles immunisation in BO district by the type of PHU in stead of the PHUs themselves.

21.3.1.1. Alternative orgunit hierarchies - advanced use of group sets and groups

A more advanced use of orgunit group sets and groups is to create alternative hierarchies e.g. use administrative borders from other ministries. In Sierra Leone that could mean an alternative hierarchy of 1:MoHS, 2:Districts, and 3: Local councils, instead of the 4 level hierarchy with chiefdoms and PHUs. E.g. if all PHUs where linked to a specific local council it would be possible to look at data aggregated by local council instead of chiefdom. Then you would first need to create a group set called "Local council" and then create one orgunit group for every local council, and finally link all PHUs to their corresponding local council group.

Table 21.4. 

DistrictOrgUnit TypeData ElementPeriodValue
BoCHCMeasles doses givenDec-09121
BoCHPMeasles doses givenDec-0998
BoMCHPMeasles doses givenDec-0987
BombaliCHCMeasles doses givenDec-09110
BombaliCHPMeasles doses givenDec-0967
BombaliMCHPMeasles doses givenDec-0959


21.3.2. Best practice on the use of group sets and groups

Groups that are not members of group sets are more or less useless for analysis (should we allow this at all?). With all the groups you get by e.g. including all different diagnoses as groups the full list of groups does not makes sense in any pivot table, and you easily get duplicates in your pivot tables since data elements or indicators are members of multiple groups. This can be controlled by the use of group sets. So the recommodation is to assign all your groups to a group set, and then you pull the group sets you need into your reports and analysis.

It is also recommended to have one group set that is used for the major organising of all data in e.g. a pivot table, e.g use health programs or other larger themes for data elements or indiactors that together cover all the data. That will provide a nicely organised overview of all your raw data or indicator data.

The resource table gives all groupsets as columns with groups as rows, and 1 DE per row. This means that all groupsets are joined in when e.g. creating a view to a pivot table. Resource tables have to be generated from the Mainteance->Data Administration->Resource Table window, and more information on this is available in a later chapter called Data Administration in DHIS2 or from the inline help text in that window.

21.4. The time (period) dimension

The period dimension becomes an important factor when analysing data over time e.g. when looking at cumulative data, when creating quarterly or annual aggregated reports, or when doing analysis that combines data with different characteristics like monthly routine data, annual census/population data or six-monthly staff data.

21.4.1. Period Types

In DHIS2 the periods are organised according to a set of fixed period types: 1) Daily, 2) Weekly, 3) Monthly, 4) Quarterly, 5) Six-monthly, 6) Yearly, 7) Two-yearly, and 8) a special period type called Relative.

As a rule of thumb all organisation units should collect the same data using the same frequency or periodicity, so first of all the periods play an important role in standardising data collection across the country. A data entry form therefore needs to know its period type to make sure data is always collected according to the correct and same periodicity across the country.

It is possible however to collect the same data elements using different period types by assigning the same data elements to multiple data sets with different period types, however then it becomes crucial to make sure no orgunit is collecting data using both data sets/period types as that would create overlap and duplication of data values. If set up correctly the aggregation service in DHIS2 (through datamart and report tables) will aggregate the data together, e.g. the monthly data from one part of the country woth quarterly data from another part of the country into a national quarterly report. For simplicicty and to avoid data duplication we stronly advice to use the same period type for all orgunits for the same data elements when possible.

21.4.2. Relative periods

When creating reports within the DHIS (report tables, standard reports, charts) it is possible to make use of the relative periods functionality. The simplest scenario is when you want to design a monthly report that can be reused every month without having to make changes to the report template to accomodate for the changes in period. The relative period called reporting_month allows for this, and the user can at the time of report gemeration through a report parameter select the month to use in the report.

A slightly more advanced use case is when you want to make a monthly summary report for immunisation and want to look at the data from the current (reporting) month together with a cumulative value for the year so far. The relative period called "So far this year" provides such a cumulative value relative to the reporting month selecting when running the report. Other relative periods are the last 3,6, 9 or 12 months periods which are cumulative values calculated back from the selected reporting month. If you want to create a report with data aggregated by quarters (the ones that have passed so far in the year) you can select "Individual quarters this year". Other relative periods are described under the reporting table section of the manual. Common for all the relative periods is that they are relative to a selected reporting month. Even quarterly or annual reports need to know their reporting month to derive the year, the quarter and so on. The reporting month then becomes one of the report parameters the users have to select when running a report based on relative periods.

Table 21.5. 

Organisation UnitData ElementReporting monthSo far this yearReporting month name
Gerehun CHCMeasles doses given15167Oct-09
Tugbebu CHPMeasles doses given17155Oct-09


21.4.3. Aggregation of periods

While data needs to be collected on a given frequency to standardise data collection and management, this does not put limitations on the period types that can be used in data analysis and reports. Just like data gets aggregated up the organisational hierarchy, data is also aggregated according to a period hierarchy, so you can create quarterly and annual reports based on data that is being collected on a Monthly basis. The defined period type for a data entry form (data set) defines the lowest level of period detail possible in a report.

21.4.3.1. Sum and average aggregation along the period dimension

When aggregating data on the period dimension there are two options for how the calculation is done; 1) sum and 2) average, which is specified per data element in the DHIS2 through the use of the 'aggregation operator' attribute in the Add/Edit Data Elements window.

Most of the data collected on a routinely basis should be aggregated by summing up the months or weeks, e.g. you create a quarterly report on Measles immunisation by summing up the three monthly values for "Measles doses given".

Other types of data that are more permanently valid over time like "Number of staff in the PHU" or an annual population estimate of "Population under 1 year" need to be aggregated differently. These values are static for all months as long as there are valid data. E.g. the estimated population under 1 calculated from the census data is the same for all months in a year, or the number of nurses working in a PHU is the same for every month in the 6 months period the number is reported for.

This difference e.g. becomes important when calculating an annual value for the indicator morbidity service burden for a PHU. The monthly headcounts are summed up for the 12 months to get the annual headcount while the number of staff for the PHU is calculated as the average of the two 6-monthly values reported through the 6-monthly staff report. So in this example the data element "OPD heahcount" would have the aggregation operator "sum" and the data element "Number of staff" would have it set to "average".

Another important feature of average data elements is the validity period concept. Average data values are standing values for any period type within the borders of the period they are registered for. E.g. an annual population estimate following the calendar year will have the same value for any period that falls within that year no matter what the period type. E.g. if the population under 1 for a Tugbebu CHP is 250 for the year of 2009 that means that the value will be 250 for Jan-09, for Q3-09, for Week 12 of 2009 and for any period within 2009. This has implications for how e.g coverage indicators are calculated as the full annual population will be used as denominator value even when doing monthly reports. If you want to look at an estimated annual coverage value for a given month then you will have the option of setting the indicator to "Annualised" which means that a monthly coverage value will be multiplied by 12, a quarterly value by 4 etc. The annualised indicator feature can therefore be used to mimic the use of monthly population estimates.

21.5. Data collection vs. data analysis

21.5.1. Data collection and storage

The datasets determine what raw data that is available in the system as they describe how data is collected. Through the data sets we define the building blocks of the data to be captured and stored in the DHIS. For each data dimension we decide what level of detail the data should be collected on; 1) the data element (e.g. diagnosis, vaccine, or any event taking place) and its categories (e.g. age and gender), 2) the period/frequency dimension, and 3) the orgunit dimension. For any report or data analysis you can never retrieve more detailed data than what is defined in the datasets so the design of the datasets and their corresponding data entry forms (the data collection tools) dictate what kind of data analysis that will be possible.

21.5.2. Input != Output

It is important to understand that the data entry forms or datasets themselves are not linked to the data (values) and that the meaning of data (the What) is only described by the data element (and its categories). This makes it perfectly safe to modify datasets and forms without altering the data (as long as the data elements stay the same). This loose coupling between forms and data makes DHIS flexible when it comes to designing and changing new forms and in providing exactly the form the users want.

Another benefit of only linking data to data elements and not to forms is the flexibility of creating indicators and validation rules based on data elements, and also in providing any kind of output report (in pivot tables, charts, maps etc) that can combine data individually or across forms, e.g. to correlate data from different health programs. Due to this flexibility of enabling integration of data from various programs (forms) and sources (routine and semi permanent (population, staff, equipment)) a DHIS database is used as an integrated data repository for many or all parts of the aggregated data in a larger HIS. The figure below illustrates this flexibility.

21.6. Some more examples

The table below combines data element the two group sets Diagnosis (all the diseases) and Morbidity/Mortality (New cases, Follow-ups, Refrerrals, Deaths) with the data element category PHU/Community. Deaths are captured in a separate form with other dimensions (e.g. the PHU/Community) than morbidity.

This output table combines the two data element categories HIV_Age and Gender with the data element group set ART Group. The group enables subtotals for staging and entry points summing up the data elements in that group. Subtotals for either age groups and gender would be other possible columns to easily include here.

21.7. How this works in pivot tables

When doing data analysis in Excel pivot tables or any other OLAP based tool the dimensions become extremely powerful in providing many different views into the data. Each data element category or group set become a pivot field, and the options or groups become values within each of these fields. In fact categories and groupsets are treated exactly the same way in pivot tables, and so are orgunits, periods, and data elements. All these become dimensions to the data value that can be used to rearrange, pivot, filter, and to drill down into the data. Here we will show some examples of how the data dimensions are used in pivot tables.

Using the example of morbidity and mortality data, a pivot table can show how the dimensions can be used to view data for different aggregation levels.

The completely aggregated number is viewed when none of the pivot fields are arranged in the table area, as column or row fields, but are listed above the table itself as page field (filter).

Here we have selected to look at the Morbidity total. The various data elements on morbidity have been ordered into the main_de_groups Morbidity (we will get back to Mortality later). The fields above the table itself are all set to "All", meaning that the totals in the table will contain data from all Countries, Districts, Chiefdom, ou_type, year, months, the various categories as listed in the red fields, and all data elements in the Morbidity group.

As we have seen, this is not a very useful representation, as Morbidity is organized into new cases, follow-ups, referrals, and then again in age groups. Also, we do not see the various diagnoses. The first step is to include the diagnoses field (which is a group set), which is done by dragging the "diagnosis" field down to be a row field, as shown in the figure below, and to add the group set called "morbiditymortality" in the column field to display new cases, follow-up, and referrals.

Contrast this figure above to the one below.

They both show the same data (some of teh rows have been cut in the screenshot due to image size), albeit in a different way.

  • The "dataelement" field, used in the bottom figure, displays each diagnosis as three elements; one follow-up, one new, and one referrals. This is the way the data elements have been defined in DHIS, as this makes sense for aggregation. You would not like to aggregate follow-ups and new, thus these have not been made as categories, the whole point of is to ease aggregation and disaggregation.

  • The "diagnosis" group set has instead been made to lump these three (follow-up, new, referrals) together, which can then be split with another group set, namely the one called "morbiditymortality". This allows us to organize the data as in the first of the two figures, where we have the single diagnosis per row, and the groups new, follow-up, referrals as rows.

The idea of using group sets is that you can combine, in any set, different data elements. Thus, if we add the mortality data (by checking it from the drop-down menu of the main_de_groups field, and moving this field out of the table) we can see also the deaths, since the mortality data elements have been included as a "death" group in the "morbiditymortality" group set. The result is shown below.

The result is a much more user-friendly pivot table. Now, another figure shows the relationship between the group sets and elements (these are fake data values).

This small detail of the pivot table show how the actual data elements link to the group sets:

  • The four data elements, as defined in DHIS, are Measles death, Measles follow-up, Measles new, and Measles referrals

  • They all belong to the group set "diagnosis", where they have been lumped together in the group Measles

  • The group set "morbiditymortality" contains the groups New cases, Follow-up, Referrals, and Deaths.

  • Only the data element Measles deaths has data related to the group Deaths, thus this is where the data value (20) is shown, at the upper right corner. The same for Measles new; the value (224) is shown at the intersection of the data element Measles new and the group New cases (in the group set morbiditymortality)

  • All the intersections where the data element does not link with the groups in morbiditymortality are left blank. Thus in this case we would get a nice table if we excluded the dataelement from the table, and just had diagnosis and the group set morbiditymortality, as in the figure shown earlier

Now lets see how the data element categories can be used. In the data entry form for Morbidity the new cases and follow-ups use one age category, the referral data another,, and the mortality data a third age breakup, so these are available as three individual age group fields in the pivot tables called morbidity_age, referrals_age and mortality_age. It doesn&apos;t make sense to use these while looking at these data together (as in the examples above), but e.g. if we only want to look at the only the new cases we can put the MobidityMortalityGroups field back up as a page field and there select the New cases group as a filter. Then we can drag the Morbidity_age field down to the column area and we get the following view:

The following table illustrates the benefits of reusing data element categories across datasets and catecorycombinations. The VCCT, ART and PMTCT data are collected in three different datasets, the first two with both gender and age breakdown, and the PMTCT only age (gender is given). All three share the same age groups and therefore it is possible to viev data elements from all these three datasets in the same table and use the age dimension. In the previous example with morbidity and mortality data this was not possible since new cases, referrals and deaths all have different age groups.

In the table below PMTCT data has been removed from the table and the gender category added to the column area so that you can analyse the data for VCCT and ART by age and gender. An optional subtotal for gender has also been added, as well as a grand total for all age and gender.

21.8. From paper for to multidimensional datasets - lessons learned

Typically the design of a DHIS 2 dataset is based on some requirements from a paper form that is already in use. The logic of paper forms are not the same as the data element and data set model of DHIS, e.g. often a field in a tabular paper form is described both by column headings and text on each row, and sometimes also with some introductory table heading that provides more context. In the database this is captured in one atomic data element with no reference to a position in a visual table format, so it is important to make sure the data element with the optional data element categories capture the full meaning of each individual field in the paper form.

Another important thing to have in mind while designing datasets is that the dataset and the corresponding data entry form (which is a dataset with layout) is a data collection tool and not a report or analysis tool. There are other far more sophisticated tools for data output and reporting in DHIS than the data entry forms. Paper forms are often designed with both data collection and reporting in mind and therefore you might see things such as cumulative values (in addition to the monthly values), repetition of annual data (the same population data reported every month) or even indicator values such as coverage rates in the same form as the monthly raw data. When you store the raw data in DHIS every month and have all the processing power you need within the computerised tool there is no need (in fact it would be stupid and most likely cause inconsistency) to register manually calculated values such as the ones mentioned above. You only want to capture the raw data in your datasets/forms and leave the calculations to the computer, and presentation of such values to the reporting tools in DHIS.

21.8.1. From tables to category combinations - designing multidimensional data sets

As we have seen in the examples above the data element categories and their options are helpful in representing tabular data, when adding dimensions to a field in a paper form. We have also seen how the data element is the central dimension and that the data element categories are used to provide further details or disaggregation to the data element. As we will see in the example below there are often more than one way to represent a paper form in DHIS, and it can be difficult to know which dimension to represent with a data element name and which to represent as categories, or even as groups as we have seen above. Here are some general lessons learned from working with data element and category combinations:

  • Design your dimensions with data use in mind, not data collection. This means that disaggregation of data values at collection time should be easily aggregated up along the various dimensions, as in adding up to a meaningful total.

  • Reuse dimensions as much as possible as it increased the ability to compare disaggregated data (e.g. age groups, fixed/outreach, gender). Not necessary to share all dimensions, it helps to share only one as well (much better than none).

  • Disaggregation dimensions should add up to a total

  • Different levels of dimensions; 1) disaggregation and 2) grouping. Disaggregation dimensions dictate how you collect and how detailed you store your data, so plan these carefully. The group dimension is more flexible and can be changed and added to even after data collection (think of it as tagging).

  • Think integrated data repository and not forms or programs when designing the metadata model and revising forms. Use the same disaggregation for the same or similar data across forms. Reuse definitions so that the database can integrate even though the forms might be duplicating.

STEP BY STEP APPROACH TO DESIGNING DATASETS

1. Identify the different tables (or sub datasets) in the paper form that share the same dimensions

2. For each table identify the dimensions that describe the data fields

3. Identify the key dimension, the one that makes most sense to look at in isolation (when the others are collapsed, summed up). This is your data element dimension, the starting point and core of your multidimensional model (sub dataset). The data element dimension can be a merger of two or more dimensions if that makes more sense for data analysis. The key is to identify which total that makes most sense to look at alone when the other dimensions are collapsed.

4. For all other/additional dimensions identify their options, and come up with explanatory names for dimensions and their options.

5. Each of these additional dimensions will be a data element category and their options will be category options.

6. Combine all categories for each sub dataset into one category combination and assign this to all the data elements in your table (or sub dataset if you like).

7. When you are done with all the tables (sub datasets), create a new dataset and add all the data elements you have identified (in the whole paper form) to that dataset.

8. Your dataset will then consist of a set of data elements that are linked to one or more category combinations.

In order to better explain the approach and the possibilities we present an example paper form and will walk through it step by step and design data elements, categories, category options and category combinations.

This form has many tables and each of them potentially represent a data element category combination (from now on referred to as a catcombo). As such there is no restriction on a dataset to only have one set of dimensions or catcombo, it can have m For any and as we see above this is necessary as the dimensions are very different from table to table. We will walk through this table by table and discuss how to represent it in the DHIS.

ANC table. This table in the top left corner is one the simpler ones in this form. It has two dimensions, the first column with the ANC activity or service (1st visit, IPT 2nd dose etc) and the 2nd and 3rd column which represent the place where the service was given with the two options fixed and outreach. Since the ANC service is the key phenomena to analyse here and often there is a need for looking at e.g. total of ANC 1st visits no matter where (fixed+outreach) it makes a lot of sense to use this dimension as the data element dimension. So all items on the first column from 1st ANC visit to 2nd IPT dose given by TBA are represented as individual data elements. The place dimension is represented as a data element category (from now on referred to as category) with the name "fixed/outreach" with the two data element category options (from now on catoptions) "fixed" and "outreach". There is no other dimension here so we add a new catcombo with the name "Fixed/Outreach" with one category "Fixed/Outreach". Strictly speaking there is another dimension in this table, and that is the at PHU or by TBA dimension which is repeated for the two doses of IPT, but since none of the other ANC services listed have this dimension it does not seem like a good idea to separate out two data elements from this table and give them another catcombo with both fixed/outreach and at PHU/by TBA. reusing the same catcombo for all the ANC services makes more sense since it will be easier to look at these together in reports etc. and also the fact that there is not much to loose by repeating the at PHU or by TBA information as part of the data element name when it is only for four data elements in a table of totally 11 data elements.

DELIVERY table. This table is more tricky as it has a lot of information and you can see that not all the rows have the same columns (some columns are merged and a one field is grayed out/disabled.). If we start by looking at the first column "Deliveries assisted by" that seems to be one dimension, but only down to the "Untrained TBA" row, as the remaining three rows are not related to who assisted the delivery at all. Another dimension is the place of delivery, either In PHU or in Community as stated on the top column headings. These deliveries are further split into the outcome of the delivery, whether it is a live or still birth, which seems to be another dimension. So if we disregard the three bottom rows for a moment there seems to be 3 dimensions here, 1) assisted by, 2) place of delivery, and 3) delivery outcome. The key decision to make is what to use as the data element, the main dimension, the total that you will most often use and want easily available in reports and data analysis. We ended up using the outcome dimension as total live births is a very commonly used value in many indicators (maternal mortality ratio, births attended by skilled health personnel etc.). In this case the Assisted By dimension could also have been used without any problem, but the added value of easily getting the total live births information was the decisive point for us. This means that from this table (or subtable of row 1 to 6) there are only two data elements; "Live births" and "Still births". Then there are two more dimensions, the "PHU/Community" with its two options and a "Births attended by" with options ("MCH Aides", "SECHN", "Midwives", "CHO", "Trained TBA", "Untrained TBA"). These two categories make up the catcombo "Births" which is assigned to the two data elements "Live births" and "Still births". Considering the final three rows of the delivery table we can see that "Complicated Deliveries" does not have the assisted by dimension, but has the place and the outcome. "Low birth weight" also does not have the assisted by dimension and not the outcome either. The LLITN given after delivery does not have any additional dimension at all. Since not any of the three rows can share catcombo with any other row we decided to represent these fields as so called flat data elements, meaning data elements with no categories at all, and simply adding the additional information from the column headings to the data element name, and therefore ended up with the following data elements with the default (same as none) catcombo; "Complicated deliveries in PHU live birth", "Complicated deliveries in PHU still births", "Complicated deliveries in community live birth", "Complicated deliveries in community still births", "Low birth weight in PHU", "Low birth weight in community", and "LLITN given after delivery".

POST-NATAL CARE table This table is simple and we used the same approach as for the ANC table. 3 data elements listed in the first column and then link these to the catcombo called "fixed/outreach". Reusing the same category fixed/outreach for these data elements enables analysis on fixed/outreach together with ANC data and other data using the same category.

TT table This is a bit more tricky. We decided to use "TT1", "TT2" ... "TT5" as data elements which makes it easy to get the total of each one of these. There is fixed/outreach dimensio here, but there is also the In school place that is only applied to the Non-Pregnant, or more correctly to any of the two as the school immunisation is done whether the girls are pregnant or not. We consulted the program people behind the form and found out that it would be ok to register all school TT immunisations as non-pregnant, which simplifies the model a bit since we can reuse the "TT1" to "TT5" data elements. So we ended up with a new category called "TT place" with the three options (Fixed, Outreach, In School), and another category called "Pregnant/Non-pregnant" with two options. The new catcombo "TT" is then a combination of these two and applied to the 5 TT data elements. Since we agreed to put all In Schools immunisations under Non-pregnant in means that the combination of options (Pregnant+In School) will never be used in any data entry form, and hence become a passibe optioncombo, which is ok. As long as the form is custom designed then you can choose which combinations of options to use or not, and therefore it is not a problem to have such passive or unused catoptions. Having school as one option in the TT place category simplifies the model and therefore we thought it was worth it. The alternative would be to create 5 more data elements for "TT1 in school" ... "TT5 in school", but then it would be a bit confusing to add these together with the "TT1" ..."TT5" plus TT catcombo. Having school as a place in the TT place category makes it a lot easier to get the total of TT1.. TT5 vaccines given, which are the most important numbers and most often used values for data analysis.

Complications of early and late pregnancy and labour tables We treat these two tables as one, and will explain why. These two tables are a bit confusing and not the best deisgn. The major data coming out of these tables are the pregnancy complications and the maternal deaths. These are the major things for data analysis. And then there is further detail on the cause of the complication or death (the first column in both tables), as well as a place of death (in PHU or community), and a outcome of the complication (when its not a death) that can be either Managed at PHU or Referred. We decided to create two data elements for these two tables; "Pregnancy complications", and "Maternal Deaths", and two category combinations, one for each of the data elements. For the Pregnancy Complications data element there are two additional dimensions, the cause of the complication (the combined list of the first column in the two tables) and the outcome (managed at PHU or Referred), so these are the categories and options that make up that category combination. For the "Maternal deaths" data element the same category with the different causes are used and then another category for the place of death (in PHU or In community). This way the two data elements can share one category and it will be easy to derive the total number of pregnancy complications and maternal deaths. While the list of complications on the paper form is divided into two (early and late/labour) you can see that e.g. the malaria in 2nd and 3rd trimester are listed under early, but in fact are for a later phase of the pregnancy. There is no clear divide between early and late complications in the form, and therefore we gave up trying to make this distinction in the database.

Family Planning Services table This table has 2 dimensions, the family planning method (contraceptive) and whether the client is new or continuing. We ended up with one data element only "Family planning clients" and then added two categories "FP method" with all the contraceptives as options, and another category "FP client type" with new or continuing as options. This way it will be easy to get the total number of family planning clients which is the major value to look at in data analysis, and from there you can easily get the details on method or how many new clients there are.

Chapter 22. Web API

The Web API is a component which makes it possible for external systems to access and manipulate data stored in an instance of DHIS 2. More precisely, it provides a programmatic interface to a wide range of exposed data and service methods for applications such as third-party software clients, web portals and internal DHIS 2 modules.

22.1. Introduction

The Web API adheres to many of the principles behind the REST architectural style. To mention some few and important ones:

  1. The fundamental building blocks are referred to as resources. A resource can be anything exposed to the Web, from a document to a business process - anything a client might want to interact with. The information aspects of a resource can be retrieved or exchanged through resource representations. A representation is a view of a resource's state at any given time. For instance, the reportTable resource in DHIS represents a tabular report of aggregated data for a certain set of parameters. This resource can be retrieved in a variety of representation formats including HTML, PDF, and MS Excel.

  2. All resources can be uniquely identified by a URI (also referred to as URL). All resources have a default representation. You can indicate that you are interested in a specific representation by supplying an Accept HTTP header, a file extension or a format query parameter. So in order to retrieve the PDF representation of a report table you can supply a Accept: application/pdf header or append .pdf or ?format=pdf to your request URL.

  3. Interactions with the API requires correct use of HTTP methods or verbs. This implies that for a resource you must issue a GET request when you want to retrieve it, POST request when you want to create one, PUT when you want to update it and DELETE when you want to remove it. So if you want to retrieve the default representation of a report table you can send a GET request to e.g. /reportTable/iu8j/hYgF6t, where the last part is the report table identifier.

  4. Resource representations are linkable, meaning that representations advertise other resources which are relevant to the current one by embedding links into itself. This feature greatly improves the usability and robustness of the API as we will see later. For instance, you can easily navigate to the indicators which are associated with a report table from the reportTable resource through the embedded links using your preferred representation format.

While all of this might sound complicated, the Web API is actually very simple to use. We will proceed with a few practical examples in a minute.

22.2. Authentication

In order to interoperate with the Web API you will have to authenticate using Basic authentication. Basic authentication is a technique for clients to send login credentials over HTTP to a web server. Technically speaking, the username is appended with a colon and the password, Base64-encoded, prefixed Basic and supplied as the value of the Authorization HTTP header. More formally that is Authorization: Basic base64encode(username:password) An important note is that this authentication scheme provides no security since the username and password is sent in plain text and can be easily decoded. Using it is recommended only if the server is using SSL/TLS (HTTPS) to encrypt communication between itself and the client. Most DHIS 2 deployments typically use SSL today - consider it a hard requirement to provide secure interactions with the Web API.

22.3. Date and period format

Throughout the Web API we refer to dates and periods. The date format is:

yyyy-MM-dd

For instance, if you want to express March 20, 2012 you must use 2012-03-20.

The period format is described in the following table.

Table 22.1. Period format

Interval Format Example Description
DayyyyyMMdd20040315March 15 2004
WeekyyyyWn2004W10Week 10 2004
MonthyyyyMM200403March 2004
QuarteryyyyQn2004Q1January-March 2004
Six-monthyyyySn2004S1Janary-June 2004
Yearyyyy20042004

22.4. Example: Sending data values

A common use-case for system integration is the need to send a set of data values from a third-party system into DHIS. In this example we will use the DHIS 2 demo on http://apps.dhis2.org/demo as basis and we recommend that you follow the provided links with a web browser while reading (log in with admin/district as username/password). We assume that we have collected case-based data using a simple software client running on mobile phones for the Mortality <5 years data set in the community of Ngelehun CHC (in Badjia chiedom, Bo district) for the month of January 2012. We have now aggregated our data into a statistical report and want to send that data to the national DHIS 2 instance.

The entry point for the Web API running on the demo instance is http://apps.dhis2.org/demo/api. The entry point provides a convenient HTML page with links to all of the available resources in the Web API. The resource which is most appropriate for our purpose of sending data values is the dataValueSets resource. A data value set represents a set of data values which have a logical relationship, usually from being captured off the same data entry form. We follow the link to the HTML representation which will take us to http://apps.dhis2.org/demo/api/dataValueSets. The default representation is a HTML page which provides us with useful instructions on how to interact with this resources. It tells us that we can use the POST verb to send values using a XML format defined by the http://dhis2.org/schema/dxf/2.0 namespace:

<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0" dataSet="dataSetID" completeDate="ISODate" period="periodISODate" orgUnit="orgUnitID">
  <dataValue dataElement="dataElementID" value="1" />
  <dataValue dataElement="dataElementID" value="2" />
  <dataValue dataElement="dataElementID" value="3" />
</dataValueSet>

Note: We have omitted the categoryOptionCombo attribute as it is optional and not needed for this example.

From the example we can see that we need to identify the period, the data set, the org unit (facility) and the data elements for which to report. The dataValueSets resource description tells us that the identifier for monthly periods should be on the format yyyyMM which means that we will use 201201 for January 2012.

To obtain the identifier for the data set we return to the the entry point at http://apps.dhis2.org/demo/api and follow the embedded link pointing at the dataSets resource located at http://apps.dhis2.org/demo/api/dataSets. From there we find and follow the link to the Mortality < 5 years data set which leads us to http://apps.dhis2.org/demo/api/dataSets/pBOMPrpg1QX. What we did was effectively to retrieve the HTML representation of our data set of interest, and from it we can easily see the identifier, which is pBOMPrpg1QX. The resource representation for the Mortality < 5 years data set conveniently advertises links to the data elements which are members of it. From here we can follow these links and obtain the identifiers of the data elements. For brevity we will only report on three data elements: Measles with id f7n9E0hX8qk, Dysentery with id Ix2HsbDMLea and Cholera with id eY5ehpbEsB7.

What remains is to get hold of the identifier of the facility (org unit). Again the dataSet representation conveniently provides link to org units which report on it so we search for Ngelehun CHC and follow the link to the HTML representation at http://apps.dhis2.org/demo/api/organisationUnits/DiszpKrYNg8, which tells us that the identifier of this org unit is DiszpKrYNg8.

From our case-based data we assume that we have 12 cases of measles, 14 cases of dysentery and 16 cases of cholera. We have now gathered enough information to be able to put together the XML data value set message:

<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0" dataSet="pBOMPrpg1QX" completeDate="2012-02-03" period="201201" orgUnit="DiszpKrYNg8">
  <dataValue dataElement="f7n9E0hX8qk" value="12" />
  <dataValue dataElement="Ix2HsbDMLea" value="14" />
  <dataValue dataElement="eY5ehpbEsB7" value="16" />
</dataValueSet>

To perform functional testing we will use the cURL tool (http://curl.haxx.se) which provides an easy way of transferring data using HTTP. First we save the data value set XML content in a file called datavalueset.xml . From the directory where this file resides we invoke the following from the command line:

curl -d @datavalueset.xml "http://apps.dhis2.org/demo/api/dataValueSets" -H "Content-Type:application/xml" -u admin:district -v

The command will dispatch a request to the demo Web API, set application/xml as the content-type and authenticate using admin/district as username/password. If all goes well this will return a 200 OK HTTP status code. You can verify that the data has been received by opening the data entry module in DHIS 2 and select the org unit, data set and period used in this example.

The API follows normal semantics for error handling and HTTP status codes. If you supply an invalid username or password, 401 Unauthorized is returned. If you supply a content-type other than application/xml, 415 Unsupported Media Type is returned. If the XML content is invalid according to the DXF namespace, 400 Bad Request is returned. If you provide an invalid identifier in the XML content, 409 Conflict is returned together with a descriptive message.

In this example, cURL will authenticate to the server through Basic authentication using our supplied username and password as credentials through the -u flag.

In a real-world scenario, looking up identifiers, constructing and dispatching XML messages would be the task of the client software application. This software would probably interact with the more machine-friendly XML and JSON resource representations and not the human-friendly HTML representations like we did in this example. Developing creative and robust consumers of the Web API services begins here.

22.5. Example: Sending large bulks of data values

The previous example showed us how to send a set of related data values sharing the same period and organisation unit. This example will show us how to send large bulks of data values which don't necessarily are logically related.

Again we will interact with the with http://apps.dhis2.org/demo/api/dataValueSets resource. This time we will not specify the dataSet and completeDate attributes. Also, we will specify the period and orgUnit attributes on the individual data value elements instead of on the outer data value set element. This will enable us to send data values for various periods and org units:

<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0">
  <dataValue dataElement="f7n9E0hX8qk" period="201201" orgUnit="DiszpKrYNg8" value="12" />
  <dataValue dataElement="f7n9E0hX8qk" period="201201" orgUnit="FNnj3jKGS7i" value="14" />
  <dataValue dataElement="f7n9E0hX8qk" period="201202" orgUnit="DiszpKrYNg8" value="16" />
  <dataValue dataElement="f7n9E0hX8qk" period="201202" orgUnit="Jkhdsf8sdf4" value="18" />
</dataValueSet>

We test by using cURL to send the data values:

curl -d @datavalueset.xml "http://apps.dhis2.org/demo/api/dataValueSets" -H "Content-Type:application/xml" -u admin:district -v

The data value set resource provides an XML response which is useful when you want to verify the impact your request had. The first time we send the data value set request above the server will respond with the following import summary:

<importSummary>
  <dataValueCount imported="2" updated="1" ignored="1"/>
  <dataSetComplete>false</dataSetComplete>
</importSummary>

This message tells us that 3 data values were imported, 1 data value was updated while zero data values were ignored. The single update comes as a result of us sending that data value in the previous example. A data value will be ignored if it references a non-existing data element, period, org unit or data set. In our case this single ignored value was caused by the last data vaue having an invalid reference to org unit. The data set complete element will display the date of which the data value set was completed, or false if no data element attribute was supplied.

The import process can be customized using a set of import parameters:

Table 22.2. Import parameters

Parameter Values (default first) Description
dataElementIdSchemeuid | name | codeWhich property on the data element object to reference from the XML attribute
orgUnitIdSchemeuid | name | codeWhich property on the org unit object to reference from the XML attribute
dryRunfalse | trueWhether to save changes on the server or just return the import summary
importStrategynew_and_updates | new | updatesSave objects of all, new or update import status on the server

All parameters are optional and can be supplied as query parameters in the request URL like this:

http://apps.dhis2.org/demo/api/dataValueSets?dataElementIdScheme=code&orgUnitIdScheme=name&dryRun=true&importStrategy=new

They can also be supplied as XML attributes on the data value set element like below. XML attributes will override query string parameters.

<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0" dataElementIdScheme="code" orgUnitIdScheme="name" dryRun="true" importStrategy="new">
  ..
</dataValueSet>

Regarding the id schemes, by default the identifiers used in the XML messages refer to the DHIS stable object identifiers. In certain interoperability situations we might experience that the external system decides the identifiers of the objects. In that case we can use the code property of the organisation unit and data element objects to set fixed identifiers dictated by the other system. When importing data values we hence need to reference the code property instead of the uid property, and can do so using the dataElementIScheme and orgUnitIdScheme paramaters.

22.6. Example: Reading data values

This section explains how to retrieve data values from the Web API by interacting with the dataValueSets resource. Data values can currently be retrieved in XML format. Since we want to read data we will use the GET HTTP verb. We will also specify that we are interested in the XML resource representation by including an Accept HTTP header with our request. The following query parameters are required:

Table 22.3. Data value set query parameters

Parameter Description
dataSetData set identifier
periodPeriod identifier in ISO format
orgUnitOrganisation unit identifier

It is assumed that we have posted data values to DHIS according to the previous section called "Sending data values". We can now put together our request and send it using cURL:

curl "http://apps.dhis2.org/demo/api/dataValueSets?dataSet=pBOMPrpg1QX&period=201201&orgUnit=DiszpKrYNg8" -H "Accept:application/xml" -u admin:district -v

The response will look something like this:

HTTP/1.1 200 OK
Content-Type: application/xml

<?xml version='1.0' encoding='UTF-8'?><dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0" dataSet="pBOMPrpg1QX" completeDate="2012-01-02" period="201201" orgUnit="DiszpKrYNg8">
<dataValue dataElement="eY5ehpbEsB7" period="201201" orgUnit="DiszpKrYNg8" categoryOptionCombo="bRowv6yZOF2" value="10003"/>
<dataValue dataElement="Ix2HsbDMLea" period="201201" orgUnit="DiszpKrYNg8" categoryOptionCombo="bRowv6yZOF2" value="10002"/>
<dataValue dataElement="f7n9E0hX8qk" period="201201" orgUnit="DiszpKrYNg8" categoryOptionCombo="bRowv6yZOF2" value="10001"/>
</dataValueSet>

The header tells us that the request was processed successfully and that we are receiving a response in XML format. The XML message looks familiar - it is the data values we sent in the previous section.

22.7. Example: Writing and reading messages

DHIS 2 features a mechanism for sending messages for purposes such as user feedback, notifications and general information to users. Messages are delivered to the DHIS 2 message inbox but can also be sent to the user's email addresses and mobile phones as SMS. In this example we will see how we can utilize the Web API to send and read messages. We will pretend to be the DHIS Administrator user and send a message to the Mobile user. We will then pretend to be the mobile user and read our new message.

The resource we need to interact with when sending and reading messages is the messageConversations resource. We start by visiting the Web API entry point at http://apps.dhis2.org/demo/api where we find and follow the link to the messageConversations resource at http://apps.dhis2.org/demo/api/messageConversations. The description tells us that we can use a POST request to create a new message using the following XML format:

<message xmlns="http://dhis2.org/schema/dxf/2.0">
  <subject>This is the subject</subject>
  <text>This is the text</text>
  <users>
    <user id="user1ID" />
    <user id="user2ID" />
    <user id="user3ID" />
  </users>
</message>

Since we want to send a message to our friend the mobile user we need to look up her identifier. We do so by going to the Web API entry point and follow the link to the users resource at http://apps.dhis2.org/demo/api/users. We continue by following link to the DHIS Administrator at http://apps.dhis2.org/demo/api/users/PhzytPW3g2J where we learn that her identifier is PhzytPW3g2J. We are now ready to put our XML message together to form a message where we want to ask the mobile user whether she has reported data for January 2012:

<message xmlns="http://dhis2.org/schema/dxf/2.0">
  <subject>Mortality data reporting</subject>
  <text>Have you reported data for the Mortality data set for January 2012?</text>
  <users>
    <user id="PhzytPW3g2J" />
  </users>
</message>

To test this we save the XML content into a file called message.xml. We use cURL to dispatch the message the the DHIS 2 demo instance where we indicate that the content-type is XML and authenticate as the admin user:

curl -d @message.xml "http://apps.dhis2.org/demo/api/messageConversations" -H "Content-Type:application/xml" -u admin:district -X POST -v

If all is well we receive a 201 Created HTTP status code. Also note that we receive a Location HTTP header which value informs us of the URL of the newly created message conversation resource - this can be used by a consumer to perform further action.

We will now pretend to be the mobile user and read the message which was just sent by dispatching a GET request to the messageConversations resource. We supply an Accept header with application/xml as the value to indicate that we are interested in the XML resource representation and we authenticate as the mobile user:

curl "http://apps.dhis2.org/demo/api/messageConversations" -H "Accept:application/xml" -u mobile:district -X GET -v

In response we get the following XML:

<messageConversations xmlns="http://dhis2.org/schema/dxf/2.0" link="http://apps.dhis2.org/demo/api/messageConversations">
  <messageConversation name="Mortality data reporting" id="ZjHHSjyyeJ2" link="http://apps.dhis2.org/demo/api/messageConversations/ZjHHSjyyeJ2"/>
  <messageConversation name="DHIS version 2.7 is deployed" id="GDBqVfkmnp2" link="http://apps.dhis2.org/demo/api/messageConversations/GDBqVfkmnp2"/>
</messageConversations>

From the response we are able to read the identifier of the newly sent message which is ZjHHSjyyeJ2. Note that the link to the specific resource is embedded and available for consumers to use. From the description at http://apps.dhis2.org/demo/api/messageConversations we learned that we can reply directly to an existing message conversation once we know the URL by including the message text as the request payload (body). We are now able to construct a URL for sending our reply:

curl -d "Yes the Mortality data set has been reported" "http://apps.dhis2.org/demo/api/messageConversations/ZjHHSjyyeJ2" -H "Content-Type:text/plain" -u mobile:district -X POST -v

If all went according to plan you will receive a 200 OK status code.

22.8. Example: Embedding reports in web pages

In this example we will see how we can build a simple web page where dynamic data such as tabular reports is pulled from the DHIS Web API. A full example on how this can done is available at http://apps.dhis2.org/portal.

The Web API contains several resources which are useful for data analysis: report, reportTable, chart, map and document. Dispatching GET requests to the mentioned resources will return meta-data information such as name and the date it was last updated. All these resources have an associated data resource which produces a data view of related aggregated data - also known as reports, charts and maps. You can follow the links or simply append /data to the URL to arrive at it. This information can be represented in a variety of formats including HTML, PDF, Excel, PNG and Jasper, as we will see in the next section.

We start as usual at the Web API entrypoint at http://apps.dhis2.org/demo/api. We look for a relevant report table by following the reportTables link to http://apps.dhis2.org/demo/api/reportTables. We assume that we are interested in the "District Maternal Health" report and follow the link to http://apps.dhis2.org/demo/api/reportTables/xIWpSo5jjT1. This resource provides meta-data information about the report table. From here we can follow the link to the default data view of aggregated data, which leads us to http://apps.dhis2.org/demo/api/reportTables/xIWpSo5jjT1/data. As we can see we are provided with a report table in HTML format, which is the default representation format for report tables.

As stated in the introduction there are three ways of indicating which resource representation format you prefer for the response. The most suitable alternative for direct use in web pages is to append a file suffix to the URL. We assume that we are interested in the PDF representation and indicate that by appending .pdf to our URL: http://apps.dhis2.org/demo/api/reportTables/xIWpSo5jjT1/data.pdf. Go ahead and try out all valid extensions for this resource which are .html, .pdf, .xls and .csv.

The report table can be parameterized with an organisation unit and a period by supplying a ou and pe query parameter accompanied with an organisation unit identifier and period string in the URL. If not provided the Web API will use the top-most organisation unit in the hierarchy and the last period for the report table content. The organisation unit identifier can be looked up by going to the Web API entrypoint and follow the link to the organisationUnits resouce. For our example we will use Bo district whith identifier O6uvpzGd5pu as the organisation unit: http://apps.dhis2.org/demo/api/reportTables/xIWpSo5jjT1/data?ou=O6uvpzGd5pu. From the HTML representation we can see that the report now contains data for Bo district. These URLs can simply be used in links embedded in the web page like this:

<a href="http://apps.dhis2.org/demo/api/reportTables/xIWpSo5jjT1/data.pdf?ou=O6uvpzGd5pu">Maternal Health Bo District 2012</a>

There are many ways to authenticate over the Web and each method has its advantages and disadvantages. For this example we will use an approach where we emulate a login from the web-based login form. To help us we will use the jQuery javascript library. This javascript code should be embedded in the head section of the Web page:

jQuery(document).ready(function() {
  $.post( "http://apps.dhis2.org/demo/dhis-web-commons-security/login.action", {
      j_username: "admin", j_password: "district" 
    }
  );
});

In this code block we ask jQuery to send a POST request to the standard authentication point with two name-value pairs containing the username and password information. We assume that the user has the necessary authorities to view reports in the DHIS 2 Web API. If authentication was successful the server will send a HTTP cookie in the response with a session identifier. This will make sure that the current user is authorized to view reports for up to 60 minutes.

Caveat: The username and password will be present in the web page in plain text. Make sure you create a dedicated user in DHIS 2 for this purpose provided only with the minimum authorities required. For a more robust way of exposing resources without requiring authentication see the the section on reverse proxy setup in the installation chapter.

For a full example visit http://apps.dhis2.org/portal and view the page source in a browser. Note that the example web page is hosted within the same domain (apps.dhis2.org) as the demo DHIS 2 instance. This is done to avoid issues related to the "same origin policy", a concept which prevents scripts hosted on one domain to access resources running on another. While one can circumvent this through techniques such as CORS, there are none which have wide browser support at the moment. Therefore we recommend hosting web pages and portals on the same domain. Techniques using reverse proxies described in the "installation" chapter can be useful in this regard. Finally we provide some sample URLs pointing to various data resources for your inspiration:

22.9. Example: Embedding charts with the Visualizer Plugin

In this example we will see how we can embed good-looking Ext JS charts (http://www.sencha.com/products/extjs) with data served from a DHIS back-end into a Web page. To accomplish this we will use the DHIS Visualizer plugin. The plugin is written in Javascript and depends on the Ext JS library only. A complete working example can be found at http://apps.dhis2.org/portal/plugin.html. Open the page in a web browser and view the source to see how it is set up.

We start by including three required Javascript files in the header section of the HTML document. The first file is the Ext JS Javascript library (we use the Google content delivery network in this case). The third file is the Visualizer plugin. Make sure the path is pointing to your DHIS server installation.

<script type="text/javascript" src="http://extjs-public.googlecode.com/svn/tags/extjs-4.0.7/release/ext-all.js"></script>
<script type="text/javascript" src="http://apps.dhis2.org/demo/dhis-web-visualizer/app/plugin/plugin.js"></script>

To authenticate with the DHIS server we use the same approach as in the previous section. In the header of the HTML document we include the following Javascript inside a script element. The setLinks method will be implemented later. Make sure the base variabel is pointing to your DHIS installation.

var base = 'http://apps.dhis2.org/demo/';

Ext.onReady( function() {
  Ext.Ajax.request({ 
    url: base + "dhis-web-commons-security/login.action",
    method: 'POST',
    params: { j_username: "admin", j_password: "district" },
    success: setLinks
  });
});

Now let us have a look at the various options for the Visualizer plugin. If you want to refer to pre-defined charts already made inside DHIS you should use the uid parameter. If you want create dynamic charts you shoud include the indicators and/or dataelements parameter and omit the uid parameter. Asterisk (*) indicates that a parameter is required only when the uid parameter is not used.

Table 22.4. Visualizer plugin configuration

Param Type Required Options (default first) Description
uidstringNo Identifier of a pre-defined chart in DHIS
typestringNocolumn | stackedcolumn | bar | stackedbar | line | area | pieChart type
indicators[integer]Yes* Identifiers of indicators to include in chart
dataelements[integer]Yes* Identifiers of data elements to include in chart
periods[string]Nolast12Months | lastMonth | lastQuarter | last4Quarters | lastSixMonth | last2SixMonths | thisYear | last5YearsNames of relative periods to include in chart
organisationunits[integer]Yes* Identifiers of organisation units to include in chart
seriesstringNodata | period | organisationunitDimension to use as chart series
categorystringNodata | period | organisationunitDimension to use as chart category
filterstringNodata | period | organiastionunitDimension to use as chart filter
elstringYes Identifier of HTML element to render the chart in
urlstringYes Base URL of the DHIS server
widthintegerNo Width of chart
heightintegerNo Height of chart
legendPositionstringNotop | right | bottom | leftPosition of chart legend

We continue by including two pre-defined charts and to dynamic charts to our HTML document. You can browse the list of available charts using the Web API here: http://apps.dhis2.org/demo/api/charts.

function setLinks() {
  DHIS.getChart({ uid: 'R0DVGvXDUNP', el: 'chartA1', url: base });

  DHIS.getChart({ uid: 'X0CPnV6uLjR', el: 'chartA2', url: base });


  DHIS.getChart({ el: 'chartB1', url: base,
    type: 'bar',
    indicators: ['FnYCr2EAzWS','eTDtyyaSA7f','tUIlpyeeX9N'],
    periods: 'last12Months',
    organisationunits: ['ImspTQPwCqd']
  });

  DHIS.getChart({ el: 'chartB2', url: base,
    type: 'column',
    indicators: ['Uvn6LCg7dVU','sB79w2hiLp8'],
    periods: 'thisYear',
    organisationunits: ['O6uvpzGd5pu','fdc6uOvgoji','lc3eMKXaEfw','jmIPBj66vD6'],
    series: 'data',
    category: 'organisationunit',
    filter: 'period'
  });
};

Finally we include some div elements in the body section of the HTML document with the identifiers referred to in the plugin Javascript.

<div id="chartA1" class="chart"></div>
<div id="chartA2" class="chart"></div>

<div id="chartB1" class="chart"></div>
<div id="chartB2" class="chart"></div>

To see a complete working example please visit http://apps.dhis2.org/portal/plugin.html.

Appendix A.  DHIS 2 Documentation Guide

A.1. DHIS 2 Documentation System Overview

DHIS 2 is a web-based aggregate information management system under very active development. Given the modular nature of the system, its wide user base and distributed, global nature of development, a comprehensive documentation system is required. An in-depth discussion of the need for documentation of DHIS 2 has been considered previously.[Store2007] DocBook is a comprehensive XML based system for creation of books, papers and other technical documents maintained by OASIS .

A.2. Introduction

One of the main advantages of DocBook is that there is complete separation between the content and presentation. DocBook is a pure XML format, and is well documented. It is believed that only a very small subset of its features will be required in order to achieve much higher quality documentation for DHIS. There are some 400 separate mark-up elements that cater to almost any level of technical documentation needs, but in reality, only a few dozen of these element will probably need to be employed to achieve high-quality documentation for DHIS 2, both for printed as well as on-line formats such as HTML or integrated help systems within the application itself. Therefore, there are wide range of possibilities in terms of which editor can be used for the creation of DocBook files. A fairly complete list of possibilities is located here. It is currently recommended to use Syntext Serna Free for editing DocBook source files as WYSIWYG. In principle, any text editing program or XML editor will be capable of being used to create DocBook files.

[Note]Note

It is not recommended to use the editor XMLmind XML Editor Personal Edition (also known as XXE Personal), as the editor "silently" places unneeded whitespace and other ornamentation to the DocBook source which makes collaborative editing of documents very difficult.

One of the key concepts to keep in mind when authoring documentation in DocBook, or other presentation neutral formats, is that the content of the document should be considered in the first instance. The presentation of the document will take place in a separate step, where it will be rendered into different formats, such as HTML and PDF. It is therefore important that the document is will organised and structured, with appropriate DocBook tags and structural elements being considered.

It is good practise to break your document in to various sections using the "sect", or section element. Section elements can also be nested within each other, such as "Section 1" and "Section 2". This concept is essentially the same as Microsoft Word™ or other word processing programs. DocBook will automatically take care of numbering the sections for you when the document is produced. Two other important elements are the "itemizedlist" and "numberedlist". These are quite similar, but an itemised list corresponds to a bulleted list, which a numbered list will be rendered with each element being numbered sequentially. Other key elements are "screenshot" and "table" which should be self-explanatory.

A.3. Getting started with Launchpad

Currently, the documentation system is part of the source code housed at Launchpad. Launchpad is a collaborative platform that enables multiple people to work on software projects collaboratively. In order for this to be possible, a version control system is necessary in order to manage all the changes that multiple users may make. Launchpad uses the Bazaar source control system. While it is beyond the scope of this document to describe the functionality of Bazaar, users who wish to create documentation will need to gain at least a basic understanding of how the system works. A basic guide is provided in the next section.

In order to start adding or editing the documentation, you should first perform a checkout of the source code. If you do not already have a Launchpad login id, you will need to get one. This can be done here. Once you register with Launchpad, you will need to request access to the dhis2-documenters group. Login to Launchpad, and then request access here. Your request will need to be approved by the group administrators. Once you have been granted access to the group, you can commit changes to the documentation branch and send and receive emails on the groups' list.

A.4. Getting the document source

In order to edit the documentation, you will need to download the source pages of the documentation to your computer. Launchpad uses a version control system known as bzr . There are different methods for getting Bazaar working on your system, depending on which operating system you are using. A good step-by-step guide for Microsoft™ operating systems can be viewed here. If you are using Linux, you will need to install bzr on your system through your package manager, or from source code.

Once you have installed bzr on your system, you will need to download the document source. Just follow this procedure:

  1. Make sure you have Bazaar installed.

  2. Start Bazaar by right-clicking a folder if you are using Windows™ and selecting Bzr Here. If you use Linux, you can just create a folder to hold the document sources. You can place the document source in any folder you like.

  3. To download the latest revision of the DHIS2 documents project type: bzr checkout lp:~dhis2-documenters/dhis2/dhis2-docbook-docs if you are using Linux, or alternatively if you are using Windows™ type the url to the source code repository "lp:~dhis2-documenters/dhis2/dhis2-docbook-docs"

  4. The download process should start and all the documentation source files will be downloaded to the folder that you specified.

A.5. Editing the documentation

Once you have downloaded the source, you should have a series of folders inside of the dhis2-docbook-docs directory. All documents should be placed in the dhis2-docbook-docs/src/docbkx/XX folder. Note that the XX represents the ISO 639-1 (two-letter) language code of the documentation. If you are developing English language documentation, place it inside the /dhis2-docbook-docs/src/docbkx/en/ folder. Place any image files that may be linked to your document in the /dhis2-docbook-docs/src/docbkx/XX/resources/images folder and link these inside your DocBook document using a relative file link. When the documentation is built, in a separate step, the images will be automatically copied over to the correct directory during the build process.

A.6. Using images

Screen shots are very useful for providing information to users on how particular actions should be performed. DocBook has no intrinsic mechanisms to know exactly how an image should be rendered in the final document. Therefore, it is necessary to provide instructions through element attributes. The following XML code fragment demonstrates how an image can be specified to occupy 80% of the available page width. For screen shots in landscape format, this seems to be an appropriate amount. You may need to experiment a bit to obtain a proper width for your image. Alternatively, you can edit the resolution of the image itself, in order to obtain a proper size during rendering.

<screenshot>
 <screeninfo>DHIS2 Login screen</screeninfo>
  <mediaobject>
   <imageobject> 
    <imagedata fileref="dhis2_login_screen.jpg" format="JPG" width="80%"/>
   </imageobject>
  </mediaobject> 
</screenshot>

For other images, depending on their size, a different value may be necessary. If you do not specify a width for you image, and its intrinsic size is larger than the available screen width, the image may overflow in certain document types with a fixed width, such as PDF.

A.7. Linking documents together

DocBook provides a modular framework where many separate documents can be linked together into a master document. Fragments from different documents can also be reused in different contexts. It is therefore important to consider whether your document should be constructed as an article or a chapter. Chapters are essentially portions of a book, and can therefore be linked together into a larger document very easily. Articles are essentially standalone documents, but they can also be assembled together into a larger document at the component level.

Should you wish to link several articles together into a book, DocBook provides a mechanism to assign an id to a section. In the example below, a section has been assigned an id. This id must be unique within the document.

  <section id="mod2_1">
<title>Getting started with DHIS2</title> ....

In order to include an article into a book, an Xinclude statement must be used. The following example shows how.

<chapter>
<title>Getting started with DHIS2</title> 
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dhis2_user_man_mod2.xml"
 xpointer="mod2_1" encoding="UTF-8"/>
... 

Note that the file name and id have been assigned in the parent document, referring to the actual file (href) and particular fragment of the child document that should be referenced in the parent document (xpointer).

Including chapters in a book is very simple. The example below illustrates how:

<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dhis2_user_man_
mod1.xml" encoding="UTF-8"/> 

In this case, there is no need to explicitly reference a part of the document, unless you only want to include a portion of the chapter. If you want to use a section of the chapter, you can assign an id to that section, and then reference that section through an xpointer.

A.8. Handling multilingual documentation

The directory structure of the documentation has been created in order to facilitate the creation of documents in any language. If you want to create a new set of documents in a given language, simply create a new directory in the dhis2-docbook-docs/src/docbkx/ directory. Be sure to use the ISO 639-1 code for the language you are going to create documents in. A complete list of these codes can be found here. Add a new folder for images in a sub-directory , replacing XX with the actual ISO 639-1 code for the language you will create documents in. You will also need to edit the pom.xml file in the main dhis2-docbook-docs directory. If you are unsure of what changes need to be made to this file, ask on the mailing list first, as this file controls the generation of all the documentation.

A.9. Building the documentation

One of the key advantages of the DocBook format is that the source documentation can be transformed into a wide variety of formats, including HTML, chunked HTML, XHTML, PDF, and a number of other formats. There are a wide variety of tools that are capable of performing this task. Basically the XML source of the document is transformed using the standard DocBook XSL style sheets into the desired format. The complete list of tools capable of transforming DocBook will not be listed here, but a few examples are provided below.

Latest builds of the documentation are available from the DHIS2 website. The latest snapshot builds are available through the continuous integration server located here.

A.9.1. Building the documentation with Apache maven

In order to transform the documentation source files to different formats, such as HTML or PDF, you will need to install the Apache Maven program. You can get a copy here or by installing it through your package manager if you are using Linux. Just execute the command mvn clean package on Windows or on Linux from the /dhis2-docbook-docs directory. Maven will start to download the necessary components to transform the documents into HMTL,PDF and RTF. Once the process has completed (be patient the first time, as there are a number of components that must be downloaded), all of the target document types will be generated in the /dhis2-docbook-docs/target/docbkx directory in respective sub-directories.

A.9.2. Building with xmlto

xmlto is a useful utility available on Linux platforms for transforming DocBook documents into many different formats. More information on the package can be found here. If you do not want to use Apache Maven for some reason, you can install xmlto through your package manager. Once you have installed xmlto you can just execute xmlto htmlfile_to_transform where the file_to_transform parameter is the name of the file you wish to transform. There are many other formats available, such as PDF, PS, JavaHelp and others.

A.10. Committing your changes back to Launchpad

Once you have finished editing your document, you will need to commit your changes back to Launchpad. Open up a command prompt on Windows or a shell on Linux, and navigate to the folder where you have placed your documentation. If you have added any new files or folders to your local repository, you will need to add them to the source tree with the bzr add command, followed by the folder or file name(s) that you have added Once you have added all of your new files, you should update you local repository to make sure there are no conflicts using the following command bzr update

If there are conflicts, bazaar will notify you of this. Your conflicts can also be listed by using the bzr conflicts command. If there are conflicts in a file, bazaar will create three versions of the file:

  • filename.BASE

  • filename.THIS

  • filename.OTHER

These files correspond to the common parts of the file, the local version and the version on the server respectively. The files will contain markers to indicate areas in conflict. After resolving the conflicts by editing each file and removing the conflict markers, use bzr resolve. This will tell bazaar that the conflict is resolved, and clean up the BASE, THIS, OTHER files.

Once your source code is updated and any conflicts resolved, commit you changes with an informative message about the changes you have made:

bzr commit -m "Created Amharic translation of documentation"

[Important]Important

Never commit code using bzr push, as this will overwrite any changes in the repository, and revision history will be lost.

If you have any questions, or cannot find that you can get started, just send an email with your problem to .

Appendix B. MyDatamart User Manual

B.1. Overview

Mydatamart is an application which is meant to be installed and run on a user's personal computer. The primary function of mydatamart is to connect to an online DHIS instance, dowload meta-data and data and store that data in a local database. It is meant to operate together with Microsoft Excel, which you can use to create Pivot tables where the local database can be connected to and act as a data source. After the initial data download you can do incremental downloads, e.g. download the latest data every month. Mydatamart also helps in producing convenient SQL views for more powerful analysis and with the process of connecting Pivot tables to the local database. After installation of the required database driver and the mydatamart executable file, the fresh-start workflow can be described like this:

  1. Create a new datamart file.

  2. Log in to the online DHIS server.

  3. Download meta-data (data elements, organisation units etc).

  4. Download data (records).

  5. Create a new Pivot table from mydatamart - or link to an existing one and refresh the data source from within Microsoft Excel.

B.2. Installation

The mydatamart application is a self-contained executable which doesn't require any additional installation procedure. Just download the executable then it is ready to run. If you are using Microsoft Excel to create and use pivot tables linked to your local datamart then you do also need to install the Sqlite3 ODBC driver.

The following provides a list of step by step instructions to get started:

  1. Download the sqliteodbc.exe file from dhis2.org/downloads The Sqlite ODBC driver is required for Excel to be able to link to datamart files.

  2. Double-click on the downloaded file to install the driver. Follow the on screen instructions and accept all defaults.

  3. Download the file mydatamart.exe from dhis2.org/downloads and place it somewhere visible on your desktop. This is the mydatamart tool used to manage your local datamart. The icon should be a small blue feather as indicated in Figure B.1, “Mydatamart desktop icon” below.

    Figure B.1. Mydatamart desktop icon

    Mydatamart desktop icon

    The application can be launched by double-clicking on this icon.

B.3. The Mydatamart application

The purpose of the mydatamart application is to manage a local datamart store which is populated by downloading data from the online DHIS2 web application. It also manages the details of ODBC connection parameters required to link Excel workbooks to your data.

The simplest way to start mydatamart.exe is to double-click on the icon on your desktop. The application should open and show a window like Figure B.2, “Mydatamart on first open” below:

Figure B.2. Mydatamart on first open

Mydatamart on first open

All of the functionality of mydatamart is available through the menu items in the upper menu bar. Some of the more commonly used functions are also available through the image button bar immediately below the menu. If you hover your mouse slowly over these buttons a tooltip window should show the functions of each.

B.3.1. Maintaining the local datamart

B.3.1.1. Creating a new datamart

The main purpose of mydatamart is to manage your personal datamart files so the first thing you will need to do is to create a new datamart. You can create a new datamart either through the File->New menu option or by pressing the button with the blue cross. When you create this new datamart you will be prompted for a file name. The extension .dmart will be appended automatically to the name. Give some thought to how and where you are going to store this file as it will soon be full of valuable data. You can create a backup at any time by simply making a copy of this file, eg. onto a USB memory stick.

[Note]Note

The .dmart file is actually an sqlite3 database file which you can also open and view or edit with any sqlite3 capable tool, such as sqlitestudio.

When you create the new datamart, the application will present a dialog like Figure B.3, “Creating a new datamart”.

Figure B.3. Creating a new datamart

Creating a new datamart

The first thing you must do is to establish a connection with your dhis server. To do this enter the full url of the dhis server into the box labelled URL. Then enter your online dhis user name and password. Your password will not be saved anywhere on your machine. To login press the button labelled Login. If the login was successful you will see a green tick icon next to the login button.

Figure B.4. Logging in to dhis2 server

Logging in to dhis2 server

B.3.1.2. Populating the datamart with metadata

The local datamart is designed to store aggregated data values from dataelements and indicators in the online DHIS2 application. But before you can do this, you must first populate the local datamart with metadata from the remote dhis2.

Metadata refers to the parts of the database which give the data values meaning. This includes organisation units and the hierarchy, data elements, indicators and more. This information is required to work with pivot tables and produce meaningful analysis.

Populating thee database with metadata is a straightforward, simply press the toolbar button with the image (it can also be done via the "Datamart->Load metadata from dhis" menu option.) The Mydatamart application will then contact the remote DHIS2 server and download, transform and save the metadata into the local database.

B.3.1.3. Choosing Organisation unit and analysis level

The benefit of using mydatamart is that you only need to download the data from the DHIS2 server which you need in your routine analysis. By selecting the appropriate orgunit and level of analysis you ensure that your regular data updates will be small and manageable even when bandwidth is limited.

The two concepts to be aware of are your root orgunit and your analysis level. To illustrate this using an example from Kenya, let us assume you are based in the district office of Nyeri North in Nyeri County. You have either been given pivot tables or you will make them to analyze your data down to facility level. So you require data for all the facilities within Nyeri North and you also require to see data for your peers, ie. the other districts within Nyeri County.

Once you have created a new datamart and have downloaded metadata as described in the previous section, you should be able to set these two parameters in the settings dialog as illustrated below. If the dialog is not visible you can access it by pressing the button.

Figure B.5. Setting analysis parameters

Setting analysis parameters

When you have set these once they will be saved with your datamart file. They can however be changed at any time and you might have different datamart files with different settings.

[Note]Note

You will have noticed from Figure B.5, “Setting analysis parameters” that the analysis level is converted to a number. So for example, in Kenya, the facility is at level 5, the district is level 4 etc. These correspond to orgunit hierarchy levels within dhis2. These numbers will vary from one country implementation to another. For the most part you do not need to be concerned with the number of the level, except when you come to selecting views for analysis. Here you will see that the level number is used as part of the naming convention for views.

B.3.1.4. Downloading data

Now that you have your local datamart set up you are ready to start populating it with data from your online DHIS2 server. Whereas you will probably only adjust the settings when creating a new datamart, you will be doing regular synching of your local datamart with the online server. If data is being downloaded once a month, then the incremental size of each download will be small. You can get to the data download screen either by pressing the button or by navigating to the "Datamart->Update Aggregate Data" menu item.

Figure B.6, “Downloading data”, shows the datamart update screen. You can set the detailed options for your download here. There is not much to be done as the defaults should match your typical operations.

Figure B.6. Downloading data

Downloading data

On the left hand side there are check boxes which you should set to indicate whether you need data weekly, monthly, quarterly or yearly (you can select more than one).

On the right hand side you have the option to set the time periods you are downloading. The application will attempt to select a reasonable period for you. Other than the very first time you download data, the default should be to download the previous month's data.

Below the period selection section are the two buttons which actually initiate the download. The first button is used to download data for orgunits below the root orgunit at the level which was specified previously. So in the example, it will download aggregated data at the facility level (level 5) for facilities in Nyere North.

The second button is used to download aggregate data of our peers. In this case it would ensure that we had data for all the districts in Nyere County. This will allow the Nyere North user to analyze the data for all facilities in Nyere North as well as to compare the performance of Nyere North district with Nyere South district.

B.3.2. Working with Excel

B.3.2.1. Creating a new Excel workbook for analysis

Pivot tables in Microsoft Excel are commonly used to analyze data in DHIS2. The mydatamart tool does not create pivot tables for you, but it does provide a simple interface to get you started with an Excel workbook which is already linked to views in your local datamart. This section describes how you get started with that.

The most important thing to have prepared when designing a pivot table are the database views you will use. Mydatamart automatically creates some "standard" views for dataelement values and indicator values for different periodicities - weekly, monthly, quarterly, semesterly (every 6 months), yearly etc. Expert users might also want to design additional custom views. There is also an option to import an arbitrary sql file into the database which can be used to share custom views.

To start the process of creating an Excel pivot table workbook, the user should select "Reports->New Excel file" from the menu bar. She will immediately be displayed a dialog for selecting views such as illustrated in Figure B.7, “Selecting views” below.

Figure B.7. Selecting views

Selecting views

Mydatamart will present a list of all defined views in the listbox on the left. These include the automatically generated ones as well as any custom views which may have been created outside of the tool. The names of the views give some indication of their content. The auto generated views are named as follows:

pivotsource_<datatype>_ou_<level>_<periodicity>

In Figure B.7, “Selecting views” we can see that monthly and quarterly views for indicators at level 4 (district) and 5 (facility) have been selected. Double-clicking on a view in the left listbox causes the view to be selected for inclusion. Similarly, double-clicking on a view in the right listbox causes the view to be removed from the selection.

Once you have selected the required views you can click on "Create Excel workbook". This will prompt you for a name and location for your new Excel file.

B.3.2.2. Working with your new Excel file

When you create a new Excel file as described in the section above, Excel should automatically open the new file. This file will have the database connections to your selected views already populated. To see these connections (on Excel 2007) first click on the "Data" menu, then select "Existing Connections" from the toolbar. You should see something like Figure B.8, “Datamart connections” below, showing the views that you selected in the previous step.

Figure B.8. Datamart connections

Datamart connections

You can use these views to create pivot tables or simply to view the data within a worksheet. To make use of a view simply double click on it. You will be presented with a dialog similar to Figure B.9, “Pivot report wizard”.

Figure B.9. Pivot report wizard

Pivot report wizard

From this point, creating pivot tables is the same as is described in the DHIS2 User Manual.

[Note]Note

Remember to define the Indicator value calculation when using indicator views. This process is as described in the DHIS2 User Manual.

On completion of your pivot table design you can save it and/or copy it to a new location. Whenever you have new data in your datamart you can refresh the pivot tables.

Remember that the database links in the Excel file are pointing at your datamart file (the file with a .dmart extension which you create when starting a new datamart). If you move that datamart file your connections will no longer work. Similarly if you send the file to someone else, they will need to connect the Excel file to their own datamart. This process is straightforward and is described in the next section.

B.3.2.3. Linking an existing Excel file to a datamart

If you have been sent a pivot table report from another mydatamart user, or you have moved the location of your .dmart file you will need to recreate the link between your datamart and the Excel file. The procedure for this is:

  • Open your datamart file using the mydatamart tool.

  • Select "Reports->Connect to existing excel file" or use the shortcut

  • Select the excel file you wish to connect to in the following dialog.

The excel file will automatically have its database links repaired to point to your current datamart.

B.3.3. Troubleshooting

In the event of things not behaving as expected, or if you wish to report buggy or surprizing behaviour, it can be useful (particularly for the developer) to have more detailed information than that which is normally displayed to the user.

The mydatamart application creates an internal log with lots of low level information about what the program is doing at any point in time. To view this internal log you need to display the program console. You can either do this through the "Help" menu option or by simply pressing the "F2" shortcut key. It is a good idea to capture the content of this console log when reporting problems to the developers.

B.3.4. History and Background

The Mydatamart tool was created to address a changing paradigm in the deployment of DHIS2. In the past, going back to the days even before DHIS was a web application, the typical data flows of the system, as installed in a district office, was between components which were closely located to one another. The DHIS application was used to provide a user interface to a database, which stored all the data and metadata for the application. In many settings the user interface, the application and the database might even be on the same computer. In other settings these three components might exist separately on a small Local Area Network (LAN) within the district office.

The user would interact with the database in two different ways. In the normal flow of working with DHIS2 she would work through the web interface and the DHIS2 web application would take care of updating the database in the background. When analyzing data, the typical approach is to create pivot tables using Microsoft Excel, and configure Excel to fetch the data required by configuring an ODBC connection which points to the database. These flows of data are illustrated in Figure B.10, “Data flows using DHIS2” below.

Figure B.10. Data flows using DHIS2

Data flows using DHIS2

It is important to understand that the quantity of data being transported between the database and Excel pivot table (data flow 3 in the figure) can be quite large. By and large this is acceptable so long as the user is working on the same computer as the database or at least on the same high speed LAN. But the requirement for the user to be able to pull large amounts of data from the database in order to update pivot tables imposes a severe constraint on the possible DHIS2 deployment options. One of the benefits of a web application is that the application server does not need to be physically present in the district office. Having everything co-located creates an additional burden of hardware and software maintenance which distracts from the core function of the district office. Where the district office has reasonable Internet connectivity it is preferable to be able to host the DHIS2 web application at some central location within a data centre where it can be professionally managed by system administrators with the requisite skills.

The challenge that is introduced by this type of deployment is that we can no longer rely on users analyzing their data by performing frequent and voluminous updates of their pivot tables from the back end database. In fact, in a properly secured deployment, the district user will not be able to access the database at all. All interaction with DHIS2 would be through the web interface to the application.

Mydatamart was created to address this problem. With Mydatamart, the data that is required to be analyzed in pivot tables is pulled incrementally from the DHIS database via the dhis2 web server and stored locally in a small but efficient local database. This database makes use of the widely deployed Sqlite database engine. This new data flow is shown in red in Figure B.11, “Using a local datamart”.

Figure B.11. Using a local datamart

Using a local datamart

With the data available locally, pivot tables in the district office can now be configured to use ODBC connections to the local Sqlite database instead of the remote database server.

Appendix C. R and DHIS 2 Integration

C.1. Introduction

R is freely available, open source statistical computing environment. R refers to both the computer programming language, as well as the software which can be used to create and run R scripts. There are numerous sources on the web which describe the extensive set of features of R.

R is a natural extension to DHIS2, as it provides powerful statistical routines, data manipulation functions, and visualization tools. This chapter will describe how to setup R and DHIS2 on the same server, and will provide a simple example of how to retrieve data from the DHIS2 database into an R data frame and perform some basic calculations.

C.2. Using ODBC to retrieve data from DHIS2 into R

In this example, we will use a system-wide ODBC connector which will be used to retrieve data from the DHIS2 database. There are some disadvantages with this approach, as ODBC is slower than other methods and it does raise some security concerns by providing a system-wide connector to all users. However, it is a convenient method to provide a connection to multiple users. The use of the R package RODBC will be used in this case. Other alternatives would be the use of the RPostgreSQL package, which can interface directly through the Postgresql driver described in Section C.4, “Mapping with R and Postgresql”

Assuming you have already installed R from the procedure in the previous section. Invoke the following command to add the required libraries for this example.

apt-get install r-cran-odbc r-cran-lattice odbc-postgresql

Next, we need to configure the ODBC connection. Edit the file to suit your local situation using the following template as a guide. Lets create and edit a file called odbc.ini

[dhis2]
Description         = DHIS2 Database
Driver              = /usr/lib/odbc/psqlodbcw.so
Trace               = No
TraceFile           = /tmp/sql.log
Database            = dhis2
Servername          = 127.0.0.1
UserName            = postgres
Password            = SomethingSecure
Port                = 5432
Protocol            = 9.0
ReadOnly            = Yes
RowVersioning       = No
ShowSystemTables    = No
ShowOidColumn       = No
FakeOidIndex        = No
ConnSettings        =
Debug = 0

Finally, we need to install the ODBC connection with odbcinst -i -d -f odbc.ini

This shows that R is working properly.

From the R prompt, execute the following commands to connect to the DHIS2 database.

> library(RODBC)
> channel<-odbcConnect("dhis2")#Note that the name must match the ODBC connector name
> sqlTest<-c("SELECT dataeleemntid, name FROM dataelement LIMIT 10;")
> sqlQuery(channel,sqlTest)
                                                                        name
1   OPD First Attendances Under 5
2   OPD First Attendances Over 5
3   Deaths Anaemia Under 5 Years
4   Deaths Clinical Case of Malaria Under 5 Years
5   Inpatient discharges under 5
6   Inpatient Under 5 Admissions
7   Number ITNs
8   OPD 1st Attendance Clinical Case of Malaria Under 5
9  IP Discharge Clinical Case of Malaria Under 5 Years
10 Deaths of malaria case provided with anti-malarial treatment 1 to 5 Years
>

It seems R is able to retrieve data from the DHIS2 database. As an illustrative example, lets say we have been asked to calculate the relative percentage of OPD male and female under 5 attendances for the last twelve months.First, lets create an SQL query which will provide us the basic information which will be required.

OPD<-sqlQuery(channel,"SELECT p.startdate, de.name as de, sum(dv.value::double precision)
 FROM datavalue dv
 INNER JOIN period p on dv.periodid = p.periodid
 INNER JOIN dataelement de on dv.dataelementid = de.dataelementid
 WHERE p.startdate >= '2011-01-01'
 and p.enddate <= '2011-12-31'
 and de.name ~*('Attendance OPD')
 GROUP BY p.startdate, de.name;")

We have stored the result of the SQL query in an R data frame called OPD. Lets take a look at what the data looks like.

> head(OPD)
   startdate                                 de    sum
1 2011-12-01   Attendance OPD <12 months female  42557
2 2011-02-01   Attendance OPD <12 months female 127485
3 2011-01-01   Attendance OPD 12-59 months male 200734
4 2011-04-01   Attendance OPD 12-59 months male 222649
5 2011-06-01   Attendance OPD 12-59 months male 168896
6 2011-03-01 Attendance OPD 12-59 months female 268141
> unique(OPD$de)
[1] Attendance OPD <12 months female   Attendance OPD 12-59 months male  
[3] Attendance OPD 12-59 months female Attendance OPD >5 years male      
[5] Attendance OPD <12 months male     Attendance OPD >5 years female    
6 Levels: Attendance OPD 12-59 months female ... Attendance OPD >5 years male
> 
          

We can see that we need to aggregate the two age groups (< 12 months and 12-59 months) into a single variable, based on the gender. Lets reshape the data into a crosstabulated table to make this easier to visualize and calculate the summaries.

>OPD.ct<-cast(OPD,startdate ~ de) 
>colnames(OPD.ct)
[1] "startdate"                          "Attendance OPD 12-59 months female"
[3] "Attendance OPD 12-59 months male"   "Attendance OPD <12 months female"  
[5] "Attendance OPD <12 months male"     "Attendance OPD >5 years female"    
[7] "Attendance OPD >5 years male" 

We have reshaped the data so that the data elements are individual columns. It looks like we need to aggregate the second and fourth columns together to get the under 5 female attendance, and then the third and fifth columns to get the male under 5 attendance.After this, lets subset the data into a new data frame just to get the required information and display the results.

> OPD.ct$OPDUnder5Female<-OPD.ct[,2]+OPD.ct[,4]#Females
> OPD.ct$OPDUnder5Male<-OPD.ct[,3]+OPD.ct[,5]#males
> OPD.ct.summary<-OPD.ct[,c(1,8,9)]#new summary data frame
>OPD.ct.summary$FemalePercent<-
OPD.ct.summary$OPDUnder5Female/
(OPD.ct.summary$OPDUnder5Female + OPD.ct.summary$OPDUnder5Male)*100#Females
>OPD.ct.summary$MalePercent<-
OPD.ct.summary$OPDUnder5Male/
(OPD.ct.summary$OPDUnder5Female + OPD.ct.summary$OPDUnder5Male)*100#Males 

Of course, this could be accomplished much more elegantly, but for the purpose of the illustration, this code is rather verbose.Finally, lets display the required information.

> OPD.ct.summary[,c(1,4,5)]
    startdate FemalePercent MalePercent
1  2011-01-01      51.13360    48.86640
2  2011-02-01      51.49154    48.50846
3  2011-03-01      51.55651    48.44349
4  2011-04-01      51.19867    48.80133
5  2011-05-01      51.29902    48.70098
6  2011-06-01      51.66519    48.33481
7  2011-07-01      51.68762    48.31238
8  2011-08-01      51.49467    48.50533
9  2011-09-01      51.20394    48.79606
10 2011-10-01      51.34465    48.65535
11 2011-11-01      51.42526    48.57474
12 2011-12-01      50.68933    49.31067

We can see that the male and female attendances are very similar for each month of the year, with seemingly higher male attendance relative to female attendance in the month of December.

In this example, we showed how to retrieve data from the DHIS2 database and manipulate in with some simple R commands. The basic pattern for using DHIS2 and R together, will be the retrieval of data from the DHIS2 database with an SQL query into an R data frame, followed by whatever routines (statistical analysis, plotting, etc) which may be required.

C.3. Using R with MyDatamart

MyDatamart provides useful interface to the DHIS2 database by making a local copy of the database available on a users desktop. This means that the user does not need direct access to the database and the data can be worked with offline on the users local machine. In this example, we will have used the demo database. Data was downloaded at the district level for Jan 2011-Dec 201l. Consult the MyDatamart section in this manual for more detailed information.

First, lets load some required packages. If you do not have these packages already installed in your version of R, you will need to do so before proceeding with the example.

library("DBI")
library("RSQLite")
library("lattice")
library("latticeExtra")

Next, we are going to connect to the local copy of the MyDatamart database. In this case, it was located at C:\dhis2\sl.dmart.

dbPath<-"C:\\dhis2\\sl.dmart"
drv<-dbDriver("SQLite")
db<-dbConnect(drv,dbPath)

Let suppose we have been asked to compare ANC 1, 2, 3 coverage rates for each district for 2011. We can define an SQL query to retrieve data from the MyDatamart database into an R data frame as follows.

#An SQL query which will retreive all indicators 
#at OU2 le
sql<-"SELECT * FROM pivotsource_indicator_ou2_m 
WHERE year = '2011'"
#Execute the query into a new result set
rs<-dbSendQuery(db,sql)
#Put the entire result set into a new data frame
Inds<-fetch(rs,n=-1)
#Clean up a bit
dbClearResult(rs)
dbDisconnect(db)

We used one of the pre-existing Pivot Source queries in the database to get all of the indicator values. Of course, we could have retrieved only the ANC indicators, but we did not exactly know how the data was structured, or how the columns were named, so lets take a closer look.

#Get the name of the columns
colnames(Inds)
#output not shown for brevity
levels(as.factor(Inds$indshort)) 

We see from the colnames command that there is an column called "indshort" which looks like it contains some indicator names. We can see the names using the second command. After we have determined which ones we need (ANC 1, 2, and 3), lets further subset the data so that we only have these.

#Subset the data for ANC
ANC<-Inds[grep("ANC (1|2|3) Coverage",as.factor(Inds$indshort)),]

We just used R's grep function to retrieve all the rows and columns of the Inds data frame which matched the regular expression "ANC (1|2|3) Coverage" and put this into a new data frame called "ANC".

By looking at the data with the str(ANC) command, we will notice that the time periods are not ordered correctly, so lets fix this before we try and create a plot of the data.

#Lets reorder the months
MonthOrder<-c('Jan','Feb','Mar','Apr',
'May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')
ANC$month<-factor(ANC$month,levels=MonthOrder)

Next, we need to actually calculate the indicator value from the numerator, factor and denominator.

#Calculate the indicator value
ANC$value<-ANC$numxfactor/ANC$denominatorvalue

Finally, lets create a simple trellis plot which compares ANC 1, 2, 3 for each district by month and save it to our local working directory in a file called "District_ANC.png".

png(filename="District_ANC.png",width=1024,height=768)
plot.new()
 xyplot(value ~ month | ou2, data=ANC, type="a", main="District ANC Comparison Sierra Leone 2011",
 groups=indshort,xlab="Month",ylab="ANC Coverage",
 scales = list(x = list(rot=90)),
 key = simpleKey(levels(factor(ANC$indshort)),
 points=FALSE,lines=TRUE,corner=c(1,1)))
 mtext(date(), side=1, line=3, outer=F, adj=0, cex=0.7)
dev.off()

The results of which are displayed below.

C.4. Mapping with R and Postgresql

A somewhat more extended example, will use the RPostgreSQL library and several other libraries to produce a map from the coordinates stored in the database. We will define a few helper functions to provide a layer of abstraction, which will make the R code more reusable.

#load some dependent libraries
 library(maps)
 library(maptools)
 library(ColorBrewer)
 library(ClassInt)
 library(RPostgreSQL)

#Define some helper functions
 
#Returns a dataframe from the connection for a valid statement
dfFromSQL<-function (con,sql){
    rs<-dbSendQuery(con,sql)
    result<-fetch(rs,n=-1)
    return(result)
}
#Returns a list of latitudes and
 longitudes from the orgunit table
dhisGetFacilityCoordinates<- function(con,levelLimit=4) {
sqlCoords<-paste("SELECT ou.organisationunitid, ou.name,
substring(ou.coordinates from E'(?=,?)-[0-9]+\\.[0-9]+')::double precision as latitude,
substring(ou.coordinates from E'[0-9\\.]+')::double precision as
 longitude FROM organisationunit ou where ou.organisationunitid
 in (SELECT DISTINCT idlevel",levelLimit, " from _orgunitstructure)
 and ou.featuretype = 'Point'
 ;",sep="")
 result<-dfFromSQL(con,sqlCoords)
 return(result)
 }

#Gets a dataframe of IndicatorValues,
# provided the name of the indicator,
# startdate, periodtype and level
dhisGetAggregatedIndicatorValues<-function(con,
indicatorName,
startdate,
periodtype="Yearly",
level=4)
{
  sql<-paste("SELECT organisationunitid,dv.value FROM aggregatedindicatorvalue dv
where dv.indicatorid  =
(SELECT indicatorid from indicator where name = \'",indicatorName,"\') and dv.level
 =", level,"and
 dv.periodid  = 
(SELECT periodid from period where 
startdate = \'",startdate,"\'
and periodtypeid = 
(SELECT periodtypeid from periodtype
 where name = \'",periodtype,"\'));",sep="")
   result<-dfFromSQL(con,sql)
 return(result)
 }

#Main function which handles the plotting.
#con is the database connection
#IndicatorName is the name of the Indicator
#StartDate is the startdate
#baselayer is the baselayer
plotIndicator<-function(con,
IndicatorName,
StartDate,
periodtype="Yearly",
level=4,baselayer) 
{
#First, get the desired indicator data
myDF<-dhisGetAggregatedIndicatorValues(con,
IndicatorName,StartDate,periodtype,level)
#Next, get the coordinates
coords<-dhisGetFacilityCoordinates(con,level)
#Merge the indicataors with the coordinates data frame
myDF<-merge(myDF,coords)
#We need to cast the new data fram to a spatial data
#frame in order to utilize plot
myDF<-SpatialPointsDataFrame(myDF[,
c("longitude","latitude")],myDF)
#Define some color scales
IndColors<-c("firebrick4","firebrick1","gold"
,"darkolivegreen1","darkgreen")
#Define the class breaks. In this case, we are going
#to use 6 quantiles
class<-classIntervals(myDF$value,n=6,style="quantile"
,pal=IndColors)
#Define a vector for the color codes to be used for the
#coloring of points by class
colCode<-findColours(class,IndColors)
#Go ahead and make the plot
myPlot<-plot.new()
#First, plot the base layer
plot(baselayer)
#Next, add the points data frame
points(myDF,col=colCode,pch=19)
#Add the indicator name to the title of the map
title(main=IndicatorName,sub=StartDate)
#Finally, return the plot from the function
return(myPlot) }


Up until this point, we have defined a few functions to help us make a map. We need to get the coordinates stored in the database and merge these with the indicator which we plan to map. We then retrieve the data from the aggregated indicator table, create a special type of data frame (SpatialPointsDataFrame), apply some styling to this, and then create the plot.

#Now we define the actual thing to do
#Lets get a connection to the database
con <- dbConnect(PostgreSQL(), user= "dhis", password="SomethingSecure", dbname="dhis")
#Define the name of the indicator to plot
MyIndicatorName<-"Total OPD Attendance"
MyPeriodType<-"Yearly"
#This should match the level where coordinates are stored
MyLevel<-4
#Given the startdate and period type, it is enough
#to determine the period
MyStartDate<-"2010-01-01"
#Get some Some Zambia district data from GADM
#This is going to be used as the background layer
con <- url("http://www.filefactory.com/file/c2a3898/n/ZMB_adm2_RData")
print(load(con))#saved as gadm object
#Make the map
plotIndicator(con,MyIndicatorName,MyStartDate,MyPeriodType,MyLevel,gadm)

The results of the plotIndicator function are shown below.

In this example, we showed how to use the RPostgreSQL library and other helper libraries(Maptools, ColorBrewer) to create a simple map from the DHIS2 data mart.

C.5. Using R, DHIS2 and the Google Visualization API

Google's Visualization API provides a very rich set of tools for the visualization of multi-dimensional data. In this simple example, we will show how to create a simple motion chart with the Google Visualization API using the "googleVis" R package. Full information on the package can be found here.. The basic principle, as with the other examples, is to get some data from the DHIS2 database, and bring it into R, perform some minor alterations on the data to make it easier to work with, and then create the chart. In this case, we will compare ANC1,2,3 data over time and see how they are related with a motion chart.

#Load some libraries
library(RPostgreSQL)
library(googleVis)
library(reshape)
#A small helper function to get a data frame from some SQL
dfFromSQL<-function (con,sql){
    rs<-dbSendQuery(con,sql)
    result<-fetch(rs,n=-1)
    return(result)
}

#Get a database connection
user<-"postgres"
password<-"postgres"
host<-"127.0.0.1"
port<-"5432"
dbname<-"dhis2_demo"
con <- dbConnect(PostgreSQL(), user= user,
password=password,host=host, port=port,dbname=dbname)
#Let's retrieve some ANC data from the demo database
sql<-"SELECT ou.shortname as province,
i.shortname as indicator,
extract(year from p.startdate) as year,
 a.value
FROM aggregatedindicatorvalue a
INNER JOIN  organisationunit ou on a.organisationunitid = ou.organisationunitid
INNER JOIN indicator i on a.indicatorid = i.indicatorid
INNER JOIN period p on a.periodid = p.periodid
WHERE a.indicatorid IN
(SELECT DISTINCT indicatorid from indicator where shortname ~*('ANC [123] Coverage'))
AND a.organisationunitid IN
 (SELECT DISTINCT idlevel2 from _orgunitstructure where idlevel2 is not null)
AND a.periodtypeid = (SELECT DISTINCT periodtypeid from periodtype where name = 'Yearly')"
#Store this in a data frame
anc<-dfFromSQL(con,sql)
#Change these some columns to factors so that the reshape will work more easily

anc$province<-as.factor(anc$province)
anc$indicator<-as.factor(anc$indicator)
#We need the time variable as numeric
anc$year<-as.numeric(as.character(anc$year))
#Need to cast the table into a slightly different format
anc<-cast(anc,province + year ~ indicator)
#Now, create the motion chart and plot it
M<-gvisMotionChart(anc,idvar="province",timevar="year")
plot(M)

The resulting graph is displayed below.

Using packages like brew or Rapache, these types of graphs could be easily integrated into external web sites. A fully functional version of the chart shown above can be accessed here.

Appendix D. DHIS 2 Workbook

D.1. Introduction

This workbook is intended to be used as guide for training sessions, where the trainer can follow the outlined steps to give a comprehensive demo and explanation of the system. It is also meant to be used as a self test, where the user of DHIS 2 can recap and get a practical hands-on exercise. It contains sections for the data visualizer, GIS and reports modules of DHIS 2.

D.2. Data Visualizer

  1. Overview - Explain briefly the various panels of the data visualizer

    • Left bar: Selection of chart type, input parameters and options for your visualization.

    • Top bar: Buttons for updating your visualization, saving as favorite, downloading and viewing data table.

    • Viewport: The area where the visualization will be rendered.

  2. Quickly create a minimal chart

    • Select a few indicators and click Update.

  3. Change the Chart type

    • Set chart type to Line chart and update.

    • Observe how the data trend is visualized over multiple months.

  4. Change the data Series, Category and Filter

    • Set chart type to Column chart.

    • Set category to organisation unit and filter to period.

    • Open Periods panel in the left bar, unselect Last 12 months and select This year.

    • Open Organisation Units panel in the left bar.

    • Right-click on the top organisation unit and click Select all children, then click update.

    • Observe how the the visualization is comparing the organisation units.

  5. Change Indicators

    • Remove the currently selected indicators by using the double-arrows.

    • Select an indicator group.

    • Select several indicators by double-clicking on them, then click update.

    • Repeat the process for data elements, which will display the aggregated numbers.

    • Repeat the process for reporting rates, which will display percentages for data sets.

  6. Change Periods

    • Open Periods panel in the left bar.

    • Select Last 4 quarters, and click update.

    • Observe all the available relative periods and how they are rendered in the chart.

  7. Use the Chart options

    • Create a line chart with one indicator and periods as category.

    • Select the Trend line option and click update, observe the trend line in the chart.

    • Insert a Target line value and Target line label, observe the target line in the chart.

    • Insert a Baseline value and Baseline label, observe the baseline in the chart.

  8. Save as Favorite

    • Click on the Favorite button on the top bar, then on Manage favorites.

    • Insert a name, click save and close the window.

    • Open favorites again and reload the favorite by clicking on it in the list.

    • Explore how you can put the chart in the dashboard in the dashboard module and open it in data visualizer by clicking on the Explore link.

  9. Download chart to local computer

    • Click on the Download button on the top bar.

    • Download as image file (in PNG format) by clicking on Image (PNG).

    • Download as PDF document by clicking on PDF.

  10. View data in Data table

    • Click on the Data table button and view the data in the table.

    • Observe how the columns can be sorted by clicking on the the column headers.

Appendix E.  DHIS Technical Architecture Guide

E.1. Overview

This document outlines the technical architecture for the District Health Information Software 2 (DHIS 2). The DHIS 2 is a routine data based health information system which allows for data capture, aggregation, analysis, and reporting of data.

DHIS 2 is written in Java and has a three-layer architecture. The presentation layer is web-based, and the system can be used on-line as well as stand-alone.

Fig. Overall architecture

E.2. Technical Requirements

The DHIS 2 is intended to be installed and run on a variety of platforms. Hence the system is designed for industry standards regarding database management systems and application servers. The system should be extensible and modular in order to allow for third-party and peripheral development efforts. Hence a pluggable architecture is needed. The technical requirements are:

  • Ability to run on any major database management system

  • Ability to run on any J2EE compatible servlet container

  • Extensibility and modularity in order to address local functional requirements

  • Ability to run on-line/on the web

  • Flexible data model to allow for a variety of data capture requirements

E.3. Project Structure

DHIS 2 is made up of 42 Maven projects, out of which 18 are web modules. The root POM is located in /dhis-2 and contains project aggregation for all projects excluding the /dhis-2/dhis-web folder. The /dhis-2/dhis-web folder has a web root POM which contains project aggregation for all projects within that folder. The contents of the modules are described later on.

Fig. Project structure

E.4. The Data Model

The data model is flexible in all dimensions in order to allow for capture of any item of data. The model is based on the notion of a DataValue. A DataValue can be captured for any DataElement (which represents the captured item, occurrence or phenomena), Period (which represents the time dimension), and Source (which represents the space dimension, i.e. an organisational unit in a hierarchy).

Figure E.1. Data value structure

Data value structure

A central concept for data capture is the DataSet. The DataSet is a collection of DataElements for which there is entered data presented as a list, a grid and a custom designed form. A DataSet is associated with a PeriodType, which represents the frequency of data capture.

A central concept for data analysis and reporting is the Indicator. An Indicator is basically a mathematical formula consisting of DataElements and numbers. An Indicator is associated with an IndicatorType, which indicates the factor of which the output should be multiplied with. A typical IndicatorType is percentage, which means the output should be multiplied by 100. The formula is split into a numerator and denominator.

Most objects have corresponding group objects, which are intended to improve and enhance data analysis. The data model source code can be found in the API project and could be explored in entirety there. A selection of the most important objects can be view in the diagram below.

Fig. Core diagram

E.5.  The Persistence Layer

The persistence layer is based on Hibernate in order to achieve the ability to run on any major DBMS. Hibernate abstracts the underlying DBMS away and let you define the database connection properties in a file called hibernate.properties.

DHIS 2 uses Spring-Hibernate integration, and retrieves a SessionFactory through Spring’s LocalSessionFactoryBean. This LocalSessionFactoryBean is injected with a custom HibernateConfigurationProvider instance which fetches Hibernate mapping files from all modules currently on the classpath. All store implementations get injected with a SessionFactory and use this to perform persistence operations.

Most important objects have their corresponding Hibernate store implementation. A store provides methods for CRUD operations and queries for that object, e.g. HibernateDataElementStore which offers methods such as addDataElement( DataElement ), deleteDataElement( DataElement ), getDataElementByName( String ), etc.

Fig. Persistence layer

E.6.  The Business Layer

All major classes, like those responsible for persistence, business logic, and presentation, are mapped as Spring managed beans. “Bean” is Spring terminology and simply refers to a class that is instantiated, assembled, and otherwise managed by the Spring IoC container. Dependencies between beans are injected by the IoC container, which allows for loose coupling, re-configuration and testability. For documentation on Spring, please refer to springframework.org.

The services found in the dhis-service-core project basically provide methods that delegate to a corresponding method in the persistence layer, or contain simple and self-explanatory logic. Some services, like the ones found in the dhis-service-datamart, dhis-service-import-export, dhis-service-jdbc, and dhis-service-reporting projects are more complex and will be elaborated in the following sections.

E.6.1. The JDBC Service Project

The JDBC service project contains a set of components dealing with JDBC connections and SQL statements.

Fig. JDBC BatchHandler diagram

The BatchHandler interface provides methods for inserting, updating and verifying the existence of objects. The purpose is to provide high-performance operations and is relevant for large amounts of data. The BatchHandler object inserts objects using the multiple insert SQL syntax behind the scenes and can insert thousands of objects on each database commit. A typical use-case is an import process where a class using the BatchHandler interface will call the addObject( Object, bool ) method for every import object. The BatchHandler will after an appropriate number of added objects commit to the database transparently. A BatchHandler can be obtained from the BatchHandlerFactory component. BatchHandler implementations exist for most objects in the API.

The JdbcConfiguration interface holds information about the current DBMS JDBC configuration, more specifically dialect, driver class, connection URL, username and password. A JdbcConfiguration object is obtained from the JdbcConfigurationProvider component, which currently uses the internal Hibernate configuration provider to derive the information.

The StatementBuilder interface provides methods that represents SQL statements. A StatementBuilder object is obtained from the StatementBuilderFactory, which is able to determine the current runtime DBMS and provide an appropriate implementation. Currently implementations exist for PostgreSQL, MySQL, H2, and Derby.

The IdentifierExtractor interface provides methods for retrieving the last generated identifiers from the DBMS. An IdentifierExtractor is obtained from the IdentifierExtractorFactory, which is able to determine the runtime DBMS and provide an appropriate implementation.

Fig. JDBC StatementManager diagram

The StatementHolder interface holds and provides JDBC connections and statements. A StatementHolder object can be obtained from the StatementManager component. The StatementManager can be initialized using the initalise() method closed using the destroy() method. When initialized, the StatementManager will open a database connection and hold it in a ThreadLocal variable, implying that all subsequent requests for a StatementHolder will return the same instance. This can be used to improve performance since a database connection or statement can be reused for multiple operations. The StatementManager is typically used in the persistence layer for classes working directly with JDBC, like the DataMartStore.

E.6.2. The Import-Export Project

The import-export project contains classes responsible for producing and consuming interchange format files. The import process has three variants which are import, preview and analysis. Import will import data directly to the database, preview will import to a temporary location, let the user do filtering and eventually import, while the analysis will reveal abnormalities in the import data. Currently supported formats are:

  • DXF (DHIS eXchange Format)

  • IXF (Indicator eXchange Format)

  • DHIS 1.4 XML format

  • DHIS 1.4 Datafile format

  • CSV (Comma Separated Values)

  • PDF (Portable Document Format)

Fig. Import-export service diagram

The low-level components doing the actual reading and writing of interchange format files are the converter classes. The most widely used is the XmlConverter interface, which provides a write( XmlWriter, ExportParams ) and a read( XmlReader, ImportParams ) method. Most objects in the API have corresponding XmlConverter implementations for the DXF format. Writing and reading for each object is delegated to its corresponding XmlConverter implementation.

The ExportParams object is a specification which holds the identifiers of the objects to be exported. The converter retrieves the corresponding objects and writes content to the XmlWriter. XmlConverter implementations for the DXF format exist for most objects in the API. For instance, the write method of class DataElementConverter will write data that represents DataElements in DXF XML syntax to the XmlWriter.

The ExportService interface exposes a method InputStream exportData( ExportParams ). The ExportService is responsible for instantiating the appropriate converters and invoke their export methods. To avoid long requests prone to timeout-errors in the presentation layer, the actual export work happens in a separate thread. The ExportService registers its converters on the ExportThread class using its registerXmlConverter( XmlConverter ) method, and then starts the thread.

The ImportParams obect contains directives for the import process, like type and strategy. For instance, the read method of class DataElementConverter will read data from the XmlReader, construct objects from the data and potentially insert it into the database, according to the directives in the ImportParams object.

The ImportService interface exposes a method importData( ImportParams, InputStream ). The ImportService is responsible for instantiating the appropriate converters and invoke their import methods. The import process is using the BatchHandler interface heavily.

The ImportExportServiceManager interface provides methods for retrieving all ImportServices and ExportServices, as well as retrieving a specific ImportService or ExportService based on a format key. This makes it simple to retrieve the correct service from using classes since the name of the format can be used as parameter in order to get an instance of the corresponding service. This is implemented with a Map as the backing structure where the key is the format and the value is the Import- or ExportService reference. This map is defined in the Spring configuration, and delegates to Spring to instantiate and populate the map. This allows for extensibility as developing a new import service is simply a matter of providing an implementing the ImportService interface and add it to the map definition in the Spring configuration, without touching the ImportExportServiceManager code.

Fig. Import-export converter diagram

Functionality that is general for converters of all formats is centralized in abstract converter classes. The AbstractConverter class provides four abstract methods which must be implemented by using converters, which are importUnique( Object ), importMatching( Object, Object), Object getMatching() and boolean isIdentical( Object, Object ). It also provides a read( Object, GroupMemberType, ImportParams ) method that should be invoked by all converters at the end of the read process for every object. This method utilizes the mentioned abstract methods and dispatches the object to the analysis, preview or import routines depending on the state of the object and the current import directives. This allows for extensibility as converters for new formats can extend their corresponding abstract converter class and reuse this functionality.

E.6.3. The Data Mart Project

The data mart component is responsible for producing aggregated data from the raw data in the time and space dimension. The aggregated data is represented by the AggregatedDataValue and AggregatedIndicatorValue objects. The DataSetCompletenessResult object is also included in the data mart and is discussed in the section covering the reporting project. These objects and their corresponding database tables are referred to as the data mart.

The following section will list the rules for aggregation in DHIS 2.

  • Data is a aggregated in the time and space dimension. The time dimension is represented by the Period object and the space dimension by the OrganisationUnit object, organised in a parent-child hierarchy.

  • Data registered for all periods which intersects with the aggregation start and end date is included in the aggregation process. Data for periods which are not fully within the aggregation start and end date is weighed according to a factor “number of days within aggregation period / total number of days in period”.

  • Data registered for all children of the aggregation OrganisationUnit is included in the aggregation process.

  • Data registered for a data element is aggregated based on the aggregation operator and data type of the data element. The aggregation operator can be sum (values are summarized), average (values are averaged) and count (values are counted). The data type can be string (text), int (number), and bool (true or false). Data of type string can not be aggregated.

    • Aggregated data of type sumint is presented as the summarized value.

    • Aggregated data of type sumbool is presented as the number of true registrations.

    • Aggregated data of type averageint is presented as the averaged value.

    • Aggregated data of type averagebool is presented as a percentage value of true registrations in proportion to the total number of registrations.

  • An indicator represents a formula based on data elements. Only data elements with aggregation operator sum or average and with data type int can be used in indicators. Firstly, data is aggregated for the data elements included in the indicator. Finally, the indicator formula is calculated.

  • A calculated data element represents a formula based on data elements. The difference from indicator is that the formula is on the form “data element * factor”. The aggregation rules for indicator apply here as well.

Fig. Data mart diagram

The AggregationCache component provides caching in ThreadLocal variables. This caching layer is introduced to get optimal caching [9]. The most frequently used method calls in the data mart component is represented here.

The DataElementAggregator interface is responsible for retrieving data from the crosstabulated temporary storage and aggregate data in the time and space dimension. This happens according to the combination of data element aggregation operator and data type the class represents. One implementation exist for each of the four variants of valid combinations, namely SumIntDataElementAggregator, SumBoolDataElementAggregator, AverageIntDataElementAggregator and AverageBoolAggregtor.

The DataElementDataMart component utilizes a DataElementAggregator and is responsible for writing aggregated data element data to the data mart for a given set of data elements, periods, and organisation units.

The IndicatorDataMart component utilizes a set of DataElementAggregators and is responsible for writing aggregated indicator data to the data mart for a given set of indicators, periods, and organisation units.

The CalculatedDataElementDataMart component utilizes a set of DataElementAggregators and is responsible for writing aggregated data element data to the data mart for a given set of calculated data elements, periods, and organisation units.

The DataMartStore is responsible for retrieving aggregated data element and indicator data, and data from the temporary crosstabulated storage.

The CrossTabStore is responsible for creating, modifying and dropping the temporary crosstabulated table. The CrossTabService is responsible for populating the temporary crosstabulated table. This table is used in an intermediate step in the aggregation process. The raw data is de-normalized on the data element dimension, in other words the crosstabulated table gets one column for each data element. This step implies improved performance since the aggregation process can be executed against a table with a reduced number of rows compared to the raw data table.

The DataMartService is the central component in the data mart project and controls the aggregation process. The order of operations is:

  • Existing aggregated data for the selected parameters is deleted.

  • The temporary crosstabulated table is created and populated using the CrossTabService component.

  • Data element data for the previously mentioned valid variants is exported to the data mart using the DataElementDataMart component.

  • Indicator data is exported to the data mart using the IndicatorDataMart component.

  • Calculated data element data is exported to the data mart using the CalculatedDataElementDataMart component.

  • The temporary crosstabulated table is removed.

The data element tables are called “aggregateddatavalue” and “aggregatedindicatorvalue” and are used both inside DHIS 2 for e.g. report tables and by third-party reporting applications like MS Excel.

E.6.4. The Reporting Project

The reporting project contains components related to reporting, which will be described in the following sections.

E.6.4.1. Report table

The ReportTable object represents a crosstabulated database table. The table can be crosstabulated on any number of its three dimensions, which are the descriptive dimension (which can hold data elements, indicators, or data set completeness), period dimension, and organisation unit dimension. The purpose is to be able to customize tables for later use either in third-party reporting tools like BIRT or directly in output formats like PDF or HTML inside the system. Most of the logic related to crosstabulation is located in the ReportTable object. A ReportTable can hold:

  • Any number of data elements, indicators, data sets, periods, and organisation units.

  • A RelativePeriods object, which holds 10 variants of relative periods. Examples of such periods are last 3 months, so far this year, and last 3 to 6 months. These periods are relative to the reporting month. The purpose of this is to make the report table re-usable in time, i.e. avoid the need for the user to replace periods in the report table as time goes by.

  • A ReportParams object, which holds report table parameters for reporting month, parent organisation unit, and current organisation unit. The purpose is to make the report table re-usable across the organisation unit hierarchy and in time, i.e. make it possible for the user to re-use the report table across organisation units and as time goes by.

  • User options such as regression lines. Value series which represents regression values can be included when the report table is crosstabulated on the period dimension.

Fig. Report table diagram

The ReportTableStore is responsible for persisting ReportTable objects, and currently has a Hibernate implementation.

The ReportTableService is responsible for performing business logic related to report tables such as generation of relative periods, as well as delegating CRUD operations to the ReportTableStore.

The ReportTableManager is responsible for creating and removing report tables, as well as retrieving data.

The ReportTableCreator is the key component, and is responsible for:

  • Exporting relevant data to the data mart using the DataMartExportService or the DataSetCompletenessService. Data will later be retrieved from here and used to populate the report table.

  • Create the report table using the ReportTableManager.

  • Include potential regression values.

  • Populate the report table using a BatchHandler.

  • Remove the report table using the ReportTableManager.

E.6.4.2. Chart

The Chart object represents preferences for charts. Charts are either period based or organisation unit based. A chart has tree dimensions, namely the value, category, and filter dimension. The value dimension contains any numbers of indicators. In the period based chart, the category dimension contains any number of periods while the filter dimension contains a single organisation unit. In the organisation unit based chart, the category dimension contains any number of organisation units while the filter dimension contains a single period. Two types of charts are available, namely bar charts and line charts. Charts are materialized using the JFreeChart library. The bar charts are rendered with a BarRenderer [2], the line charts with a LineAndShapeRenderer [2], while the data source for both variants is a DefaultCategoryDataSet [3]. The ChartService is responsible for CRUD operations, while the ChartService is responsible for creating JfreeCharts instances based on a Chart object.

Fig. Chart diagram

E.6.4.3. Data set completeness

The purpose of the data set completeness functionality is to record the number of data sets that have been completed. The definition of when a data set is complete is subjective and based on a function in the data entry screen where the user can mark the current data set as complete. This functionality provides a percentage completeness value based on the number of reporting organisation units with completed data sets compared to the total number of reporting organisation units for a given data set. This functionality also provides the number of completed data sets reported on-time, more specifically reported before a defined number of days after the end of the reporting period. This date is configurable.

Fig. Data set completeness diagram

The CompleteDataSetRegistration object is representing a data set marked as complete by a user. This property holds the data set, period, organisation unit and date for when the complete registrations took place. The CompleteDataSetRegistrationStore is responsible for persistence of CompleteDataSetRegistration objects and provides methods returning collections of objects queried with different variants of data sets, periods, and organisation units as input parameters. The CompleteDataSetRegistrationService is mainly delegating method calls the store layer. These components are located in the dhis-service-core project.

The completeness output is represented by the DataSetCompletenessResult object. This object holds information about the request that produced it such as data set, period, organisation unit, and information about the data set completeness situation such as number of reporting organisation units, number of complete registrations, and number of complete registrations on-time. The DataSetCompletenessService is responsible for the business logic related to data set completeness reporting. It provides methods which mainly returns collections of DataSetCompletenessResults and takes different variants of period, organisation unit and data set as parameters. It uses the CompleteDataSetRegistrationService to retrieve the number of registrations, the DataSetService to retrieve the number of reporting organisation units, and performs calculations to derive the completeness percentage based on these retrieved numbers.

The DataSetCompletenessExportService is responsible for writing DataSetCompletenessResults to a database table called “aggregateddatasetcompleteness”. This functionality is considered to be part of the data mart as this data can be used both inside DHIS 2 for e.g. report tables and by third-party reporting applications like MS Excel. This component is retrieving data set completeness information from the DataSetCompeletenessService and is using the BatchHandler interface to write such data to the database.

E.6.4.4. Document

The Document object represents either a document which is uploaded to the system or a URL. The DocumentStore is responsible for persisting Document objects, while the DocumentService is responsible for business logic.

Fig. Document diagram

E.6.4.5. Pivot table

The PivotTable object represents a pivot table. It can hold any number of indicators, periods, organisation units, and corresponding aggregated indicator values. It offers basic pivot functionality like pivoting and filtering the table on all dimensions. The business logic related to pivot tables is implemented in Javascript and is located in the presentation layer. The PivotTableService is reponsible for creating and populating PivotTable objects.

E.6.4.6. The External Project

The LocationManager component is responsible for the communication between DHIS 2 and the file system of the operating system. It contains methods which provide read access to files through File and InputStream instances, and write access to the file system through File and OutputStream instances. The target location is relative to a system property “dhis2.home” and an environment variable “DHIS2_HOME” in that order. This component is used e.g. by the HibernateConfigurationProvider to read in the Hibernate configuration file, and should be re-used by all new development efforts.

The ConfigurationManager is a component which facilitates the use of configuration files for different purposes in DHIS 2. It provides methods for writing and reading configuration objects to and from XML. The XStream library is used to implement this functionality. This component is typically used in conjunction with the LocationManager.

E.6.5. The System Support Project

The system support project contains supportive classes that are general and can be reused througout the system.

E.6.5.1. DeletionManager

The deletion manager solution is responsible for deletion of associated objects. When an object has a depdency to another object this association needs to be removed by the application before the latter object can be deleted (unless the association is defined to be cascading in the DBMS). Often an object in a peripheral module will have an associations to a core object. When deleting the core object this association must be removed before deleting the core object.The core module cannot have a dependency to the peripheral module however due to the system design and the problem of cyclic dependencies. The deletion manager solves this by letting all objects implement a DeletionHandler which takes care of associations to other objects. A DeletionHandler should override methods for objects that, when deleted, will affect the current object in any way. The DeletionHandler can choose to disallow the deletion completely by overriding the allowDelete* method, or choose to allow the deletion and remove the associations by overriding the delete* method. Eg. a DeletionHandler for DataElementGroup should override the deleteDataElement(..) method which should remove the DataElement from all DataElementGroups. If one decide that DataElement which are a member of any DataElementGroups cannot be deleted, it should override the allowDeleteDataElement() method and return false if there exists DataElementGroups with associations to that DataElement.

First, all DeletionHandler implementations are registered with the DeletionManager through a Spring MethodInvokingFactoryBean in the Spring config file. This solution adheres to the observer design pattern.

Second, all method invocations that should make the DeletionManager execute are mapped to the DeletionInterceptor with Spring AOP advice in the Spring config file. The DeletionInterceptor in turn invokes the execute method of the DeletionManager. First, the DeletionManager will through reflection invoke the allowDelete* method on all DeletionHandlers. If no DeletionHandlers returned false it will proceed to invoke the delete* method on all DeletionHandlers. This way all DeletionHandlers get a chance to clean up associations to the object being deleted. Finally the object itself is deleted.

E.7.  The Presentation Layer

The presentation layer of DHIS 2 is based on web modules which are assembled into a portal. This implies a modularized design where each module has its own domain, e.g. the dhis-web-reporting module deals with reports, charts, pivot tables, documents, while the dhis-web-maintenance-dataset module is responsible for data set management. The web modules are based on Struts and follow the MVC pattern [5]. The modules also follow the Maven standard for directory layout, which implies that Java classes are located in src/main/java, configuration files and other resources in src/main/resources, and templates and other web resources in src/main/webapp. All modules can be run as a standalone application.

Common Java classes, configuration files, and property files are located in the dhis-web-commons project, which is packaged as a JAR file. Common templates, style sheets and other web resources are located in the dhis-web-commons-resources project, which is packaged as a WAR file. These are closely related but are separated into two projects. The reason for this is that other modules must be able to have compile dependencies on the common Java code, which requires it to be packaged as a JAR file. For other modules to be able to access the common web resources, these must be packaged as a WAR file [6].

E.7.1. The Portal

DHIS 2 uses a light-weight portal construct to assemble all web modules into one application. The portal functionality is located in the dhis-web-portal project. The portal solution is integrated with Struts, and the following section requires some prior knowledge about this framework, please refer to struts.apache.org for more information.

E.7.1.1. Module Assembly

All web modules are packaged as WAR files. The portal uses the Maven WAR plug-in to assemble the common web modules and all web modules into a single WAR file. Which modules are included in the portal can be controlled simply through the dependency section in the POM file [7] in the dhis-web-portal project. The web module WAR files will be extracted and its content merged together.

E.7.1.2. Portal Module Requirements

The portal requires the web modules to adhere to a few principles:

  • The web resources must be located in a folder src/main/webapp/<module-artifact-id >.

  • The xwork.xml configuration file must extend the dhis-web-commons.xml configuration file.

  • The action definitions in xwork.xml for a module must be in a package where the name is <module-artifact-id>, namespace is /<module-artifact-id>, and which extends the dhis-web-commons package.

  • All modules must define a default action called index.

  • The web.xml of the module must define a redirect filter, open-session-in-view filter, security filter, and the Struts FilterDispatcher [8].

  • All modules must have dependencies to the dhis-web-commons and dhis-web-commons-resources projects.

E.7.1.3. Common Look-And-Feel

Common look and feel is achieved using a back-bone Velocity template which includes a page template and a menu template defined by individual actions in the web modules. This is done by using static parameters in the Struts/Xwork xwork.xml configuration file. The action response is mapped to the back-bone template called main.vm, while static parameters called page and menu refers to the templates that should be included. This allows the web modules to display its desired content and left side menu while maintaining a common look-and-feel.

E.7.1.4. Main Menu

The main menu contains links to each module. Each menu link will redirect to the index action of each module. The menu is updated dynamically according to which web modules are on the classpath. The menu is visibly generated using the ModuleManager component, which provides information about which modules are currently included. A module is represented by the Module object, which holds properties about the name, package name, and default action name. The ModuleManager detects web modules by reading the Struts Configuration and PackageConfig objects, and derives the various module names from the name of each package definition. The Module objects are loaded onto the Struts value stack by Struts interceptors using the ModuleManager. These values are finally used in the back-bone Velocity template to produce the menu mark-up.

E.8.  Framework Stack

The following frameworks are used in the DHIS 2 application.

E.8.1. Application Frameworks

E.8.2. Development Frameworks

DHIS2 Glossary

A

Aggregation

In the context of DHIS2, aggregation refers to how data elements are combined within a particular hierarchical relationship. As an example, all the health facilities in a particular district would contribute to the total value for the particular district in question. Different aggregation operators are supported within DHIS2, such as SUM, AVERAGE, and COUNT.

Aggregate data

In the context of DHIS2, aggregate data refers to either data elements or indicators that have been derived from other hierarchical data sources. For instance, aggreagte facility data would result from the aggregate totals of all patients that have attended that facility for a particular service. Aggregate district data would result from the aggregate totals of all facilities contained with a particular district.

C

Category

Categories are used to disaggreate data elements. As an example, the data element "Number of confirmed cases of malaria" could be disaggregated into an "Age" category, consisting of category options of "Under 1", 1-5" and "Over 5". Category options are used during data entry to simplify the number of data elements that need to be created. During analysis of data, categories function essentially as dimensions.

Category option

Category options are atomic elements that are grouped into categories. Category options are used during data entry to disaggregate data elements into atomic pieces of information.

D

Data dictionary

A collection of data elements and indicators, which can be exchanged with other DHIS systems. Typically used to define a set of data elements and indicators when setting up the DHIS system.

Data exchange format

In the context of DHIS2, the "data exchange format" refers to a XML schema that enables the transportation of data and metadata between disconnected DHIS instances, as well as between different applications that support the DXF schema.

Datamart

A set of database tables in DHIS2 that contains processed data elements and indicator values that is generated based on aggregation rules and calculated data element and indicator formular. Datamart tables are used for analysis and report production. Typically, users should not work directly with unaggregated data values, but rather with values that have resulted from a datamart export for analysis.

Data element

A data element is the fundamental building block of DHIS2. It is an atomic unit of data with well-defined meaning. Essentially it is a data value that has been actually observed or recorded which is further characterized by a number of dimensions. As an example the data element "Number of fully immunized children" would refer to the number of children that received this particular service. Data elements are always linked to a period as as well as an organizational unit. They optionally may be linked to other dimensions.

Data element group

Data element groups are used to categorize multiple data elements according to a common theme, such as "Immunization" or "ART". Typically, they are used during reporting and analysis to allow related data elements to be analyzed together.

Data element group sets

Data element groups are used to categorize multiple data element groups into a common theme.

Dimension

A dimension is used to categorize data elements during analysis. Dimensions provide a mechanism to group and filter data based on common characteristics. Typically, related data elements may be aggregated or filtered during analysis with the use of dimensions. Dimensions may be a member of a hierarchy. For instance the "Period" dimension may be broken down into "Day->Month->Quarter->Year".

DXF

See Data exchange format.

H

Health management information system

Typically, an electronic database system that is used to record aggregated data on service delivery, disease incidence, human resource data and other information used to evaluate the performance of delivery of health services. Typically, an HMIS does not contain the highly detailed data of electronic medical record systems or individual patient data.

I

Indicator

The divisor of an indicator. Can be composed of multiple data elements with the use of an indicator formula.

Equation 1. 


This is obviously a very generalized example. The numerator and indicator themselves can be composed of various data elements, factors, and the four basic operands (addition, multiplication, division and subtraction).

N

Numerator

The dividend of a indicator. Can be composed of multiple data elements and factors with the use of indicator formulas.

O

Organisational unit

An organisational unit is usually a geographical unit, which exists within hierarchy. As an example, in the United States, "Georgia" would be considered an organisational unit with in the orgunit level of "State". Organizational units can also be used to specify an administrative unit, such as a ward within a hospital. The organisational unit dimension specifies essentially "where" a particular data value occurs.

Organisational unit level

Refers to a level within an organizational hierarchy. Typically, countries are administered at different levels, such as 1) Country 2) States 3) Counties 4) Health facilities. In the context of DHIS2, health facilities typically are the lowest orgunit level. Data is aggregated upwards from the lowest orgunit level to the highest.

P

Period

A period is a specific time interval which consists of a start date and end date. For instance "January 2011" would refer to the time interval of January 1st 2011-January 31st 2011.

Bibliography

[AlSaid2010] Said Salah Eldin Al Said. The health information system in Sudan. The University of Oslo. 2010. http://urn.nb.no/URN:NBN:no-27062.

[Berg2007] Eivind Anders Berg. The challenges of implementing a health information system in Vietnam. The University of Oslo. 2007. http://urn.nb.no/URN:NBN:no-15021.

[BraaHedeberg2002] Jørn Braa and Calle Hedberg. The Struggle for District-Based Health Information Systems in South Africa”. Information Society. 18. 113-127. 2002. http://search.ebscohost.com/login.aspx?direct=true&#x0026;db=aph&#x0026;AN=6705438&#x0026;site=ehost-live.

[BraaNetworksAction2004] Eric; Braa Jørn; Monteiro and Sundeep Sahay. Networks of Action: Sustainable Health Information Systems Across Developing Countries”. MIS Quarterly. 28. 3. 2004. http://aisel.aisnet.org/misq/vol28/iss3/3/.

[Brucker2007] Øyvind F Brucker. Internationalization and localization - A case study from HISP. The University of Oslo. 2007. http://urn.nb.no/URN:NBN:no-15774.

[Damitew2005] Hirut Gebrekidan Damitew and Netsanet Haile Gebreyesus. Sustainability and optimal use of Health Information Systems. The University of Oslo. 2005. http://urn.nb.no/URN:NBN:no-11506.

[Jacucci06exploringtensions] Ved Anfinsen Edoardo Jacucci Cover Inger S. EXPLORING TENSIONS IN INFORMATION SYSTEMS STANDARDIZATION Two Case Studies from Healthcare in Norway and South Africa”. 2006. http://folk.uio.no/edoardo/MatNatAvh_Jacucci_rettet.pdf.

[Gjendem2008] Anders Gjendem. Recruitment, training, communication and Open Source. The University of Oslo. 2008. http://urn.nb.no/URN:NBN:no-19821.

[Gjerull2006] Nils Fredrik Gjerull. Open Source Software Development in Developing Countries. The University of Oslo. 2006. http://urn.nb.no/URN:NBN:no-13117.

[Heldre2006] Thor Helge Heldre. Study of a Health Information System pilot project in Tanzania. The University of Oslo. 2006. http://urn.nb.no/URN:NBN:no-12362.

[Jacobsen2006] Petter Jacobsen. Design and development of a global reporting solution for DHIS. The University of Oslo. 2006. http://urn.nb.no/URN:NBN:no-12659.

[BraaStandards2007] Arthur Heywood Woishet Mohammed Vincent Shaw Jørn Braa Ole Hanseth. DEVELOPING HEALTH INFORMATION SYSTEMS IN DEVELOPING COUNTRIES: THE FLEXIBLE STANDARDS STRATEGY”. MIS Q. 31. 1. 2007. http://heim.ifi.uio.no/~vshaw/Files/Published%20Papers%20included%20in%20Kappa/4_Braa_Flexible%20standards.pdf.

[Lewis2005] John Lewis. Design and development of spatial GIS application for primary healthcare sector. The University of Oslo. 2005. http://urn.nb.no/URN:NBN:no-11504.

[Mangset2005] Lars Mangset. DHIS-2 - A Globally Distributed Development Process. The University of Oslo. 2005. http://urn.nb.no/URN:NBN:no-10640.

[Ngoma2007] Caroline Ngoma. Cultivation Strategies in the Implementation of Health Management Information System in Zanzibar. The University of Oslo. 2007. http://urn.nb.no/URN:NBN:no-16911.

[Nguyen2007] Thanh Ngoc Nguyen. OSS For Health Care in Developing Countries. The University of Oslo. 2007. http://urn.nb.no/URN:NBN:no-17859.

[Saeb2009] E.K. Golly-Kobrissa R.T. Titlestad O. Braa J. Saeb J. Kossi. Integrating health information systems in Sierra Leone”. 379 - 391. 2009.

[ShawComplexityInspried2009] Vincent Shaw. A complexity inspired approach to co-evolutionary hospital management information systems development”. 2009. http://heim.ifi.uio.no/~vshaw/Files/VShaw%20Kappa%20Final%20Version.

[Staring_Titlestad_2008] Knut Staring and O H Titlestad. Development as a Free Software: Extending Commons Based Peer Production to the South”. ICIS 2008 Proceedings. 50. 2008. http://aisel.aisnet.org/icis2008/50.

[Store2007] Margrethe Store. Explore the challenges of providing documentation in open source projects. The University of Oslo. 2007. http://urn.nb.no/URN:NBN:no-15782.

[Storset2010] Leif Arne Storset. Integration of Health Management Information Systems. The University of Oslo. 2010. http://urn.nb.no/URN:NBN:no-25666.

[ShawScaling2007] Jorn Braa Vincent Shaw Shegaw Anagaw Mengiste. Scaling of Health Information Systems in Nigeria and Ethiopia- Considering the Options”. 2007. http://heim.ifi.uio.no/~vshaw/Files/Published%20Papers%20included%20in%20Kappa/6_Shaw_IFP9.4%20Scaling%20of%20HIS_Considering%20the%20Options.pdf.

[Vo2009] Kim Anh Thi Vo. Challenges of Health Information Systems Programs in Developing Countries: SUCCESS and FAILURE. The University of Oslo. 2009. http://urn.nb.no/URN:NBN:no-23652.

[Overland2010] Jan Henrik Øverland. An Open Source Approach to Improving GIS Implementations in Developing Countries. The University of Oslo. 2010. http://urn.nb.no/URN:NBN:no-24751.

[Overland2006] Lars Helge Øverland. Global Software Development and Local Capacity Building. University of Oslo. 2006. http://urn.nb.no/URN:NBN:no-13609.

Index

O

orgunitstructure, Resource tables