dhis2_import | R Documentation |
dhis2_import
downloads a dataset from a DHIS2 server. It works on datasets that are organized weekly or monthly.
dhis2_import( df, dataset, api_url, username, password, year_initial, year_final, period = c("weekly", "monthly") )
df |
a |
dataset |
string. The name of an available dataset from a DHIS2 server obtained from a |
api_url |
the URL of the DHIS2 api. Usually it is the server URL ending with "/api/" |
username |
the username required to access the DHIS2 server. |
password |
the password required to access the DHIS2 server. |
year_initial |
the initial year available in the dataset to import data from. |
year_final |
the last year available in the dataset to import data from. |
period |
either "weekly" or "monthly" periods are supported. |
A dataset containing all available data.
A Internet connection is needed to use this function. It might take a while depending on the connection.
Watch out for hardcoded login and password.
## Not run: # Demo available at https://play.dhis2.org/demo/ library("r-epigraphhub") api_url <- "https://play.dhis2.org/demo/api/" username <- "admin" password <- "district" datasets <- dhis2_datasets(api_url = api_url, username = username, password = password) my_dataset <- datasets$displayName[2] df_dhis2 <- dhis2_import(df = datasets, dataset = my_dataset, api_url = api_url, username = username, password = password, year_initial = 2021, year_final = 2022, period = "monthly") head(df_dhis2) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.