MyNixOS website logo
Description

Client for the 'DHIS2' Web API.

Connect and pull data from a 'DHIS2 (District Health Information Software 2)' instance into R.

dhis2r

Codecov testcoverage Lifecycle:stable R-CMD-check CRANstatus

Overview

dhis2r is an R client for the DHIS2 web API.

Pull data from a DHIS2 instance into R without logging into the DHIS2 user interface.

dhis2r, if used with Rmarkdown, quarto, Rshiny, etc., can improve routine reporting and data requests.

Motivation for this package

DHIS2 is an open-source, web-based Health Management Information System (HMIS), and currently being adopted in the education sector as the Education Management Information System (EMIS) in several countries.

More than 73 countries worldwide use DHIS2 for collecting and analyzing health data. 2.4 billion people (30% of the world’s population) live in countries where DHIS2 is used. (source: https://dhis2.org/)

With the increasing number of data managers/analysts downloading data from DHIS2 instances to make routine period reports, data visualisation and dashboards, this R package can make it much easier to pull the required data.

There are over 2 million R users, some of whom periodically analyse data from DHIS2; and support health programs which affect over the 2.4 billion people.

Installation

You can install the development version of dhis2r from GitHub with:

# install.packages("devtools")
devtools::install_github("amanyiraho/dhis2r")

Usage

How to connect to a DHIS2?

Users must be authenticated to access a specific DHIS2 instance before connecting to it.

The easiest way to connect to a DHIS2 instance using dhis2r is to use the username and password of the DHIS2 user.

library(dhis2r)
dhis2_play_connection <- Dhis2r$new(base_url = "https://play.dhis2.org/",
                                    username = "admin",
                                    password = "district",
                                    api_version = "2.39.0.1",
                                    api_version_position = "before")

Dhis2r$new() returns a Dhis2r R6 class which represents a DHIS2 connection and can be used to query the DHIS2 instance

No need to log in again when performing other querying tasks.

How to pull data from DHIS2

As an example, let’s pull Analytics data of BCG doses given

Analytics data can include data from indicators, dataElements, program indicators, etc.

# dhis2_play_connection$get_analytics(analytic = "s46m5MS0hxu", #BCG doses given
#                                     org_unit = "ImspTQPwCqd", #Sierra Leone (National level)
#                                     period = "202101",
#                                     output_scheme = "NAME" )

You can pull data on the following:

  • Information about the account
  • Access rights information about the account
  • Metadata
  • Organisation units
  • Analytics
  • All possible resources

For more in depth illustration use the vignette dhis2rvignette("dhis2r")

Please note that the dhis2r project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Metadata

Version

0.1.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows