Data import into DHIS2

Jason Pickering

August 6, 2017

Set your login credentials and server

setwd("/home/jason/development/dhis2-data-munging/")
baseurl<-"http://localhost:8080/dhis/"
username<-"admin"
password<-"district"

Load some libraries and login to DHIS2

## [1] TRUE

Loading the data

Loading the data

All ages estimate All ages lower estimate All ages upper estimate country year
369.55116 142.92316 745.52936 Afghanistan 1990
483.6869 205.20409 965.83533 Afghanistan 1991
622.1754 264.81107 1203.39917 Afghanistan 1992
778.90703 357.96414 1485.74292 Afghanistan 1993
944.91716 449.15015 1733.13586 Afghanistan 1994
1105.99481 555.44891 2007.5 Afghanistan 1995

More data cleanup

d<-d_all[,c("All ages estimate","country","year")]
names(d)<-c("value","orgUnit","period")
d<-d[!is.na(d$value),]
d$value<-round(as.numeric(d$value))
## Warning: NAs introduced by coercion
knitr::kable(head(d))
value orgUnit period
370 Afghanistan 1990
484 Afghanistan 1991
622 Afghanistan 1992
779 Afghanistan 1993
945 Afghanistan 1994
1106 Afghanistan 1995

Matching the orgunits from DHIS2

## [1] "Bolivia (Plurinational State of)"     
## [2] "Cabo Verde"                           
## [3] "Côte d'Ivoire"                        
## [4] "Democratic People's Republic of Korea"
## [5] "Myanmar"                              
## [6] "Republic of Korea"                    
## [7] "Russian Federation"                   
## [8] "South Sudan"                          
## [9] "Venezuela (Bolivarian Republic of)"
from to
Bolivia (Plurinational State of) Bolivia
Cabo Verde Cape Verde
Côte d’Ivoire Cote d’Ivoire
Democratic People’s Republic of Korea Korea, Democratic People’s Republic of
Myanmar Burma
Republic of Korea Korea, Republic of
Russian Federation Russia
South Sudan South Sudan
Venezuela (Bolivarian Republic of) Venezuela

Create a new data element for the data

## Warning in set.seed(38894): '.Random.seed' is not an integer vector but of
## type 'NULL', so ignored