ESPEN_API_data: A function to request data from the ESPEN portal using API

Description Usage Arguments Details Value Author(s) Examples

View source: R/ESPEN_API_data.R

Description

Allows users to request data for countries through the ESPEN API. Users provide parameters as specified in <https://admin.espen.afro.who.int/docs/api/data> or as described below and the function returns a JSON string or data frame.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
ESPEN_API_data(
  api_key = NULL,
  country = NULL,
  iso2 = NULL,
  disease = "sth",
  level = "sitelevel",
  type = FALSE,
  subtype = "mda",
  start_year = NULL,
  end_year = NULL,
  limit = NULL,
  offset = NULL,
  attributes = NULL,
  df = TRUE
)

Arguments

api_key

the API key from ESPEN. You can request the key from ESPEN portal. We reccomend to set up the API key in the R environment as shown in the github repository. In this case you won't need to use this argument.

country

the name of the country. E.g 'Ghana'

iso2

optional: country ISO2 code, e.g. 'GH'. you can either specify a country name or the ISO2 code

disease

specify the disease of interest, options are lf , oncho , loa , sch , sth , trachoma , coendemicity

level

specify which the level of the data, options are 'iu' and 'sitelevel'. iu means implemantation unit.

type

logical: should you want a forcast of MDA or impact assessment. default is FALSE.

subtype

only use when type =TRUE, options are mda and impact_assessment.

start_year

specify the starting year of the data, e.g start_year = 2010

end_year

specify the starting year of the data, e.g end_year = 2020

limit

to specify how many records to return

offset

to specify how many records to skip

attributes

options are IU_ID, Endemicity, MDA, EffMDA. This is basically used to reduce the data.

df

logical: should the function return a dataframe (default) or list containing of the JSON strings.

Details

See <https://espen.afro.who.int/tools-resources/download-data> for more details on the data available.

Value

A dataframe or JSON file of the data

Author(s)

Olatunji Johnson o.johnson@lancaster.ac.uk

Examples

1
2
3
4
5
library(ESPENAPI)
# extract the STH data from Kenya at site level for year 2010.
data  <- ESPEN_API_data(country="Nigeria", disease="sth",
level="sitelevel", start_year=2010, end_year=2010)
head(data)

olatunjijohnson/ESPENAPI documentation built on Dec. 31, 2020, 1:07 a.m.